docs-reflect
Skill13 starsChanged 8 months agoMITView on GitHub
Collect DOC: notes from session, generalize, and propose repo documentation (.claude/rules/, docs/).
In this repository10 other files it gives its agents.
- memory-setupSkill
- memorySkill
- parkSkill
- reflectSkill
- session-continueSkill
- session-endSkill
- session-insightsSkill
- session-restoreSkill
- session-startSkill
- task-templateSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
If both sources are empty — tell user "No documentation findings." and stop.
- Distinctive: line 36
If recurring patterns found (3+ occurrences) — these are project conventions, not personal preferences.
- Distinctive: line 60
If a note can't be generalized — skip it.
- Distinctive: line 74
Check memory for saved preference:
- Very specific: line 81
If no saved preference and no .claude/rules/ directory — ask:
- Distinctive: line 112
If a matching file exists — add to it.
- Distinctive: line 136
Wait for user confirmation.
- Distinctive: line 144
Read target file (or create with header)
- Distinctive: line 145
Add rule to appropriate section
- Distinctive: line 163
Deduplicate: Read existing docs before adding.
- Distinctive: line 164
User confirms first: Never write without showing what will be added.
- Distinctive: line 165
Respect existing structure: Add to existing files/sections.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/docs-reflect — Session knowledge → repo documentation
Collect DOC: notes accumulated during the session, generalize them into rules, and propose documentation for the repository.
Step 1: Collect findings
Two sources: DOC: notes from the current session, and recurring feedback from memory.
1a: DOC: notes
node "$MEM" --dir="$MEM_DIR" docs1b: Recurring feedback patterns
node "$MEM" --dir="$MEM_DIR" recurringThis scans feedback/ files for clusters — similar corrections that appeared 2+ times across sessions. Recurring patterns are strong candidates for promotion to .claude/rules/.
Combine
If both sources are empty — tell user "No documentation findings." and stop.
If recurring patterns found (3+ occurrences) — these are project conventions, not personal preferences. Treat them as DOC automatically:
- Save as DOC note:
node "$MEM" --dir="$MEM_DIR" note "DOC: <domain> — <generalized rule from recurring feedback>" - Highlight to user: "This feedback appeared N times — promoting to project rule."
Patterns with 2 occurrences — mention as candidates but don't auto-promote.
Step 2: Generalize
For each DOC: note, extract a generalized rule.
Bad (too specific):
"The PaymentService bug was on line 42 in processRefund()"
Good (pattern):
"Refund operations must check transaction state before mutating — stale state causes double-refunds"
Bad (class-level):
"UserService.getProfile() returns null when user is not found"
Good (convention):
"Services return null for missing entities instead of throwing — callers must handle null"
If a note can't be generalized — skip it.
Step 3: Detect documentation structure and route
3a: Detect existing structure
ls .claude/rules/ 2>/dev/null
cat CLAUDE.md 2>/dev/null | head -50
ls docs/ 2>/dev/nullCheck memory for saved preference:
node "$MEM" --dir="$MEM_DIR" search "docs_target"3b: Choose target
If no saved preference and no .claude/rules/ directory — ask:
Where should project rules go?
1. .claude/rules/ (Claude Code loads these per-directory)
2. docs/
3. CLAUDE.md (single file, always loaded — use sparingly)
4. Other — specify path
Choice? (default: 1)Save preference:
node "$MEM" --dir="$MEM_DIR" note "CONFIG: docs_target=<chosen path>"3c: Route by domain
Route using the chosen target directory (default: .claude/rules/):
| Domain | Target |
| testing | <target>/testing.md |
| api | <target>/api.md |
| architecture | <target>/architecture.md |
| state | <target>/state.md |
| workflow | <target>/workflow.md |
| Other domain | <target>/<domain>.md |
| Truly universal (rare) | CLAUDE.md |
If a matching file exists — add to it. If not — create one.
Step 4: Propose changes
## Docs-reflect: <date>
Found N DOC: notes, grouped into M domains:
### <target>/testing.md
- <rule 1>
- <rule 2>
### <target>/api.md
- <rule 3>
### Skipped
- <notes too specific to generalize>
Apply? (all / pick numbers / skip)Wait for user confirmation.
Step 5: Apply
For each approved rule:
- Read target file (or create with header)
- Add rule to appropriate section
- Format:
For rule files (.claude/rules/, docs/, or custom target):
## <Section>
- <Rule>Rules
- Generalize or skip. Can't state it as a reusable rule → don't add it.
- No class/method API docs. Those belong in code comments.
- No ticket/branch references. Docs should not mention specific tasks.
- Right file matters. The main value is routing to the correct
.claude/rules/file. - Deduplicate. Read existing docs before adding.
- User confirms first. Never write without showing what will be added.
- Respect existing structure. Add to existing files/sections. Don't reorganize.
- Less is more. 2 good rules is a great outcome. 0 is fine too.
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
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.

