You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add REWRITE action type with before/after diff (v1.2.0)
- New REWRITE classification for existing files that are bloated or
poorly structured (e.g. a 400-line CLAUDE.md that needs trimming)
- Phase 3 now shows full before/after content for every REWRITE action
so the user can review exact changes before confirming
- Covers all 5 example use cases including "existing .claude/ but poor quality"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: skills/init/SKILL.md
+35-18Lines changed: 35 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,17 +28,18 @@ From what you read, determine:
28
28
-**Build / test / lint / dev commands** — exact commands from manifest scripts only; do not guess
29
29
-**AI / LLM / agent features** — scan imports and dependencies for: `openai`, `anthropic`, `langchain`, `llama`, `ollama`, `transformers`, `langfuse`, `llamaindex`, vector store clients (pinecone, weaviate, chroma). Set `has_ai = true` if found.
30
30
-**Existing markdown inventory** — for every `.md` file found, classify it:
31
-
-`keep-as-is` — already in the right place, content is good
31
+
-`keep-as-is` — already in the right place and well-structured, no changes needed
32
+
-`rewrite` — right location but content is bloated, outdated, or poorly structured (e.g. a 400-line CLAUDE.md)
32
33
-`move` — useful content but in the wrong location (e.g. `ARCHITECTURE.md` at root → `.claude/docs/architecture.md`)
33
-
-`merge` — content should be folded into a `.claude/` file
34
-
-`redundant` — generic, empty, or duplicated content that adds no value
34
+
-`merge` — content should be folded into a `.claude/` file, original deleted
35
+
-`redundant` — generic, empty, or fully duplicated content that adds no value
35
36
-`new` — a `.claude/` file that needs to be created from scratch
36
37
37
38
---
38
39
39
40
## Phase 3 — Propose the plan
40
41
41
-
Present a clear, numbered action plan. Do not write any files yet.
42
+
Present a clear, numbered action plan. **Do not write any files yet.**
42
43
43
44
Format it exactly like this:
44
45
@@ -51,40 +52,56 @@ Format it exactly like this:
51
52
- AI features: yes / no
52
53
53
54
### Actions
54
-
1. CREATE .claude/CLAUDE.md — entry point with commands and rules
55
-
2. CREATE .claude/docs/architecture.md — stack, structure, data flow
56
-
3. CREATE .claude/docs/agents.md — AI layer (only if has_ai = true)
57
-
4. MOVE ARCHITECTURE.md → content merged into .claude/docs/architecture.md, original deleted
58
-
5. MERGEdocs/dev-notes.md → relevant facts folded into .claude/docs/architecture.md
59
-
6. DELETE .claude/random-notes.md — redundant, no actionable content
60
-
...
55
+
1. CREATE .claude/CLAUDE.md — entry point with commands and rules
56
+
2. CREATE .claude/docs/architecture.md — stack, structure, data flow
57
+
3. CREATE .claude/docs/agents.md — AI layer (only if has_ai = true)
58
+
4. REWRITE .claude/CLAUDE.md — currently 400 lines; will be reduced to ≤80 with @imports
59
+
5. MOVE ARCHITECTURE.md → .claude/docs/architecture.md, original deleted
60
+
6. MERGE docs/dev-notes.md → relevant facts folded into .claude/docs/architecture.md, original deleted
61
+
7. DELETE .claude/random-notes.md — redundant, no actionable content
61
62
62
63
### No changes needed
63
64
- README.md — not a Claude config file, left untouched
65
+
```
66
+
67
+
For every **REWRITE** action, immediately follow it with a fenced before/after diff so the user can see exactly what changes:
68
+
69
+
```
70
+
#### REWRITE .claude/CLAUDE.md
64
71
65
-
Proceed? (yes / no)
72
+
**Before** (summarised — 400 lines):
73
+
> Copy-pasted README, generic advice, outdated npm commands, no structure
74
+
75
+
**After** (proposed — ~35 lines):
76
+
[Show the full proposed file content here, verbatim]
77
+
```
78
+
79
+
After all actions and diffs, always end with:
80
+
81
+
```
82
+
Proceed? (yes / no — or tell me what to adjust)
66
83
```
67
84
68
85
Rules for the action list:
69
86
- Only list files that will actually change
70
87
- Include a one-line reason for every action
71
-
- Group by type: CREATE first, then MOVE/MERGE, then DELETE
88
+
- Group by type: CREATE first, then REWRITE, then MOVE/MERGE, then DELETE
72
89
- Files outside `.claude/` that are not markdown config (source code, assets, etc.) are never touched
73
-
- Always end with "Proceed? (yes / no)" and stop
90
+
- Always end with the confirmation prompt and stop
74
91
75
92
---
76
93
77
94
## Phase 4 — Wait for confirmation
78
95
79
-
Do not proceed until the user explicitly says yes (or an equivalent). If they say no or ask to adjustthe plan, revise and re-present before doing anything.
96
+
Do not proceed until the user explicitly says yes (or equivalent). If they say no or ask to adjust, revise the planand re-present it before doing anything.
80
97
81
98
---
82
99
83
100
## Phase 5 — Execute
84
101
85
-
Execute exactly the approved plan, in this order: CREATE → MOVE/MERGE → DELETE.
102
+
Execute exactly the approved plan, in this order: CREATE → REWRITE → MOVE/MERGE → DELETE.
86
103
87
-
**Content rules for generated files:**
104
+
**Content rules for generated and rewritten files:**
88
105
- No generic advice ("write clean code", "add comments", "follow best practices")
89
106
- No placeholder text — every line must reflect actual facts discovered from this repo
90
107
- Apply the test to every rule in CLAUDE.md: "Would removing this line cause Claude to make a mistake on this codebase? If not, cut it."
@@ -118,7 +135,7 @@ Execute exactly the approved plan, in this order: CREATE → MOVE/MERGE → DELE
118
135
## Phase 6 — Summary
119
136
120
137
After all writes are done, print:
121
-
- What was created / moved / merged / deleted
138
+
- What was created / rewritten / moved / merged / deleted
0 commit comments