agentleFS
mnzraleemnzralee/claude-multi-agent-architecture/.claude/skills/napkin/SKILL.md

napkin

Skill9 starsChanged 2 months agoMITView on GitHub

Error learning loop. Keeps a mistakes.log at the repo root, one line per mistake with its root cause and a prevention rule. Reads it before writing code and names the entries it is avoiding; appends a new entry the moment a test fails because of Claude's change, the user corrects Claude, a review finds a defect, or a command fails on a wrong assumption. Use when the user says "napkin", "log this mistake", "don't do that again" or "you did this before", before writing code in any repo that has mistakes.log, and right after any self-caused error. Composes with ponytail and claude-mem.

8 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

6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read before code: Before writing or editing code, grep mistakes.log for the files, modules, libraries and kinds of change you are about to …

    line 20
  2. Very specific:

    One line per entry, append-only: Never edit or delete a past entry.

    line 24
  3. Distinctive:

    Next id: read the last entry's id and add one.

    line 68
  4. Very specific:

    Before code, when entries match: one line, Avoiding M-NNN (<rule, short>), M-NNN (<rule, short>).

    line 74
  5. Very specific:

    After logging: one line, Logged M-NNN: <rule>.

    line 75
  6. Distinctive:

    With ponytail: run the napkin check first.

    line 82

“Common” is measured: kept by at least 6 in 10 of the 7 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

Napkin: the error learning loop

You are an engineer who keeps a napkin in their pocket, writes down every mistake the moment it happens, and reads the napkin before starting anything new. You are not embarrassed by mistakes. You are embarrassed by repeating one.

Input: $ARGUMENTS

The problem this fixes

Claude makes the same mistake in session 9 that it made, and was corrected for, in session 2: the wrong import path, a test-runner flag that does not exist, the API that returns cents rather than dollars. The correction lived in a chat that is gone. Napkin turns each correction into a durable, greppable rule that is checked before the next attempt.

Rules

  1. Read before code. Before writing or editing code, grep mistakes.log for the files, modules, libraries and kinds of change you are about to touch. Name the matching entries in one line before the code. No match means say nothing.
  2. Log at the moment of error, not at the end. Append an entry as soon as one of these happens: a test or build fails because of your change; the user corrects you; a review (human or agent) finds a defect you introduced; a command fails because you assumed a path, flag, name or config. Fix first if it is quick, then log, in the same turn.
  3. Root cause, not symptom. "Test failed" is a symptom. "Assumed amount was dollars; the API returns integer cents" is a cause. If you cannot name the cause, debugging is not finished.
  4. Every entry ends in a rule. The rule is an instruction a future session can follow without any context: imperative, specific, checkable. "Be careful with money" is not a rule. "Convert API amounts with toMoney(); never divide by 100 inline" is.
  5. One line per entry, append-only. Never edit or delete a past entry. If a rule turns out wrong, append a new entry that supersedes it (supersedes M-007).
  6. Promote on the third strike. When the same rule is hit three times, propose promoting it to the project's permanent rules (the gotchas section of CLAUDE.md, or a .claude/rules/ file) and mark the entry promoted. The log is the inbox; the rules are the law.
  7. Codebase facts only. Log mistakes about this project's code, tools and conventions. Preferences about how the user likes to work belong in Claude's own memory, not here. Never log secrets or personal data.

Format

M-001 | 2026-11-28 | billing/invoice.ts | Divided the API amount by 100 inline, double-converting it | Amounts arrive as integer cents and toMoney() already converts | Use toMoney(); never divide amounts inline

Fields, separated by |: id (increasing, never reused), date, area (file, module or tool), what went wrong, root cause, rule. Append | promoted or | supersedes M-NNN when it applies.

The first time, create the file with a one-line header:

# mistakes.log | id | date | area | mistake | root cause | rule | append-only, see the napkin skill

Examples

Example 1: a weak entry and a strong one

Bad: M-004 | 2026-11-20 | tests | Tests broke | Oops | Be more careful

Good: M-004 | 2026-11-20 | vitest | Ran "npx vitest --watch=false", which this repo's vitest 0.34 rejects | Assumed the v1 CLI flag | Use "npx vitest run" for one-shot runs

Example 2: reading the napkin before code

Task: add a refund endpoint in billing/.

Bad: write the endpoint straight away, and divide the refund amount by 100 inline again.

Good: grep -n -i "billing\|amount\|refund" mistakes.log returns M-001 and M-012, so the output opens with Avoiding M-001 (use toMoney(), no inline /100) and M-012 (refunds need the idempotency key header). Then the code.

Example 3: the user corrects you

User: "No, we don't use axios here, it's the fetch wrapper in lib/http.ts."

Good: fix the code to use lib/http.ts, then append M-015 | 2026-11-28 | lib/http.ts | Imported axios for a new client call | Did not check for an existing HTTP wrapper | Use lib/http.ts for all HTTP; grep for an existing wrapper before importing a client, and say in one line that it was logged.

Tool usage

  • Before code: grep -n -i "<file>\|<module>\|<library>" mistakes.log. Read the whole file only when it is under 100 lines.
  • Logging: append to the end of the file in a single write (an Edit anchored on the last line, or >>). Never rewrite the file.
  • Next id: read the last entry's id and add one.
  • Promotion: count strikes with grep -c "<rule keyword>" mistakes.log. Propose the promotion to the user; never edit CLAUDE.md or rule files silently.
  • Size: once the log passes 200 lines, propose a consolidation: promote recurring rules, and move entries older than the latest promotion into mistakes.archive.log. Never delete.

Output format

  • Before code, when entries match: one line, Avoiding M-NNN (<rule, short>), M-NNN (<rule, short>).
  • After logging: one line, Logged M-NNN: <rule>.
  • On a third strike: one line, M-NNN has hit 3 times. Promote "<rule>" to CLAUDE.md?

Nothing else. Napkin should cost a line of output, not a paragraph.

Composition

  • With ponytail: run the napkin check first; a logged rule beats a shorter solution.
  • With claude-mem: PROJECT_CONTEXT.md links to mistakes.log in its See also section and never copies entries.
  • With the kit's systematic-debugging skill: debugging finds the root cause; napkin makes the lesson permanent.
  • With the Operating Standard: a logged mistake is an honest finding; never leave one out to make a report look tidy.

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.