mema-kit 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,23 +63,28 @@ Update `.mema/index.md` to reflect all changes made in Phase 3. This is **mandat
63
63
 
64
64
  ## Per-File-Type Curation Rules
65
65
 
66
- ### decision.mdConservative curation
66
+ ### product/ files Discovery phase outputs (seed, clarify, research, challenge, roadmap)
67
+ - **Overwrite on re-run.** Each file represents the current state of understanding. Re-running a discovery skill replaces stale content with fresh analysis.
68
+ - **NOOP** if the file is recent and the idea hasn't changed.
69
+ - `roadmap.md` is special: UPDATE to add new features, but never delete existing feature entries — features with directories already created should be marked, not removed.
70
+
71
+ ### features/NNN-name/ files — Feature lifecycle files (spec, plan, tasks, status)
72
+ - `spec.md` — **UPDATE** when requirements change; never delete a spec that has a corresponding plan.
73
+ - `plan.md` — **Replace curation**: keep final version only; overwrite on re-run.
74
+ - `tasks.md` — **Replace curation**: regenerate when plan changes; warn if tasks are partially complete.
75
+ - `status.md` — **UPDATE** continuously during implementation; never delete.
76
+
77
+ ### project/decisions/ — Conservative curation
67
78
  - **Rarely delete.** Decisions are historical record. Even reversed decisions teach future sessions why something didn't work.
68
79
  - **UPDATE** when the decision is refined, expanded, or its status changes.
69
80
  - **ADD** reasoning if the original entry lacks a "why."
70
81
  - Only **DELETE** if the decision was recorded in error (wrong project, duplicate entry).
71
82
 
72
- ### context.md — Aggressive curation
73
- - **Prune dead-end explorations.** If you explored 5 options and chose 1, delete the notes on the 4 rejected options. The decision file captures what was chosen and why.
74
- - **Consolidate findings.** If multiple explorations cover overlapping ground, merge them into one concise context file.
75
- - **DELETE** when a decision supersedes the exploration entirely (the exploration's value is now captured in the decision).
83
+ ### project/architecture.md and project/requirements.md Replace curation
84
+ - **UPDATE** when the stack or requirements change.
85
+ - Keep current state only these are reference documents, not history logs.
76
86
 
77
- ### plan.md — Replace curation
78
- - **Keep the final version only.** Draft plans are noise once a final plan exists.
79
- - **UPDATE** during implementation — mark steps as complete, note adjustments.
80
- - **Do not create multiple plan versions.** Overwrite the plan when it changes.
81
-
82
- ### lessons.md and patterns.md — Consolidation curation
87
+ ### agent/lessons.md and agent/patterns.md Consolidation curation
83
88
  - **Merge similar lessons.** "Drizzle needs type casting" and "Drizzle enum handling requires explicit cast" are the same lesson — keep one entry with both examples.
84
89
  - **UPDATE** with new examples when the same pattern/lesson recurs.
85
90
  - **DELETE** if a lesson is proven wrong by later experience.
@@ -107,22 +112,24 @@ The index is a structured pointer map with four sections:
107
112
  ```
108
113
  # Memory Index
109
114
 
110
- **Updated:** 2026-02-23
115
+ **Updated:** 2026-02-27
111
116
 
112
- ## Active Tasks
113
- - `task-memory/api-setup/` — Setting up REST API with Fastify (plan ready, implementing)
117
+ ## Active Features
118
+ - `features/001-user-auth/` — JWT authentication for API (in-progress, step 2/5)
119
+ - `features/002-search/` — Full-text search across posts (pending)
114
120
 
115
- ## Project Knowledge
116
- - `project-memory/architecture.md` — Node.js + Fastify + PostgreSQL + Drizzle stack
117
- - `project-memory/requirements.md` — Core requirements and constraints
121
+ ## Product Discovery
122
+ - `product/seed.md` — Async standup tool for remote teams
123
+ - `product/roadmap.md` — 6 features defined, 1 in progress
118
124
 
119
- ## Recent Decisions
120
- - `project-memory/decisions/2026-02-23-tech-stack.md` — Chose Fastify + PostgreSQL + Drizzle
121
- - `project-memory/decisions/2026-02-23-auth-jwt.md` — JWT with refresh tokens for auth
125
+ ## Project Knowledge
126
+ - `project/architecture.md` — Node.js + Fastify + PostgreSQL + Drizzle stack
127
+ - `project/requirements.md` — Core requirements and constraints
128
+ - `project/decisions/2026-02-27-auth-jwt.md` — JWT with refresh tokens for auth
122
129
 
123
- ## Agent Lessons
124
- - `agent-memory/lessons.md` — 3 lessons recorded (Drizzle type casting, Fastify plugin order, test isolation)
125
- - `agent-memory/patterns.md` — 2 patterns recorded (route registration, error handling middleware)
130
+ ## Agent Knowledge
131
+ - `agent/lessons.md` — 4 lessons recorded
132
+ - `agent/patterns.md` — 3 patterns recorded
126
133
  ```
127
134
 
128
135
  Each entry is: `- \`file-path\` — one-line summary`
@@ -137,8 +144,8 @@ After every curated save:
137
144
 
138
145
  ### Rebuild Procedure (fallback)
139
146
  If `index.md` is missing, empty, or clearly stale (references files that don't exist):
140
- 1. List all directories in `.mema/`: `project-memory/`, `task-memory/`, `agent-memory/`, `archive/`
141
- 2. For each directory, list all `.md` files (excluding `_templates/`)
147
+ 1. List all directories in `.mema/`: `product/`, `features/`, `project/`, `agent/`, `archive/`
148
+ 2. For each directory, list all `.md` files
142
149
  3. Read the first 3 lines of each file to get title and metadata
143
150
  4. Generate index entries in the format above
144
151
  5. Write the rebuilt `index.md`
@@ -0,0 +1,121 @@
1
+ ---
2
+ description: Stress-test your idea by challenging assumptions, identifying risks, and surfacing blind spots. Saves a risk register and recommendations to product/challenge.md.
3
+ ---
4
+
5
+ # /mema.challenge — Idea Stress-Test
6
+
7
+ You are executing the /mema.challenge skill. Follow these steps carefully.
8
+
9
+ This skill plays devil's advocate — it examines the idea critically to find what could go wrong before any code is written. A challenge that kills a weak idea is a success.
10
+
11
+ ## AUTO-LOAD
12
+
13
+ 1. Read `.mema/index.md`
14
+ 2. Read all available `product/` files:
15
+ - `product/seed.md` — the raw idea
16
+ - `product/clarify.md` — refined intent (if exists)
17
+ - `product/research.md` — competitive and market findings (if exists)
18
+ 3. Build a full picture of the idea before proceeding
19
+
20
+ ## WORK
21
+
22
+ ### Identify Assumptions
23
+
24
+ List every assumption the idea depends on. For each:
25
+ - **Validated**: supported by research or clear logic
26
+ - **Risky**: not yet validated; failure would significantly harm the project
27
+
28
+ Look for assumptions about: user behavior, market size, technical feasibility, competitive differentiation, and the team's ability to execute.
29
+
30
+ ### Build Risk Register
31
+
32
+ For each significant risk:
33
+ - **What's the risk?** — specific failure mode, not vague concern
34
+ - **Severity**: High (project-threatening), Medium (costly), Low (manageable)
35
+ - **Likelihood**: High (likely without mitigation), Medium (possible), Low (unlikely)
36
+ - **Mitigation**: concrete action that reduces severity or likelihood
37
+
38
+ ### Identify Blind Spots
39
+
40
+ What hasn't been considered?
41
+ - Regulatory, legal, or privacy constraints?
42
+ - Distribution and discovery — how will users find this?
43
+ - Monetization — if relevant, is there a clear path?
44
+ - What does the competition do better than this idea, not worse?
45
+ - What's the failure mode if the key assumption is wrong?
46
+
47
+ ### Critical Risks
48
+
49
+ If any risks are both High severity AND High likelihood:
50
+ - Flag them explicitly
51
+ - Suggest a pivot or alternative approach if possible
52
+ - Do NOT hide critical problems — they're more valuable than false confidence
53
+
54
+ ### Handle Re-run
55
+
56
+ If `challenge.md` already exists, show the previous summary and ask:
57
+
58
+ "Previous challenge from [date]. Run fresh challenge, or update specific sections?"
59
+
60
+ ### Save
61
+
62
+ Write `.mema/product/challenge.md`:
63
+
64
+ ```
65
+ # [Project Name] — Challenge
66
+
67
+ **Status:** active | **Updated:** [today's date]
68
+
69
+ ## Assumptions
70
+
71
+ | Assumption | Status | Risk if Wrong |
72
+ |------------|--------|---------------|
73
+ | [Assumption] | ✓ Validated / ⚠ Risky | [Impact] |
74
+
75
+ ## Risk Register
76
+
77
+ | Risk | Severity | Likelihood | Mitigation |
78
+ |------|----------|------------|------------|
79
+ | [Risk] | High/Med/Low | High/Med/Low | [Action] |
80
+
81
+ ## Blind Spots
82
+
83
+ - [What hasn't been considered]
84
+
85
+ ## Critical Concerns
86
+
87
+ [If any High/High risks: flag them clearly with recommended action]
88
+ [If no critical risks: "No critical risks identified. Proceed with caution on the risky assumptions above."]
89
+
90
+ ## Recommended Actions Before Building
91
+
92
+ - [Validate assumption X by doing Y]
93
+ - [Resolve risk Z before committing to approach]
94
+ ```
95
+
96
+ ### Guide Next Step
97
+
98
+ ```
99
+ Next: Run /mema.roadmap to synthesize everything into a project plan and feature list.
100
+ ```
101
+
102
+ Or, if critical concerns were found:
103
+
104
+ ```
105
+ ⚠ Critical concerns found. Consider addressing them before building:
106
+ [List critical risks]
107
+
108
+ You can re-run /mema.clarify or /mema.research to address these, then re-run /mema.challenge.
109
+ Or proceed to /mema.roadmap if you've decided to accept these risks.
110
+ ```
111
+
112
+ ## AUTO-SAVE & CURATE
113
+
114
+ - ADD or UPDATE `product/challenge.md`
115
+ - NOOP on all other memory files
116
+
117
+ ## AUTO-INDEX
118
+
119
+ Update `.mema/index.md`:
120
+ 1. Add or update entry under `## Product Discovery`: `- \`product/challenge.md\` — [N] risks identified; [critical/no critical] concerns`
121
+ 2. Update `**Updated:**` date
@@ -0,0 +1,109 @@
1
+ ---
2
+ description: Refine a raw idea through targeted Q&A and save a structured summary of the clarified intent, audience, and scope.
3
+ ---
4
+
5
+ # /mema.clarify — Idea Clarification
6
+
7
+ You are executing the /mema.clarify skill. Follow these steps carefully.
8
+
9
+ This skill turns a raw seed into a clear, structured problem statement through 2-3 rounds of targeted questions.
10
+
11
+ ## AUTO-LOAD
12
+
13
+ 1. Read `.mema/index.md`
14
+ 2. Read `.mema/product/seed.md`
15
+ 3. If `seed.md` is missing:
16
+ - Tell the user: "No seed found. Run `/mema.seed` first, or describe your idea now and I'll treat it as the seed."
17
+ - If the user provides an inline description, use it as the seed (save it to `product/seed.md` first)
18
+ 4. If `product/clarify.md` exists, read it to understand what was already clarified
19
+
20
+ ## WORK
21
+
22
+ ### Mirror Understanding
23
+
24
+ Before asking questions, confirm your understanding of the idea:
25
+
26
+ ```
27
+ Here's what I understand from your seed:
28
+
29
+ [2-3 sentence summary of the idea]
30
+
31
+ Is this roughly right? (Say yes to proceed, or correct anything)
32
+ ```
33
+
34
+ If the user corrects something significant, update your understanding before continuing.
35
+
36
+ ### Ask Clarifying Questions
37
+
38
+ Ask **3-5 targeted questions** covering:
39
+
40
+ 1. **Problem**: What specific pain point does this solve? Who experiences it right now?
41
+ 2. **Audience**: Who is the primary user? Be specific — not "developers" but "solo developers who use Claude Code daily."
42
+ 3. **Motivation**: Why does this need to exist? What's wrong with existing solutions?
43
+ 4. **Scope**: What's the smallest version that delivers real value? What's explicitly out of scope?
44
+ 5. **Constraints**: Any technical, budget, time, or team constraints to know about?
45
+
46
+ Do not ask all 5 at once if the seed already answers some. Skip questions that are already clear from context.
47
+
48
+ Allow follow-up rounds if answers raise new questions. Stop when the idea feels crisp — usually 2-3 exchanges.
49
+
50
+ ### Handle Re-run
51
+
52
+ If `clarify.md` already exists, show the current summary and ask:
53
+
54
+ "Clarification exists from [date]. Would you like to refine specific sections or start fresh?"
55
+
56
+ - **Refine**: update named sections
57
+ - **Fresh**: overwrite `clarify.md`
58
+
59
+ ### Save
60
+
61
+ Write `.mema/product/clarify.md`:
62
+
63
+ ```
64
+ # [Project Name] — Clarified Intent
65
+
66
+ **Status:** active | **Updated:** [today's date]
67
+
68
+ ## Problem Being Solved
69
+
70
+ [Specific problem — not "people need X" but "when Y happens, users can't Z because..."]
71
+
72
+ ## Target Audience
73
+
74
+ [Specific description — role, context, pain point they experience]
75
+
76
+ ## Motivation
77
+
78
+ [Why this needs to exist; what's wrong with current alternatives]
79
+
80
+ ## Scope
81
+
82
+ **In scope:**
83
+ - [Core capability 1]
84
+ - [Core capability 2]
85
+
86
+ **Out of scope:**
87
+ - [Explicitly deferred item]
88
+
89
+ ## Constraints
90
+
91
+ [Any technical, time, budget, or team constraints]
92
+ ```
93
+
94
+ ### Guide Next Step
95
+
96
+ ```
97
+ Next: Run /mema.research to find what already exists and validate your approach.
98
+ ```
99
+
100
+ ## AUTO-SAVE & CURATE
101
+
102
+ - ADD or UPDATE `product/clarify.md`
103
+ - NOOP on all other memory files
104
+
105
+ ## AUTO-INDEX
106
+
107
+ Update `.mema/index.md`:
108
+ 1. Add or update entry under `## Product Discovery`: `- \`product/clarify.md\` — Clarified intent: [audience] + [core problem in 5 words]`
109
+ 2. Update `**Updated:**` date
@@ -6,13 +6,23 @@ description: Generate a new memory-aware Claude Code skill. Creates a SKILL.md f
6
6
 
7
7
  You are creating a new Claude Code skill that integrates with mema-kit's memory protocol. Follow these steps carefully.
8
8
 
9
+ ## AUTO-LOAD
10
+
11
+ 1. Read `.mema/index.md` to understand current project state
12
+ 2. If `index.md` is missing or empty, run the **Rebuild Procedure** from `_memory-protocol.md`
13
+ 3. If `agent/patterns.md` exists, read it — check what skills have already been created to avoid duplicating existing skill logic
14
+
9
15
  ## Step 1: Interview
10
16
 
11
17
  Gather the following from the user. Keep it to **2-3 exchanges max** — don't over-interview.
12
18
 
19
+ ### Name validation (apply before asking anything else if name is already provided):
20
+ - If the name matches a reserved built-in (`mema.onboard`, `mema.recall`, `mema.plan`, `mema.implement`, `mema.create-skill`), warn: "This name matches a built-in mema-kit skill. Using it in `.claude/skills/` will shadow the built-in. Continue? (yes/no)"
21
+ - If the name is not kebab-case, convert it automatically and inform the user: "Name converted to kebab-case: [converted-name]"
22
+
13
23
  ### Required:
14
- 1. **Skill name** — kebab-case (e.g., `review`, `debug`, `migrate`). If the user gives a name with spaces or camelCase, convert it.
15
- 2. **Purpose** — What does this skill do? One sentence is enough.
24
+ 1. **Skill name** — kebab-case (e.g., `review`, `debug`, `migrate`).
25
+ 2. **Purpose** — What does this skill do? One sentence is enough. If the answer is a single word or fewer than 5 characters, ask one follow-up question to expand it before proceeding.
16
26
 
17
27
  ### Optional (offer sensible defaults):
18
28
  3. **Memory needs** — Does this skill need to:
@@ -28,10 +38,26 @@ If the user doesn't specify memory needs or complexity, default to **both** and
28
38
 
29
39
  ## Step 2: Generate SKILL.md
30
40
 
31
- Based on the interview answers, generate a SKILL.md file. Use the appropriate template below based on complexity level.
41
+ Based on the interview answers, generate a SKILL.md file using the appropriate template below.
32
42
 
33
43
  **Critical rule:** Generated skills reference `_memory-protocol.md` for curation rules. NEVER duplicate the memory protocol content inside generated skills.
34
44
 
45
+ ### Generating the WORK phase (applies to all templates):
46
+
47
+ When filling the WORK phase of any template:
48
+ 1. **Decompose the purpose** into 2–5 concrete developer actions — ask yourself: "what would a skilled developer do, step by step, to accomplish [purpose]?"
49
+ 2. **Write each action** as an imperative instruction sentence (e.g., "Read each changed file and identify…"; "Compare findings against…"; "Write a summary of…")
50
+ 3. **If the purpose has multiple distinct concerns** (multiple verbs, the word "and", or conditional logic) — organize into sub-sections: `### 2a: [First concern]`, `### 2b: [Second concern]`
51
+
52
+ ### Generating AUTO-LOAD hints (standard and advanced templates):
53
+
54
+ Scan the purpose for domain keywords and replace the `[Add or remove entries…]` placeholder with relevant `.mema/` paths:
55
+ - Always include: `project/architecture.md` — technical context; `agent/lessons.md` — mistakes to avoid
56
+ - "decide / choose / compare / evaluate" → add `project/decisions/` — past decisions on this domain
57
+ - "pattern / reuse / template" → add `agent/patterns.md` — reusable approaches
58
+ - "implement / build / create / migrate" → add active `features/[feature-name]/` if one exists in the index
59
+ - "test / validate / check / audit" → note in `agent/lessons.md` entry that testing lessons are especially relevant
60
+
35
61
  ---
36
62
 
37
63
  ### Simple Template (3 phases)
@@ -54,13 +80,9 @@ You are executing the /[skill-name] skill. Follow these steps carefully.
54
80
 
55
81
  ## Phase 2: WORK
56
82
 
57
- [Core skill logic goes here — describe what the skill does step by step]
83
+ [Generate 2–5 concrete steps from the purpose no placeholder text]
58
84
 
59
- 1. [First action]
60
- 2. [Second action]
61
- 3. [Third action]
62
-
63
- Use the loaded memory context to inform your work. Reference architecture decisions, past lessons, and patterns where relevant.
85
+ Use the loaded memory context to inform your work.
64
86
 
65
87
  ## Phase 3: REPORT
66
88
 
@@ -92,19 +114,13 @@ You are executing the /[skill-name] skill. Follow these steps carefully.
92
114
  4. Read only what's needed — don't load everything
93
115
 
94
116
  **Relevant memory for this skill:**
95
- - `project-memory/architecture.md` — for technical context
96
- - `project-memory/decisions/` — for past decisions related to this work
97
- - `agent-memory/lessons.md` for mistakes to avoid
98
- - `agent-memory/patterns.md` — for reusable approaches
99
- - [Add or remove entries based on the skill's purpose]
117
+ - `project/architecture.md` — for technical context
118
+ - `agent/lessons.md` — for mistakes to avoid
119
+ [Derive additional entries from purpose keywords per Step 2 generation instructions]
100
120
 
101
121
  ## Phase 2: WORK
102
122
 
103
- [Core skill logic goes here — describe what the skill does step by step]
104
-
105
- 1. [First action]
106
- 2. [Second action]
107
- 3. [Third action]
123
+ [Generate 2–5 concrete steps from the purpose no placeholder text]
108
124
 
109
125
  Use the loaded memory context to inform your work.
110
126
 
@@ -112,10 +128,10 @@ Use the loaded memory context to inform your work.
112
128
 
113
129
  Follow the curation rules in `_memory-protocol.md`. For each piece of knowledge produced:
114
130
 
115
- - **Decisions made** → ADD to `project-memory/decisions/YYYY-MM-DD-short-name.md`
116
- - **Architecture changes** → UPDATE `project-memory/architecture.md`
117
- - **Lessons learned** → ADD/UPDATE `agent-memory/lessons.md`
118
- - **Patterns discovered** → ADD/UPDATE `agent-memory/patterns.md`
131
+ - **Decisions made** → ADD to `project/decisions/YYYY-MM-DD-short-name.md`
132
+ - **Architecture changes** → UPDATE `project/architecture.md`
133
+ - **Lessons learned** → ADD/UPDATE `agent/lessons.md`
134
+ - **Patterns discovered** → ADD/UPDATE `agent/patterns.md`
119
135
  - **Exploration findings** → ADD to appropriate `task-memory/` or `project-memory/` file
120
136
 
121
137
  Apply ADD/UPDATE/DELETE/NOOP to each memory file. Most files will be NOOP.
@@ -148,29 +164,25 @@ You are executing the /[skill-name] skill. Follow these steps carefully.
148
164
  1. Read `.mema/index.md` to understand current project state
149
165
  2. If `index.md` is missing or empty, run the **Rebuild Procedure** from `_memory-protocol.md`
150
166
  3. Based on the user's request, identify and read relevant memory files:
151
- - Task-specific: `task-memory/[task-name]/` (context, plan, status)
152
- - Project-wide: `project-memory/architecture.md`, relevant decisions
153
- - Agent knowledge: `agent-memory/lessons.md`, `agent-memory/patterns.md`
167
+ - Task-specific: `features/[feature-name]/` (context, plan, status)
168
+ - Project-wide: `project/architecture.md`, relevant decisions
169
+ - Agent knowledge: `agent/lessons.md`, `agent/patterns.md`
154
170
  4. Read only what's needed — don't load everything
155
171
 
156
172
  ## Phase 2: WORK
157
173
 
158
174
  ### 2a: Task Setup
159
175
  If no task directory exists for this work:
160
- 1. Create `task-memory/[task-name]/`
176
+ 1. Create `features/[feature-name]/`
161
177
  2. Write initial `context.md` with the task description and relevant findings
162
178
 
163
179
  If a task directory exists, read the current status and continue where you left off.
164
180
 
165
181
  ### 2b: Core Work
166
182
 
167
- [Core skill logic goes here — describe what the skill does step by step]
168
-
169
- 1. [First action]
170
- 2. [Second action]
171
- 3. [Third action]
183
+ [Generate 2–5 concrete steps from the purpose no placeholder text]
172
184
 
173
- Track progress by updating `task-memory/[task-name]/status.md` as you go.
185
+ Track progress by updating `features/[feature-name]/status.md` as you go.
174
186
 
175
187
  ### 2c: Learn
176
188
 
@@ -183,18 +195,18 @@ After completing work, reflect:
183
195
 
184
196
  Follow the curation rules in `_memory-protocol.md`. For each piece of knowledge produced:
185
197
 
186
- - **Decisions made** → ADD to `project-memory/decisions/YYYY-MM-DD-short-name.md`
187
- - **Architecture changes** → UPDATE `project-memory/architecture.md`
188
- - **Lessons learned** → ADD/UPDATE `agent-memory/lessons.md`
189
- - **Patterns discovered** → ADD/UPDATE `agent-memory/patterns.md`
190
- - **Task progress** → UPDATE `task-memory/[task-name]/status.md`
198
+ - **Decisions made** → ADD to `project/decisions/YYYY-MM-DD-short-name.md`
199
+ - **Architecture changes** → UPDATE `project/architecture.md`
200
+ - **Lessons learned** → ADD/UPDATE `agent/lessons.md`
201
+ - **Patterns discovered** → ADD/UPDATE `agent/patterns.md`
202
+ - **Task progress** → UPDATE `features/[feature-name]/status.md`
191
203
 
192
204
  Apply ADD/UPDATE/DELETE/NOOP to each memory file. Most files will be NOOP.
193
205
 
194
206
  ### Task Completion
195
207
  If the task is fully complete:
196
- 1. Mark `task-memory/[task-name]/status.md` as `**Status:** complete`
197
- 2. Move `task-memory/[task-name]/` to `archive/[task-name]/`
208
+ 1. Mark `features/[feature-name]/status.md` as `**Status:** complete`
209
+ 2. Move `features/[feature-name]/` to `archive/[task-name]/`
198
210
  3. Remove the task from "Active Tasks" in `index.md`
199
211
 
200
212
  ## Phase 4: AUTO-INDEX
@@ -209,11 +221,43 @@ Update `.mema/index.md`:
209
221
 
210
222
  ---
211
223
 
224
+ ## Step 2.5: Draft Review
225
+
226
+ Before writing any file to disk, show the user the complete generated SKILL.md for review.
227
+
228
+ 1. Render the full generated SKILL.md content inside a fenced code block
229
+ 2. Ask:
230
+ > "Does this look correct? Reply **APPROVE** to write the file, describe a specific change to revise, or **CANCEL** to exit without writing."
231
+ 3. **On a change request**: Apply the change to the named section only. Re-render the full draft. Repeat the prompt. If the user has requested more than 3 revisions, warn: "Multiple revisions requested. Consider re-running `/mema.create-skill` with a more detailed purpose." — then continue with the current draft.
232
+ 4. **On CANCEL**: Exit immediately. Do not write, create, or modify any files.
233
+ 5. **On APPROVE**: Proceed to Step 3.
234
+
212
235
  ## Step 3: Write the File
213
236
 
214
- 1. Write the generated SKILL.md to `.claude/skills/[skill-name]/SKILL.md`
215
- 2. Create the directory if it doesn't exist
216
- 3. If the file already exists, warn the user and ask before overwriting
237
+ ### Existence check
238
+
239
+ Before writing, check whether `.claude/skills/[skill-name]/SKILL.md` already exists.
240
+
241
+ **If the file does NOT exist:**
242
+ 1. Create the directory `.claude/skills/[skill-name]/` if it doesn't exist
243
+ 2. Write the approved content to `.claude/skills/[skill-name]/SKILL.md`
244
+
245
+ **If the file EXISTS:**
246
+ 1. Read the existing file; extract the `description` frontmatter value and all `## Phase`, `## Step`, and `## AUTO-*` headings (headings only, not body content)
247
+ 2. Show the user:
248
+ ```
249
+ Existing skill found: /[skill-name]
250
+ Description: [existing description]
251
+ Sections: [list of headings]
252
+
253
+ Choose an action:
254
+ (1) Enhance existing — apply a described change to specific sections
255
+ (2) Overwrite — start fresh (goes through preview)
256
+ (3) Cancel — exit without changes
257
+ ```
258
+ 3. **Option 1 — Enhance**: Ask "What specifically should I change?" Apply the directive to the named section(s) only, preserving everything else. Run the modified file through the Step 2.5 Draft Review flow, then write on APPROVE.
259
+ 4. **Option 2 — Overwrite**: Discard the existing content. Return to Step 1 and run the full interview → generation → preview flow from scratch.
260
+ 5. **Option 3 — Cancel**: Exit. No file changes.
217
261
 
218
262
  ## Step 4: Verify
219
263
 
@@ -223,6 +267,7 @@ Read back the file you just wrote and confirm:
223
267
  - Memory file paths use `.mema/` (not `.praxis/` or any other prefix)
224
268
  - The skill references `_memory-protocol.md` for curation rules (standard and advanced only)
225
269
  - No memory protocol content is duplicated inside the skill
270
+ - No `[…]`-style placeholder text remains
226
271
 
227
272
  ## Step 5: Confirm
228
273
 
@@ -240,3 +285,20 @@ To use it:
240
285
 
241
286
  The skill follows the mema-kit memory protocol and will [read from / write to / read from and write to] .mema/ automatically.
242
287
  ```
288
+
289
+ ## AUTO-SAVE & CURATE
290
+
291
+ Follow the curation rules in `_memory-protocol.md`.
292
+
293
+ **If a skill file was written** (user did not CANCEL):
294
+ - ADD/UPDATE `agent/patterns.md` with a lightweight record: skill name, complexity level, one-sentence purpose, action taken (`created` / `enhanced` / `overwritten`), date (`YYYY-MM-DD`)
295
+
296
+ **If no file was written** (user cancelled at any step):
297
+ - NOOP — no memory changes
298
+
299
+ ## AUTO-INDEX
300
+
301
+ Update `.mema/index.md`:
302
+ 1. Re-read the current index
303
+ 2. If `agent/patterns.md` was modified, update its summary entry
304
+ 3. Update the `**Updated:**` date