Skip to content

Commit 66a1cb4

Browse files
phucbmclaude
andcommitted
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>
1 parent 9c7decd commit 66a1cb4

2 files changed

Lines changed: 36 additions & 19 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "claudify",
33
"displayName": "Claudify",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"description": "Bootstrap .claude/ structure for any existing repo",
66
"author": {
77
"name": "phucbm",

skills/init/SKILL.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ From what you read, determine:
2828
- **Build / test / lint / dev commands** — exact commands from manifest scripts only; do not guess
2929
- **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.
3030
- **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)
3233
- `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
3536
- `new` — a `.claude/` file that needs to be created from scratch
3637

3738
---
3839

3940
## Phase 3 — Propose the plan
4041

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.**
4243

4344
Format it exactly like this:
4445

@@ -51,40 +52,56 @@ Format it exactly like this:
5152
- AI features: yes / no
5253
5354
### 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. MERGE docs/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
6162
6263
### No changes needed
6364
- 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
6471
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)
6683
```
6784

6885
Rules for the action list:
6986
- Only list files that will actually change
7087
- 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
7289
- 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
7491

7592
---
7693

7794
## Phase 4 — Wait for confirmation
7895

79-
Do not proceed until the user explicitly says yes (or an equivalent). If they say no or ask to adjust the 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 plan and re-present it before doing anything.
8097

8198
---
8299

83100
## Phase 5 — Execute
84101

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.
86103

87-
**Content rules for generated files:**
104+
**Content rules for generated and rewritten files:**
88105
- No generic advice ("write clean code", "add comments", "follow best practices")
89106
- No placeholder text — every line must reflect actual facts discovered from this repo
90107
- 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
118135
## Phase 6 — Summary
119136

120137
After all writes are done, print:
121-
- What was created / moved / merged / deleted
138+
- What was created / rewritten / moved / merged / deleted
122139
- One next step for the user
123140

124141
> To keep your CLAUDE.md healthy over time:

0 commit comments

Comments
 (0)