code-repair
Skill0 starsChanged 5 months agoMITView on GitHub
Remediate failures from code-verify, db-migration verify, feature-spec review, or open-language fix requests. Maps free text to implementation framework (SPECs, CONVENTIONS, NEXT, concepts); re-runs originating verifier before pass. Use code-repair repair - from …, repair - custom - …, or natural-language fixes.
In this repository22 other files it gives its agents.
- ai-directorSkill
- code-implementationSkill
- code-verifySkill
- concept-runSkill
- db-migrationSkill
- deploy-basicSkill
- deploy-filesSkill
- dev-stackSkill
- docsSkill
- feature-specSkill
- infra-terraformSkill
- plan-foundationSkill
- plan-masterSkill
- plan-repairSkill
- plan-syncSkill
- plan-verifySkill
- process-routerSkill
- project-bootstrapSkill
- project-query-setupSkill
- session-controlSkill
- tauri-developmentSkill
- x-directorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Findings in, evidence out: Start from a numbered findings table (prior verifier report in chat, run the source verifier now, or decompose a …
- Distinctive: line 23
Re-verify mandatory: After repairs, re-run the same upstream check that produced the findings (see R4).
- Very specific: line 26
Schema via db-migration: No inline DDL. Follow .cursorrules § Migration policy.
- Very specific: line 27
Protected files / secrets: Stop on code-verify S1/S5 failures.
- Very specific: line 29
Every repair mode ends with a Completion checklist - each item pass | fail | skip with evidence.
- Very specific: line 30
Operator handoff: every response that ends a turn follows the Operator handoff contract — terse output.
- Very specific: line 66
If the current chat contains a fail report from @code-verify or @db-migration verify in the last 3 assistant turns → use that mode.
- Very specific: line 72
When invocation is explicit (repair - from milestone, from uncommitted, …), skip R0-free.
- Distinctive: line 92
Custom brief / open language: - run R0-free, then decompose into F* rows with explicit paths.
- Very specific: line 94
If there are no fixable findings and the tree is clean after optional source run → stop with verdict nothing to repair.
- Distinctive: line 135
If >50% of rows are owner and the user did not ask for documentation-only → stop and list owner actions.
- Very specific: line 139
Read before implementing fixes.
- Distinctive: line 167
Stop: if a fix requires protected file edit without approval.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
code-repair
Remediation layer for the implementation workflow. Implements fixes; does not replace detection (code-verify) or iteration planning (code-implementation).
Pairs with: code-verify (findings source + mandatory re-verify), code-implementation (task gate + post-fix re-gate), db-migration, feature-spec, concept-run, .cursorrules, .work/standards/*CONVENTIONS*, .work/standards/*FEATURE_STANDARD*.
Canonical path: .ai/skills/code-repair/skill.md · Invocation examples: reference.md
Registry: .ai/skills/SKILL_DEPENDENCIES.md.
Hard rules:
- Findings in, evidence out. Start from a numbered findings table (prior verifier report in chat, run the source verifier now, or decompose a custom brief). No code changes without documented F* rows.
- Re-verify mandatory. After repairs, re-run the same upstream check that produced the findings (see R4). Claim repaired only when that check passes (or pass with gaps only for documented waivers).
- Standards-bound. Apply
.cursorrules, CONVENTIONS, FEATURE_STANDARD, relevant SPECs, and.ai/concepts/README.md§ Trigger table on every fix diff. AI-assisted by default; MOD-06 required when agent-authored code changes unlesshuman-onlyin the same message. - Scope discipline. Edit only paths tied to findings or an explicit user file list. Out-of-scope expansion requires user approval in the same message.
- Schema via db-migration. No inline DDL. Follow
.cursorrules§ Migration policy. Mass backfills forbidden; test DB ad-hoc DML requires human approval. - Protected files / secrets. Stop on
code-verifyS1/S5 failures; do not work around without owner approval in HANDOFF or the same user message. - Does not own HANDOFF/NEXT unless the user explicitly asks (route bookends to
session-control). May update taskNotes,UNKNOWNS.md, and concept registry rows. - Every repair mode ends with a Completion checklist - each item
pass|fail|skipwith evidence. - Operator handoff: every response that ends a turn follows the Operator handoff contract — terse output; approvals under
**Needs your approval:**citingpath:L<n>; questions numbered under**Needs your answer:**; exactly one**Next step:**command; one line when nothing is needed (Form A). Decisions and questions never mixed; empty sections omitted.
Parse invocation
Normalize to mode + optional source or brief. Use ASCII hyphen - between tokens.
| User says | Mode | Action |
@code-repair | repair | Repair protocol - infer source (see default below) |
@code-repair repair | repair | Same |
@code-repair repair - from uncommitted | repair | Findings from @code-verify uncommitted (run if no fresh report) |
@code-repair repair - from milestone | repair | Findings from @code-verify milestone |
@code-repair repair - from last | repair | Findings from @code-verify last |
@code-repair repair - from migration | repair | Findings from @db-migration verify |
@code-repair repair - from feature-spec - <path> | repair | Findings from @feature-spec review - <path> |
@code-repair repair - custom - <brief> | repair | User brief → findings table → fix → targeted re-verify |
@code-repair fix - … | repair | Alias for repair |
@code-repair status | status | Status protocol - read-only |
Open language examples (map to rows above):
@code-repair - fix the lint errors in apis/src/foo.py
@code-repair repair - custom - add test for SPEC R3 edge case in identity module
@code-repair - tests failed on the payment webhook handler
@code-repair fix verify findings from the last commitFree request → implementation alignment: When findings come from open language (repair - custom - …, goal text after -, or implicit source resolution with no verifier report in chat), run R0-free before triage. The map feeds F* rows (add Implementation ref column) and constrains R2/R3 to framework-consistent fixes.
Legacy / colloquial: remediate → repair; audit as source → from uncommitted (same alias as code-verify).
Default source when omitted:
- If the current chat contains a fail report from
@code-verifyor@db-migration verifyin the last 3 assistant turns → use that mode. - Else if working tree dirty → from uncommitted.
- Else if
.work/plans/NEXT.mdhas valid## Current iteration→ from milestone. - Else if user message describes a code/test/lint fix without naming source → custom (run R0-free).
- Else ask once: Q: Which findings should I repair? (paste report,
from uncommitted,from migration, orcustom - …)
When invocation is explicit (repair - from milestone, from uncommitted, …), skip R0-free; record **Request:** explicit source.
Repair protocol
R0 - Findings intake (mandatory)
Build a Findings table before editing:
| ID | Source | Severity | Finding | Affected paths | Fix strategy | Implementation ref |
| F1 | code-verify uncommitted | fail | … | … | code / config / owner | — (verify-sourced) |
Implementation ref — populate for open language / custom / inferred fixes; may be — when rows come from @code-verify, @db-migration verify, or @feature-spec review reports. Must cite at least one: SPEC rule (R{n}), task M{N}-T{N}, .cursorrules section, CONVENTIONS/FEATURE_STANDARD, concept MOD id, {MASTER_PLAN} §19, migration policy, or HANDOFF waiver.
Obtain findings by:
- Chat report - parse the latest verifier output in the session, or
- Run source now - invoke the matching skill (see Source → re-verify map), or
- Custom brief / open language - run R0-free, then decompose into F* rows with explicit paths.
If there are no fixable findings and the tree is clean after optional source run → stop with verdict nothing to repair; suggest @code-verify uncommitted or @session-control status.
R0-free - Implementation alignment (free requests only)
When: Findings from custom brief, open-language message, or goal text after - without a verifier report in the last 3 turns. Skip when all F* rows come from @code-verify, @db-migration verify, or @feature-spec review.
Produce an Implementation alignment map before filing F* rows:
### Free request → Implementation alignment
**Request:** <one-line paraphrase>
| Aspect | Framework component | Artifact / gate | Action |
|--------|---------------------|-------------------|--------|
| <phrase from request> | SPEC rule | `.work/features/<slug>/*-SPEC.md` R{n} | Implement / test |
| <…> | Iteration task | `NEXT.md` M{N}-T{n} | Scope / Notes |
| <…> | CONVENTIONS | `.work/standards/*CONVENTIONS*` | Naming / layout |
| <…> | FEATURE_STANDARD | `.work/standards/*FEATURE_STANDARD*` | Test plan shape |
| <…> | Migration policy | `.cursorrules` § Database | `@db-migration create` if schema |
| <…> | MOD-06 | `.ai/concepts/` | Required for agent-authored fix |
| <…> | MOD-01 | `{BOUNDARY_MAP}` / DIRECTORY_MAP | Cross-boundary check |
| <…> | Task gate | `code-implementation` § Task gate | tests/lint/type after fix |
| <…> | Master plan FR | `{MASTER_PLAN}` §19 / §3–4 | Traceability |Rules:
- Minimum one row per distinct aspect; label probabilistic mappings Inference.
- Redirect plan-only gaps to
@plan-repair/@plan-master revisein triage — do not fix in code-repair. - Freeze map before F* triage; update if new connections appear.
Triage each row (annotate in report):
| Disposition | Action |
| fix-now | Agent resolves under standards |
| owner | Log in .work/plans/UNKNOWNS.md or HANDOFF § Open owner actions; do not claim pass |
| waiver | Only with HANDOFF or same-message user approval; cite in report |
| redirect | Wrong layer (plan docs → @plan-repair / @plan-master revise; missing iteration → @code-implementation plan - M{N}) |
If >50% of rows are owner and the user did not ask for documentation-only → stop and list owner actions.
R1 - Context load (mandatory)
Read before implementing fixes. Record pass only after reading.
| # | File (repo-root path) | When |
| 1 | .cursorrules | always |
| 2 | .work/context/HANDOFF.md | always |
| 3 | .work/plans/NEXT.md § Current iteration | iteration-scoped findings |
| 4 | .work/standards/*CONVENTIONS* | app code or tests touched |
| 5 | .work/standards/*FEATURE_STANDARD* | app code or tests touched |
| 6 | Relevant .work/features/<slug>/*-SPEC.md | per bounded context in F* paths |
| 7 | .ai/concepts/README.md § Trigger table | architecture, boundaries, AI-assisted diff |
| 8 | .work/plans/UNKNOWNS.md | open U* rows referenced by findings |
State a short assumption ledger (Confirmed / Inference / Unverified) when the fix depends on non-obvious behavior.
R2 - Plan fixes (no code yet)
Output a Repair plan (≤15 lines): order of F* ids, files to touch, whether @db-migration create or @concept-run is required, and what will be re-run in R4.
Fix order: secrets/protected → scope blockers → tests/lint/type → migration idempotency → SPEC/concept gaps → docs-only.
R3 - Apply fixes
- Minimal diff - smallest change that resolves the finding.
- Per finding - one logical commit worth of change; note in report if split is needed.
- Schema -
@db-migration create/ amend script; never inline DDL in application code. - Concepts -
@concept-run - MOD-06when agent fixes application code; MOD-01 when diff crosses hard module boundaries per{BOUNDARY_MAP}. - TODO/FIXME - promote to
UNKNOWNS.mdor taskNotesbefore claiming F* fixed. - Stop if a fix requires protected file edit without approval.
<a id="r4--re-verify-mandatory"></a>
R4 - Re-verify (mandatory)
| Repair source (invocation) | Re-run after fixes |
| from uncommitted | @code-verify uncommitted |
| from milestone | @code-verify milestone |
| from last | @code-verify last |
| from migration | @db-migration verify + Migration policy §3 startup log check when runner wiring may have changed |
| from feature-spec - <path> | @feature-spec review - <path> |
| custom | At minimum @code-verify uncommitted if tree dirty; plus any checks named in the brief |
Iteration tasks touched: also run the mechanical subset of code-implementation § Task gate (tests, lint, type, scope, secrets, warnings in touched files) for each affected task id. Record:
Task M{N}-T{N} re-gated <YYYY-MM-DD> after code-repair: pass | fail (<reason>)Verdict:
| Verdict | Meaning |
| repaired | Originating verifier pass; task re-gates pass where applicable |
| partial | Some F* fixed; re-verify still fail or owner items remain |
| failed | Could not fix; re-verify fail |
| nothing to repair | No findings / clean tree |
R5 - Repair report (mandatory output)
## code-repair - <source> - <verdict>
**Date:** <ISO> · **Branch:** <branch> · **Tree:** clean | dirty
<when open language / custom — insert ### Free request → Implementation alignment; else: **Request:** explicit source>
### Findings
| ID | Disposition | Status | Evidence |
|----|-------------|--------|----------|
| F1 | fix-now | fixed | re-verify uncommitted: pass |
### Completion checklist
| # | Check | Result | Evidence |
|---|-------|--------|----------|
| 1 | Findings table (R0) | pass/fail | |
| 1b | R0-free map (open language only) | pass/skip | |
| 2 | Context load (R1) | pass/fail | |
| 3 | Repair plan shown (R2) | pass/fail | |
| 4 | Standards / SPEC / concepts applied | pass/fail | |
| 5 | Fixes minimal and in scope | pass/fail | |
| 6 | Originating verifier re-run (R4) | pass/fail | |
| 7 | Task re-gate (if iteration) | pass/skip | |
| 8 | Residual risks in Notes or UNKNOWNS | pass | |
### Remaining / owner
<list or none>
### Next
@code-implementation continue | @code-verify milestone | @session-control closeAny operator-required approval or question (e.g. owner items under Remaining / owner, waivers, scope expansion) must ALSO appear in the closing handoff block (enumerated, with path:line), not only in the report body. End the report with the Operator handoff close (Form A Next: … or Form B **Needs your approval:** / **Needs your answer:** / **Next step:**) per SKILL_DEPENDENCIES.md.
Status protocol
Read-only. No fixes.
git status -sb·git diff --stat.work/plans/NEXT.md- active iteration? blocked tasks?- Note last verifier mention in chat if visible; else "unknown - run code-verify first"
## code-repair status
**Tree:** clean | dirty (<N> files)
**Iteration:** M{N} active | none
**Suggested repair:** @code-repair repair - from uncommitted | from milestone | custom - …End the report with the Operator handoff close (Form A Next: … or Form B **Needs your approval:** / **Needs your answer:** / **Next step:**) per SKILL_DEPENDENCIES.md.
Integration
| Skill | Relationship |
code-verify | Upstream detector - on fail, recommend @code-repair repair - from <mode>. Does not auto-invoke repair. |
code-implementation | Batch-end sweep fail → @code-repair repair - from uncommitted. Shares task gate and post-fix re-gate semantics. |
db-migration | verify fail → @code-repair repair - from migration. |
feature-spec | review fail → @code-repair repair - from feature-spec - <path> (SPEC/doc fixes) or route code gaps to implementation. |
concept-run | Run when repair diff triggers MOD rows per concept pack. |
session-control | Optional after repaired before close commit. |
Anti-patterns
- Claiming repaired without re-running the originating verifier
- Fixing without reading CONVENTIONS / FEATURE_STANDARD / relevant SPECs
- Expanding scope beyond F* rows without user approval
- Inline DDL instead of
@db-migration create - Skipping MOD-06 on agent-authored code fixes
- Marking owner/legal/vendor items as fixed in code
- Using milestone re-verify for a one-line typo when uncommitted suffices (heavy but allowed if user asked)
- Open-language repair without R0-free Implementation alignment map
- Plan-doc-only fixes in code-repair (redirect to
@plan-repair) - Burying operator actions or questions in prose instead of the closing handoff block
Project layout (convention)
Repair consumes artifacts under .work/ and standards under .ai/. Path resolution: SKILL_DEPENDENCIES.md § Work tree path resolution.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

