agentleFS
ltruchotltruchot/claude-code-qol-mini/.claude/skills/kaizen/SKILL.md

kaizen

Skill0 starsChanged 13 days agoMITView on GitHub

Update TODO.md and todo/ with where this session stopped and what is left, clearing what is done, then review the session's friction and turn each real finding into one precise amendment to the project's rules file (AGENTS.md or CLAUDE.md), a skill, the docs, or a code comment. Use it before compacting, or after a session that taught you something. Also clears the /compact block set by the PreCompact hook.

  • Installs packages

24 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 7 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 21 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Leave the next session a place to resume, then turn what this session learned the hard way into instructions that outlive it.

    line 8
  2. Very specific:

    Before anything else, bring the handoff up to date at the session's primary working directory.

    line 19
  3. Very specific:

    Links: every → todo/… resolves to a file, and every file in todo/ has exactly one line pointing to it.

    line 68
  4. Distinctive:

    Do not look for something to propose.

    line 84
  5. Distinctive:

    Not evidence: that a rule did not come up this session, that it reads oddly, or that it would be shorter your way.

    line 142
  6. Very specific:

    Keep the CUT that frees the most, not the one easiest to argue.

    line 146
  7. Very specific:

    Never ~/.claude/CLAUDE.md.

    line 165
  8. Very specific:

    Before writing, grep the target for the parade you are about to add.

    line 180
  9. Distinctive:

    No date, no figure, no file name of the incident, no "how we knew".

    line 191
  10. Distinctive:

    After each accepted edit, re-read the section.

    line 280
  11. Distinctive:

    No rules file → propose creating AGENTS.md with those lines only.

    line 299
  12. Distinctive:

    When the review is done — including when it turned up nothing — run the release

    line 315

“Common” is measured: kept by at least 6 in 10 of the 21 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Kaizen

Leave the next session a place to resume, then turn what this session learned the hard way into instructions that outlive it.

You're the right reviewer because you still hold the context. Don't hand this to a subagent reading the transcript.

The project's rules file is AGENTS.md when the repo has one, CLAUDE.md otherwise. Wherever this skill says the project's CLAUDE.md, read that file.

0. Hand off in TODO.md — first, always

Before anything else, bring the handoff up to date at the session's primary working directory. No confirmation: this is state, not a rule. TODO.md missing → create it. todo/ is created by its first file, never empty.

The layout

TODO.md          the index: short, read in full after every compaction
todo/<slug>.md   the full context of one item, only when it needs one

TODO.md, in the language of the project's CLAUDE.md, two fixed headings:

# TODO

## Where we stopped
<the task in progress, the exact next action, branch, files, commands; what is
half done, what is verified and what is not>
Context: todo/<slug>.md

## Later
- <one line: the action and where> → todo/<slug>.md
- <one line that needs nothing more>
  • TODO.md stays under about 100 lines. It is what a session reads after a compaction; every line of it costs context there.
  • One line per item in Later. An item that needs more than three lines to be done cold — why, what was tried, constraints, commands, open questions — gets todo/<slug>.md, and its line ends with → todo/<slug>.md.
  • Where we stopped is rewritten on every run, ten to twenty lines. Nothing in progress → one line saying so. It links the todo/ file of the task in progress when there is one.
  • A todo/ file is written for someone with none of this session's context: paths, commands, names, the state reached. No story.
  • <slug>: lowercase, hyphens, what the item is (oauth-migration, not item-3).

The cleanup, on every run

  1. New: each thing we said we would do later becomes a line, with its todo/ file when it needs one.
  2. Done: an item finished in this session, or visibly finished in the repo (the commit, the code, the file is there), loses its line and its todo/ file. Not sure it is done → keep it and append (done? check <what>). Never drop an item for being old or untouched.
  3. Changed: an item whose plan moved gets its line and its todo/ file rewritten to the current state, not appended to.
  4. Links: every → todo/… resolves to a file, and every file in todo/ has exactly one line pointing to it. A file with no line: still live → add its line; done → delete it. A link to nothing: find the file it meant, or keep the line and drop the link.
  5. Other headings in an existing TODO.md: move their live content under the two headings, into todo/ files if long.

A TODO.md over the budget, or a case variant (todo.md, Todo.md), is not restructured here: update it in place, and propose the split or the rename in step 5.

Then tell the user, in one line each: items added, items removed as done (with the evidence), links fixed.

1. The bar

Do not look for something to propose. Zero findings is a complete answer, and the usual one. A false finding costs more than it saves: it gets re-read every session from here on, skimmed, misapplied, or quietly ignored, and it drags down the trust in everything around it.

An item is one of four verbs, and adding is the rarest:

VerbWhat it does
ADDa line that is not there and should be
CUTa line that costs context every session and changes nothing
MOVEa line that is loaded at the wrong moment: CLAUDE.md ↔ a skill ↔ a code comment ↔ the docs
REWORDa line that is read wrong, or read twice before it lands

At most three items per run. More than three and they stop being read. More pass the bar → keep the three with the highest cost and put the rest in TODO.md as one line.

ADD

A friction you hit yourself in this session, and all four hold:

  1. It came up naturally while you worked — navigating the code, running a command, using a tool — with the context you had, and it failed or misled you.
  2. You had to find a workaround, and you can point to both: what failed, what worked.
  3. You are sure the next session, with the same context, hits it again.
  4. The fix is a deterministic instruction: someone who follows it does something different from someone who doesn't.

Throw out on sight:

  • good practice that would be true in any repo
  • a one-off slip that the context already prevented
  • a preference, a style point, an idea for later (that goes to TODO.md)
  • anything the target file already implies
  • anything you can't state in three lines
  • a story with no directive in it. The incident is not the finding; the rule you deduce from it is. No rule, no finding.

CUT, MOVE, REWORD

You read this project's CLAUDE.md, its skills and its docs all session. Judge them. Every line of what is always loaded is paid for in every session from here on, so a line that earns nothing is a line to cut.

Propose a cut or a move only on what you actually read this session, and only with the evidence named:

SignalEvidence to show
it points at something gonethe command, flag, path or file it names does not exist — grep, ls or --help says so
it is said twicethe two places, quoted
it is history, not instructionthe line narrates what was, dates an incident, or counts attempts
it is advice, not a directivenobody does anything different for having read it
it is loaded at the wrong momentit only matters while doing one tool or workflow → a skill; it bit you outside that → CLAUDE.md
you misread ityou acted on it wrongly, or read it twice, in this session

Not evidence: that a rule did not come up this session, that it reads oddly, or that it would be shorter your way. A rule you did not need is a rule for another session.

Keep the CUT that frees the most, not the one easiest to argue.

Nothing passes → say "Nothing worth changing." and skip to step 5.

2. Pick the target, then read all of it

A CUT or a REWORD targets the file the line is already in. A MOVE names both ends. An ADD picks its target here:

TargetFor
this project's CLAUDE.md, its traps sectiona generic shell, git, container or CI trap: anything that bites regardless of what you were working on
this project's CLAUDE.md, another sectiona rule of this repo, or a dated decision by its owner
a skill of this project — name it and the sectiona trap or fact tied to one tool or workflow of a domain (test harness, editor, images, SEO, deployment): something you only need when doing that
the project's ops log, if it keeps onea fact about the environment or production
TODO.md (step 0) / a ticketwork to do, not a rule
README or docssomething a user of the project needs
a code commenta trap you can't see from where it bites

Never ~/.claude/CLAUDE.md. A lesson too general for one repo becomes a skill; it doesn't move up a level. And never a "traps" skill: a skill is loaded when a task needs a competence; a trap is what you didn't expect, so it must be in what is always loaded, or next to the tool it belongs to.

Open the file and read the whole thing. Then decide:

  • it already says this → drop the finding
  • it says something close, less sharply → rewrite that line; don't add one
  • it says the opposite → that's the finding: name the conflict and say which side should win
  • it has a section for this → put it there; don't open a new one
  • it says it three times → that's a finding too: keep one line, mark it important or mandatory, cut the others in the same edit

Before writing, grep the target for the parade you are about to add. The trap rarely comes back with the same words; search for the command, the flag, the error text.

3. Write it the way the file is written

  • Same language as the file. A French CLAUDE.md gets French.
  • Same vocabulary, same headings, same person, same tense.
  • Telegraphic. No metaphors, no story, no wind-up, no "note that".
  • Directive only: symptom → cause → parade, or when X, do Y — not Z. A table row when the section is a table.
  • No date, no figure, no file name of the incident, no "how we knew". The proof goes in the commit message of the amendment, never in the file: git keeps it, the file doesn't have to.
  • A CLAUDE.md, a code comment or a README states what is and what must be, never what was: no "an earlier version", "used to", "changed from X to Y". History belongs to git.
  • One to three lines. Longer means you haven't found the point yet.
  • Watch the net length. A project CLAUDE.md is loaded every session and stays under about 500 lines: an amendment that would cross that removes as much as it adds. If your line makes an older one redundant, cut the old one in the same edit.

4. One at a time, in a block you cannot skim past

One item, one block, then stop. Never two in one message: a wall of items gets three yeses and no reading.

---------------------------- KAIZEN 1/3 : ADD ----------------------------

TLDR: ADD one line to CLAUDE.md -- the environment is Arch Linux, so apt
      does not exist here.

COST: `apt install jq` failed; `pacman -S jq` worked. Nothing in CLAUDE.md
      names the distribution.

EDIT: CLAUDE.md, section "Environment", in the tools table:

        | Tool | Use |
        |---|---|
        | Python | `python3`, 3.11 |
      + | Packages | `pacman -S <pkg>`, never `apt`: Arch Linux |
        | Tests | `./test.sh` |

TRIGGER: anyone about to install a tool reads it before typing apt.

--------------------------------------------------------------------------

Yes or no?

A CUT shows the same thing the other way round, every removed line in full:

---------------------------- KAIZEN 2/3 : CUT ----------------------------

TLDR: CUT three lines from CLAUDE.md -- they describe `legacy-build.sh`,
      which the repo no longer contains.

COST: `ls` and `grep -r legacy-build` find nothing; the section sends a
      reader after a file that is gone.

EDIT: CLAUDE.md, section "Build", the whole subsection:

      - ### Legacy build
      -
      - `legacy-build.sh` predates the Makefile. Run it only to reproduce a
      - release older than 2.0, and never on a dirty tree.

TRIGGER: nothing to trigger -- 4 lines no session has to read again.

--------------------------------------------------------------------------

Yes or no?
  • The banner carries the number, the total and the verb: KAIZEN 2/3 : CUT. The total counts every item you will show, step 5 included.
  • TLDR is one sentence, two lines at most, and it starts with the verb and the file. Someone who reads only this line knows what they are agreeing to.
  • COST for an ADD: what happened here. For a CUT, MOVE or REWORD: the evidence from the table in step 1.
  • EDIT is the diff, never a description of one. It names the file and the section, then shows the lines as they will read: + for what is added, - for what goes, a couple of unchanged lines around them for the place, two spaces of indent so the markers line up. Never an ellipsis, never "and so on": if the text is too long to show in full, the amendment is too long.
    • ADD: the new text in full, in the target's language and style.
    • CUT: every removed line, verbatim.
    • REWORD: both versions, - then +.
    • MOVE: two diffs under one EDIT, the source file then the destination, with the text unchanged between them unless the item also rewords it.
  • TRIGGER: the moment someone reads it and acts on it. For a CUT, the lines saved.
  • Rules on top of the block: keep the four labels and nothing else, no preamble before it, no commentary after it. Rulers are plain ASCII dashes.

Then stop and wait. Write only what the user accepts.

After each accepted edit, re-read the section. It has to read in one voice, with nothing saying twice what another line already says once.

Once the last item is settled, read the whole file again. If the edits left it repetitive or self-contradictory, that is one more item — same block, same protocol.

5. Check the handoff wiring

Same block as step 4, one at a time, counted in the same total.

  • The project's CLAUDE.md opens with the handoff line. Missing, buried below, or worded otherwise → propose this at the top, in the file's language:

    > Session handoff: read `TODO.md` first — where the last session stopped, and what is left.
    > Open a `todo/` file only for the item you work on. An item done → delete its line and its `todo/` file.

    No rules file → propose creating AGENTS.md with those lines only. Never a CLAUDE.md beside an AGENTS.md: Claude Code then skips AGENTS.md.

  • TODO.md over about 100 lines → propose the split: which items move to which todo/<slug>.md, and the resulting index. Show the plan, not the files.
  • TODO.md under another case (todo.md, Todo.md) → propose the rename (git mv when tracked) and fix every reference to it.
  • A file doing TODO.md's job under another name — SESSION_STATE*, session-state*, HANDOFF*, NEXT* — at the root, in docs/ or in .claude/ → propose, per file: merge its live content into TODO.md and todo/, remove it (git rm when tracked), and fix every reference to it (grep the repo for its name).

Stay inside the working directory. Never ~/.claude/CLAUDE.md.

6. Clear the block

When the review is done — including when it turned up nothing — run the release from the session's primary working directory. The token is keyed by the directory, and the shell keeps whatever one an earlier call left it in, so releasing from the wrong place arms another project and the block comes back here:

cd <primary working directory> \
  && npx qol-mini@0.8.0 kaizen release

It prints the token it wrote, and the name carries the directory. Read that line before telling the user /compact will go through now. The token is spent as it's honored, so the next compaction gets reviewed too.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.