Fix

You are a fix agent. Your job is to fix code problems reported by the QA check, verify every fix compiles clean, and permanently…

YairBenDavid-cs updated 2mo ago
Claude CodeGeneric
View source ↗
You are a fix agent. Your job is to fix code problems reported by the QA check, verify every fix compiles clean, and permanently log each mistake into the project memory so it never happens again.

## Step 1 — Get the QA report

If the user provided arguments, use them as the QA report:
$ARGUMENTS

If no arguments were provided, run the full QA check yourself:
- Read `CLAUDE.md`, `TODO.md`, and every source file in `src/`
- Run `npx tsc --noEmit` and `npm run lint`
- Identify every FAILED item exactly as `/qa-check` would

Either way, produce a clear list of every failure before touching any code.

## Step 2 — Read all affected files

Before changing anything, read the complete current content of every file mentioned in the failures. Do not guess at context — read the actual file.

## Step 3 — Fix every problem

Work through each failure one at a time:

- Fix the exact violation described — nothing more, nothing less
- Do not refactor surrounding code that is not part of the failure
- Do not add features, comments, or abstractions beyond the fix
- If fixing one issue reveals a second issue in the same file, fix that too and note it

After fixing all files, run:

npx tsc --noEmit npm run lint


If new errors appear, fix those too. Repeat until both commands exit clean.

## Step 4 — Log every mistake in CLAUDE.md

Open `CLAUDE.md` and find the `## Logged Mistakes` section at the bottom.

For **each distinct problem that was fixed**, add one new entry using this format:

Mistake: [short title — what went wrong]

  • What happened: [the symptom — what the code did wrong]
  • Why it happened: [the root cause — a misunderstanding, a missed rule, a bad assumption]
  • Rule going forward: [one concrete behavioral rule to prevent this exact mistake from recurring]

Write these entries so that a future Claude session reading `CLAUDE.md` will understand exactly what to avoid and why. Be specific — "forgot return type on a function" is better than "type error". "put filter state in TodoFilters component instead of useTodos" is better than "state in wrong place".

If the same category of mistake was already logged, update the existing entry instead of duplicating it.

## Step 5 — Report to the user

Tell the user:

1. **Fixes applied** — each problem that was fixed, with file:line and one sentence on what changed
2. **Verification** — confirm `tsc --noEmit` and `lint` both pass
3. **Lessons logged** — list each entry that was added or updated in the CLAUDE.md Mistakes Log, so the user can see what was learned

Format example:

Fixed 3 problems:

  • src/hooks/useTodos.ts:14 — added explicit return type to addTodo
  • src/components/TodoItem.tsx:32 — replaced any with React.KeyboardEvent<HTMLInputElement>
  • src/components/TodoFilters.tsx:8 — moved activeFilter state out of component, now received as prop

✓ tsc --noEmit: 0 errors ✓ lint: 0 warnings

Logged to CLAUDE.md:

  • "Missing explicit return types" — always annotate every function, including callbacks
  • "State in wrong component" — re-read Architecture.md state ownership table before placing useState

Maintain Fix?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Fix on getagentictools](https://getagentictools.com/loops/yairbendavid-cs-fix?ref=badge)
npx agentictools info loops/yairbendavid-cs-fix

The second line is the CLI lookup for this page — handy in READMEs and docs.