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...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Napkin?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mnzralee-napkin)
---
name: napkin
description: 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.
metadata:
version: "1.0.0"
---
# 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.