Loading...
Loading...
On task completion, pair "what failed first" with "what finally worked" and codify the should-have-known-it insight as an ast-grep rule, skill, or CLAUDE.md rule. Use after trial-and-error solutions to spare future-you (or another agent) the same trap. Trigger phrases: "codify today's lessons," "make it a skill," "drop it into lint."
npx skill4agent add mizchi/skills retrospective-codifypnpmpackageManagerlockfile# skill duplicates (global)
ls ~/.claude/skills/
Grep "<key>" ~/.claude/skills/*/SKILL.md
# CLAUDE.md duplicates
Grep "<key>" ~/.claude/CLAUDE.md
Grep "<key>" <project-root>/CLAUDE.md # if there is a matching project
# lint rule duplicates
ls <project-root>/rules/
Grep "<key>" <project-root>/rules/[skill append][rule]digraph classify {
"Mechanically detectable?" [shape=diamond];
"Short instruction to apply every time?" [shape=diamond];
"Involves multi-step procedure or judgment?" [shape=diamond];
"ast-grep rule / lint" [shape=box];
"CLAUDE.md rule" [shape=box];
"skill" [shape=box];
"keep as note" [shape=box];
"Mechanically detectable?" -> "ast-grep rule / lint" [label="yes"];
"Mechanically detectable?" -> "Short instruction to apply every time?" [label="no"];
"Short instruction to apply every time?" -> "CLAUDE.md rule" [label="yes"];
"Short instruction to apply every time?" -> "Involves multi-step procedure or judgment?" [label="no"];
"Involves multi-step procedure or judgment?" -> "skill" [label="yes"];
"Involves multi-step procedure or judgment?" -> "keep as note" [label="no"];
}| Decision axis | Output destination | Example |
|---|---|---|
| Detectable at the code/config syntax level | | "Do not use |
| Short, always-applied, no judgment involved | | "Use pnpm v10 or later" |
| Requires procedure, contextual judgment, or templates | New skill or append to existing skill | "Steps to write a C binding for MoonBit" |
| Project-specific and one-off | Do not adopt (keep in commit message / PR description) | — |
ast-grep~/.claude/CLAUDE.mdCLAUDE.mdast-grep-practicerules/rule-tests/# <append to existing section>
- <one imperative sentence> (reason: <short rationale>)writing-skills---
name: <kebab-case>
description: Use when <specific situation> / <symptom>
---
# <Title>
## Purpose
## When to use
## Workflow
## PitfallsArray.from(set).lengthset.sizeSetMap.sizeArray.from(...).lengthrules/no-array-from-size.ymlid: no-array-from-size
language: TypeScript
severity: warning
rule:
pattern: Array.from($COLL).length
message: Set/Map のサイズは .size プロパティを使う。pnpm install~/.claude/CLAUDE.md- pnpm は v10 以上を使う(理由: lockfile 形式が v9 以前と非互換で CI 差分が出る)extern "c"moonbit.hnative-stublink.nativemoon.pkg.jsonmoonbit-c-binding| Rationalization that surfaces | Reality |
|---|---|
| "It is project-specific but let's make a skill just in case" | Skills bloat and searchability drops. A commit message / PR is enough. |
| "Skip approval and write it out first; I can show it later" | Modifying CLAUDE.md / skills on your own makes future behavior unpredictable. Always: propose -> approve -> write out. |
| "I kind of could write it in ast-grep, but writing it in natural language as a rule is faster" | Writing statically detectable things in prose means agents do not follow them. Prefer ast-grep. |
| "The insight is thin, but I have to write something to save face" | Zero proposals is also a correct answer. An empty retrospective causes no harm. |
| "Dedup checks are tedious; skip them, erase duplicates later" | If duplicate rules remain, behavior splits. Dedup is a mandatory step. |
| "Omit the failure side and only write the final solution" | Without describing the failure, your future self will fall into the same pitfall again. |
## Retrospective
### Lesson 1: <short label>
- First failure: <1 line>
- Final solution: <1 line>
- Insight: <1 line>
### Lesson 2: <short label> # omit this block if there is only 1 lesson
- First failure: <1 line>
- Final solution: <1 line>
- Insight: <1 line>
## Proposals
Adoption candidates:
- [lint] <rule name>: <1 line> (artifact: <path>, from lesson N)
- [skill append] <existing skill name>: <1 line> (from lesson N)
- [skill new] <skill name>: <1 line> (from lesson N)
- [rule] CLAUDE.md (global/project): <1 line> (from lesson N)
Duplicate detected (no proposal needed):
- <lesson N>: fully covered by <section name or line number> of existing <skill/rule name> -> no addition
Not adopted:
- <lesson N>: <one-line reason for non-adoption> (e.g. project-specific / hard to express in lint across files / absorbed by another lesson)
Please indicate which to adopt by number or item name. Zero proposals is also a valid conclusion.### Lesson NPlease indicate which to adoptNo adoption candidates. Please review for the record.## Retrospective
### Lesson 1: <label>
- First failure: ...
- Final solution: ...
- Insight: ...
## Proposals
Duplicate detected (no proposal needed):
- Lesson 1: fully covered by `<section name>` of existing skill `<skill name>` -> no addition
No adoption candidates. Please review for the record.## Proposals
Adoption candidates:
- [skill append] <existing skill name>: <1 line for the new portion> (from lesson 1, complements existing section `<section name>`)
Duplicate detected (no proposal needed):
- Lesson 1 (version value portion): already covered by the tools section in `~/.claude/CLAUDE.md` -> no append neededast-grepWhy:superpowers:writing-skillsast-grep-practiceupdate-config