Synthèse automatique
Pipeline de réécriture minimale de code qui extrait les fonctionnalités, valide indépendamment, capture des fixtures, discute avec l'utilisateur, puis implémente via TDD avec un nombre minimal de lignes de code.
Points forts
- Réduction drastique du nombre de lignes de code sans perte de fonctionnalités
- Validation indépendante pour éviter les biais du producteur
- Approche TDD garantissant la testabilité et la robustesse
- État persistant permettant reprise et retour en arrière
Limites
- Nécessite une configuration initiale et une structure de fichiers spécifique
- Pipeline complexe avec plusieurs phases, peut être lourd pour de petits projets
- Dépend de la qualité de l'extraction des fonctionnalités et des validateurs indépendants
Quand vous voulez réduire la taille d'un projet tout en conservant toutes ses fonctionnalités, ou réécrire un sous-système de manière minimale.
Pour des refontes simples ou des projets très petits où le coût de mise en place du pipeline dépasse les bénéfices.
Analyse de sécurité
SûrThe skill orchestrates a project rewrite pipeline using standard tools (Read, Write, Bash, etc.) for legitimate software engineering tasks. No destructive or exfiltrating commands are instructed, and all operations are scoped to a pipeline directory. No risky patterns like curl|sh, secret handling, or obfuscation.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
/rewrite-minimal/rewrite-minimal --scope src/auth/rewrite-minimal --resume --scope src/utils --rewind P2name: rewrite-minimal description: "Minimal-LOC project rewrite pipeline. Deep-scans a project or chosen subsystem, extracts user-observable features with evidence, validates the feature list independently, captures golden I/O fixtures from the running system, researches alternative stacks/languages, discusses features with the user in batches with LOC deltas, rewrites TDD-first with minimal LOC, validates implementation conformance independently. Use when the user wants to reduce AI slop / LOC in a project without losing features, wants to rewrite a subsystem minimally, or invokes /rewrite-minimal." argument-hint: "[--resume] [--rewind <phase>] [--scope <id>] [--new-scope]" allowed-tools:
- Read
- Write
- Edit
- Bash
- Glob
- Grep
- AskUserQuestion
- Agent
- WebSearch
- WebFetch
rewrite-minimal
Pipeline for rewriting a project (or a chosen part) to minimal LOC via feature extraction, TDD, and independent validation. The orchestrator (you) drives phases, spawns subagents, enforces output discipline, and persists state to files so any phase can resume or rewind.
Core principles — read before every phase
- Feature = testable invariant with file:line evidence. Not a fuzzy noun. If a feature has no evidence anchor, it's a hallucination — drop it.
- Validators are independent subagents with zero producer context. Same context = rubber stamp. Spawn via
Agenttool as fresh instances. - File-based state. Every subagent writes only its own namespace. You read the union. No in-memory handoff.
- Hard output budget per phase gate: ≤15 visible lines, one question, overflow → file path cited. The user wants features and decisions, not narration.
- Loop, don't fail. P2 and P8 validators produce findings; the producer subagent re-runs with findings as input. User only sees the loop iteration count and any disputed items.
- Work in scope. Every phase respects the active scope (directory / module / subsystem). Cross-scope references are contract boundaries, not rewrite targets.
- Parallelize where safe. Extraction, research, and fixture capture per-surface run as parallel
Agentcalls in a single message.
Invocation handling
On start, read pipeline/registry.json if present.
--resume: loadstate.jsonfor active scope, continue from current phase.--rewind <phase>: roll state back to<phase>, mark downstream artifacts stale in state, re-enter phase.--scope <id>: switch active scope.--new-scope: force scope selection prompt.- No args, no state: enter Scope Selection.
- No args, state present: show 1-line status +
AskUserQuestion{resume current scope | pick another | new scope | rewind}.
Phase map
P_scope Scope Selection (pre-phase, runs once per scope)
P0 Dead Code Purge
P1 Feature Extraction (parallel subagents)
P2 Feature List Validation (independent validator + fix loop)
P3 Golden Fixture Capture (requires real config/data)
P4 Stack Research (parallel, web, open-ended)
P5 Feature Discussion (batched, LOC deltas, anti-features)
P6 Architecture & Plan (per-phase split)
P7 TDD Implementation (plan-phase loop)
P8 Implementation Validation (independent validator + fix loop)
P9 Diff Report
Read PHASES.md for per-phase instructions. Read SCHEMAS.md for file formats. Read AGENTS.md for subagent prompt templates. See README.md for install instructions.
State and layout
Everything for a scope lives under pipeline/scopes/<scope_id>/. Registry of scopes lives at pipeline/registry.json. See SCHEMAS.md for JSON shapes and feature file frontmatter.
pipeline/
registry.json
scopes/
<scope_id>/
state.json
scope.md # scope definition + boundary contract
scan/deadcode.md
features/<feat_id>.md # one file per feature
fixtures/<feat_id>/*.jsonl
research/<stack>.md
anti-features.md
validation/
features.md # P2 report
implementation.md # P8 report
plan/phase-NN.md
diff.md # P9 report
Output discipline (hard rules)
Before any user-visible text, count your lines. If over 15, move detail to a file and cite the path. Never emit code, examples, stack traces, or long lists in visible text — cite a file path. The only tables allowed are short enumerable facts (file counts, pass/fail). Prose between tool calls ≤25 words.
One AskUserQuestion per phase gate. If you need multiple answers, batch them into a single question's options or defer to next gate. Validation fix loops do not gate on the user unless the producer disputes a finding.
Subagent spawn rules
- Validators (P2, P8): spawn with
Agenttool, fresh context, prompt fromAGENTS.md#validator. Must read code + producer output and independently re-derive findings. Do not pass them prior conversation context. - Extractors (P1) and Fixture capturers (P3): spawn in parallel — one subagent per module / surface. Single message, multiple
Agenttool calls. - Researchers (P4): spawn in parallel, one per candidate stack. Open-ended — let them explore. At P4 start, detect notebooklm in two steps: (a) scan session skills for any skill whose name contains
notebooklm, (b) runcommand -v notebooklmvia Bash for CLI presence. If skill AND CLI are both present, setnotebooklm_mode: cliand pass to researchers so they use thenotebooklmCLI for RAG over official docs. If skill is present but CLI is missing, emit the install hint once (uv tool install "notebooklm-py[browser]"+uvx --from "notebooklm-py[browser]" playwright install chromium+notebooklm login) and proceed this run without notebooklm. If no skill is present, do not recommend notebooklm-py at all — the user has no skill-level integration. After P4 research returns, spawn a loc-matrix subagent to consolidateper_feature_locfrom every research file intoresearch/LOC_MATRIX.md. - Planner (P6), Test-writer / Implementer / Verifier (P7): separate subagents per role, separate contexts. Verifier must not share context with implementer.
- Anti-feature check (P8): LLM-based subagent reads new code +
anti-features.md, reports violations. Do not use grep for this step — anti-features are semantic, not textual.
Validation fix loop protocol
Used by P2 and P8.
- Validator subagent writes findings to
validation/<phase>.mdwith severity, file:line, and rationale per finding. - You read the findings. If any critical: spawn producer subagent again with findings + original inputs, instruct "fix or dispute". Producer either updates artifacts or writes a dispute block per finding.
- Re-spawn validator (fresh context) on updated artifacts.
- Repeat until zero critical findings or producer has disputed a finding that the validator continues to raise.
- On persistent dispute (iteration ≥2 with same finding disputed): surface to user via
AskUserQuestionwith validator position, producer position, and "who's right" options. This is the only user gate inside a fix loop. - Record iteration count, final state, and any dispute resolutions in
state.jsonunder the phase entry.
User sees only: iteration count, current failing count, disputes awaiting decision. Never the raw findings in chat — only file path.
Scope selection (P_scope)
On first run for a project, enumerate natural boundaries via quick scan:
- Top-level source dirs (
src/,crates/*,packages/*,apps/*,services/*) - Language / framework boundaries
- Declared modules from manifest (
Cargo.tomlmembers,package.jsonworkspaces,go.mod,pyproject.tomlpackages)
Present ≤10 candidates via AskUserQuestion with options: "whole project", each candidate, or "custom path". On custom, ask via follow-up question for a path.
Once picked, create scope.md with:
- scope_id (slug)
- path glob(s)
- boundary contract: which symbols / APIs / files the scope exports and imports (this is the interface the rewrite must preserve)
- excluded sub-paths
Write to registry. Initialize state.json with phase: "P0".
Resume / rewind mechanics
state.json carries phase, status, fix_loop_iteration, rewind_history, and per-phase artifact_hashes. On rewind: copy current entry into rewind_history, set phase to target, mark all artifact files from later phases as stale (do not delete — they are reference for the re-run). Re-entering a phase should diff against stale artifacts and surface what changed, not start from zero.
Visible output templates per phase gate
Each gate uses roughly this shape. Anything longer → cite the file.
P<N> <phase name> <status>
<≤3 lines of essential numbers / findings>
<file paths for detail>
<one question via AskUserQuestion>
Example for P2 passing:
P2 feature validation: 47 features, coverage 98%, 0 critical
file: pipeline/scopes/core/validation/features.md
proceed to P3?
Example for P5 batch:
P5 discuss batch 3/6 — storage
6 features, LOC now 1240, stack-A 380, stack-B 510
file: pipeline/scopes/core/features/ (batch_3 listed below)
<question with keep/remove/modify/merge per feature>
When to stop and ask
Stop and ask the user if:
- Scope is ambiguous or boundary contract is not derivable from code.
- P3 cannot find a runnable surface (no tests, no CLI, no server). Warn explicitly that fixtures will be synthetic-only; confirm before proceeding.
- P2 or P8 has a dispute persisting past iteration 2.
- P4 research surfaces a stack that would eliminate a feature the user marked "keep" — surface the conflict.
- LOC budget in P7 is about to be exceeded by >20% — confirm continue or re-plan.
Otherwise proceed. Do not ask about trivia, taste, or naming.
Anti-patterns (do not do)
- Do not summarize the full pipeline to the user at any gate. They know it.
- Do not emit code in chat. Write it to files.
- Do not re-explain why a feature was removed after the user decided. Move on.
- Do not let validators read the producer's reasoning. Only the artifacts.
- Do not run P3 before the user confirms the system has real config and data.
- Do not spawn sequential subagents when they can be parallel.
- Do not skip the P2 or P8 fix loop — even one iteration catches drift.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/minimal-rewrite-ms1aw40r' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/minimal-rewrite-ms1aw40r/download' --output '.skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md.part' && mv '.skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md.part' '.skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md' && test -s '.skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/rewrite-minimal' && cp -R '.skill-downloads/minimal-rewrite-ms1aw40r' '.claude/skills/rewrite-minimal'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/minimal-rewrite-ms1aw40r'openskills read 'minimal-rewrite-ms1aw40r'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/minimal-rewrite-ms1aw40r/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.