5-phase-workflow 1.8.7 → 1.8.9

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.
@@ -1,22 +1,22 @@
1
1
  ---
2
- name: configure-project
3
- description: Analyzes codebase for CLAUDE.md and generates project-specific skills. Used during /5:implement-feature CONFIGURE.
2
+ name: configure-skills
3
+ description: Generates project-specific create-*/run-* skills and scoped rules from the current codebase. Used during /5:implement-feature CONFIGURE.
4
4
  allowed-tools: Read, Write, Bash, Glob, Grep
5
5
  model: sonnet
6
6
  context: fork
7
7
  user-invocable: false
8
8
  ---
9
9
 
10
- # Configure Project Skill
10
+ # Configure Skills Skill
11
11
 
12
12
  ## Overview
13
13
 
14
- This skill does the heavy lifting during Phase 3 (implement-feature) for the CONFIGURE feature. It is called by step-executor to create the actual configuration files.
14
+ This skill handles skill and rule generation during Phase 3 (implement-feature) for the CONFIGURE feature. It is called by step-executor to create project-specific skills and scoped rules.
15
15
 
16
- It handles two distinct tasks, invoked with different parameters per component:
16
+ It handles two tasks:
17
17
 
18
- - **A. Analyze Codebase and Create/Update CLAUDE.md** - Maps codebase and documents conventions
19
- - **B. Generate Project-Specific Skills** - Creates SKILL.md files for common project patterns
18
+ - **Generate Project-Specific Skills** - Creates SKILL.md files for common project patterns
19
+ - **Generate Scoped Rules** - Creates `.claude/rules/*.md` files with file-type-specific directives
20
20
 
21
21
  Note: config.json is written directly by `/5:configure` during the Q&A phase.
22
22
 
@@ -24,115 +24,28 @@ Note: config.json is written directly by `/5:configure` during the Q&A phase.
24
24
 
25
25
  ## Modes
26
26
 
27
- This skill supports two modes. The analysis (A1), template filling (A2-A3), CLAUDE.md update (A4-A5), and skill generation (B) logic is the same in both modes — only the **input source** changes.
27
+ This skill supports two modes. The skill generation and rule generation logic is the same in both modes — only the **input source** changes.
28
28
 
29
29
  ### Full Mode (default)
30
30
 
31
31
  Used by `/5:configure` → `/5:implement-feature CONFIGURE` flow.
32
32
 
33
33
  - **Input:** Pattern/command selections from feature spec (`.5/features/CONFIGURE/feature.md`)
34
- - **Behavior:** Creates everything from scratch based on feature spec requirements
34
+ - **Behavior:** Creates all selected skills and rules from scratch based on feature spec requirements
35
35
 
36
36
  ### Refresh Mode
37
37
 
38
38
  Used by `/5:reconfigure` for lightweight refresh.
39
39
 
40
- - **Input:** The Task prompt lists which skills to refresh, create, and remove (determined by `/5:reconfigure` after scanning `.claude/skills/` and comparing with detected codebase patterns)
41
- - **Behavior:** Re-analyzes codebase, overwrites docs and refreshes/creates/removes skills as specified
40
+ - **Input:** The Task prompt lists which skills to refresh, create, and remove, and which rules to refresh or remove
41
+ - **Behavior:** Re-analyzes codebase, refreshes/creates/removes skills as specified, and refreshes workflow-generated rules
42
42
  - **Trigger:** Task prompt includes "REFRESH MODE"
43
43
 
44
- In both modes, the analysis and generation logic is identical — only where the skill list comes from differs.
44
+ In both modes, the generation logic is identical — only where the requested skill/rule list comes from differs.
45
45
 
46
46
  ---
47
47
 
48
- ## A. Analyze Codebase and Create/Update CLAUDE.md
49
-
50
- **Process:**
51
-
52
- ### A1. Codebase Analysis
53
-
54
- Perform focused analysis to gather data for documentation templates. Only capture information that **cannot be derived** by reading project files directly — skip version numbers, dependency lists, directory layouts, linter configs, and other facts that Claude Code can look up on demand.
55
-
56
- **Architecture Analysis** (for ARCHITECTURE.md):
57
- - Identify architectural pattern (MVC, layered, modular, microservices) from directory structure
58
- - Map layers by directory structure (controllers/, services/, models/, routes/, etc.)
59
- - Trace data flow patterns (read 2-3 example files from different layers)
60
- - Identify key abstractions (interfaces, base classes, common patterns)
61
- - Identify non-obvious conventions: implicit rules not enforced by tooling (e.g., "all services extend BaseService", "barrel exports required per module"). Skip anything in .eslintrc, .prettierrc, tsconfig, etc.
62
- - Determine where new code should go (new features, tests, utilities)
63
-
64
- **Testing Analysis** (for TESTING.md):
65
- - Determine test organization (co-located vs separate `test/` or `spec/`)
66
- - Identify mocking framework and project-specific mocking conventions
67
- - Find fixture/factory patterns
68
- - Note gotchas: setup/teardown quirks, env requirements, flaky areas
69
-
70
- **Concerns Analysis** (for CONCERNS.md — conditional):
71
- - Grep for TODO/FIXME/HACK/XXX/DEPRECATED comments across all code
72
- - Check for common security issues (SQL injection patterns, XSS vulnerabilities)
73
- - Identify non-obvious integration details: auth flows, required env vars not documented elsewhere, webhook contracts, gotchas with external services
74
- - Look for performance bottlenecks or scaling limits mentioned in comments/docs
75
-
76
- ### A2. Fill Templates
77
-
78
- For each template in `.claude/templates/`:
79
-
80
- 1. Read template content with Read tool
81
- 2. Replace placeholders with analyzed data from A1
82
- 3. **Omit sections entirely if no data was found** — do not write "Not detected" or "None found"
83
- 4. For CONCERNS.md: if ALL sections would be empty, **do not create the file at all**
84
-
85
- **Placeholder mapping examples**:
86
-
87
- ARCHITECTURE.md:
88
- - `{Pattern name}` → "Layered Architecture" or "MVC" or "Modular Monolith"
89
- - `{Layer}` → "Controllers", "Services", "Repositories"
90
- - `{path}` → "src/controllers/", "src/services/"
91
-
92
- TESTING.md:
93
- - Describe actual patterns observed, not framework names/versions (those are in config files)
94
-
95
- CONCERNS.md:
96
- - `{file paths}` → Actual file paths from grep results
97
-
98
- ### A3. Write Documentation Files
99
-
100
- Write filled templates to `.5/` folder:
101
-
102
- 1. Ensure `.5/` directory exists: `mkdir -p .5`
103
- 2. Write filled templates:
104
- - `.5/ARCHITECTURE.md` — always created
105
- - `.5/TESTING.md` — always created
106
- - `.5/CONCERNS.md` — **only if concerns were found** (skip if all sections empty)
107
-
108
- ### A4. Create CLAUDE.md
109
-
110
- Generate CLAUDE.md:
111
-
112
- CLAUDE.md structure:
113
- - **Project Overview:** 1-2 sentences from README/package.json
114
- - **Build & Run Commands:** Build, test, and other detected commands
115
- - **Workflow Rules:** Include this section verbatim:
116
- ```
117
- ## Workflow Rules
118
- When running `/5:` workflow commands, follow the command instructions exactly as written.
119
- Do not skip steps, combine phases, or proceed to actions not specified in the current command.
120
- Each phase produces a specific artifact — do not create artifacts belonging to other phases.
121
- ```
122
- - **Coding Guidelines:** The 6 mandatory principles (types, concise docs, short files, extract methods, SRP/DRY, maintainable/modular)
123
- - **Project Documentation:** Links to whichever `.5/` files were created (only list files that exist)
124
-
125
- ### A5. Preserve Existing Content
126
-
127
- If CLAUDE.md already exists:
128
- - Read current content
129
- - Identify user-written custom sections (not matching template structure)
130
- - Preserve under "Custom Documentation" section in new CLAUDE.md
131
- - Ensure 6 mandatory coding guidelines are retained
132
-
133
- ---
134
-
135
- ## B. Generate Project-Specific Skills
48
+ ## A. Generate Project-Specific Skills
136
49
 
137
50
  ### Using skill-creator plugin
138
51
 
@@ -140,13 +53,13 @@ If `tools.skillCreator.available` is `true` in `.5/config.json`, use the skill-c
140
53
 
141
54
  If skill-creator is not available, use the existing template-based generation below — no degradation in workflow behavior.
142
55
 
143
- **Reads:** Pattern selections from feature spec (`.5/CONFIGURE/feature.md`)
56
+ **Reads:** Pattern selections from feature spec (`.5/features/CONFIGURE/feature.md`)
144
57
 
145
58
  **Creates:** SKILL.md files in `.claude/skills/{name}/SKILL.md`
146
59
 
147
- ### Pattern-Based Skill Generation
60
+ ### A1. Pattern-Based Skill Generation
148
61
 
149
- Skills are determined by what patterns exist in the codebase (detected during `/5:configure`) and what the user selected—NOT by project type.
62
+ Skills are determined by what patterns exist in the codebase (detected during `/5:configure`) and what the user selected not by project type.
150
63
 
151
64
  For EACH pattern selected by the user in the feature spec:
152
65
 
@@ -162,7 +75,7 @@ For EACH pattern selected by the user in the feature spec:
162
75
  - Template derived from actual code
163
76
  - Checklist based on common elements found
164
77
 
165
- ### Skill Template Structure
78
+ ### A2. Skill Template Structure
166
79
 
167
80
  For each skill, create `.claude/skills/create-{pattern}/SKILL.md`:
168
81
 
@@ -203,19 +116,19 @@ Based on {example-file}, new {patterns} should follow:
203
116
  - [ ] {pattern-specific-items}
204
117
  ```
205
118
 
206
- ### Pattern to Skill Name Mapping
119
+ ### A3. Pattern to Skill Name Mapping
207
120
 
208
121
  **Rule:** Skill name is `create-{pattern}` (e.g., `controller` → `create-controller`, `component` → `create-component`, `dto` → `create-dto`). For compound patterns, use the short form: `model/entity` → `create-model`, `api-route` → `create-api-route`.
209
122
 
210
123
  ---
211
124
 
212
- ## B2. Generate Command Skills (run-*)
125
+ ## B. Generate Command Skills (run-*)
213
126
 
214
- **Reads:** Command selections from feature spec (`.5/CONFIGURE/feature.md`)
127
+ **Reads:** Command selections from feature spec (`.5/features/CONFIGURE/feature.md`)
215
128
 
216
129
  **Creates:** SKILL.md files in `.claude/skills/run-{command}/SKILL.md`
217
130
 
218
- ### Command-Based Skill Generation
131
+ ### B1. Command-Based Skill Generation
219
132
 
220
133
  For EACH command selected by the user in the feature spec:
221
134
 
@@ -230,7 +143,7 @@ For EACH command selected by the user in the feature spec:
230
143
  - Output parsing guidance
231
144
  - Error handling patterns
232
145
 
233
- ### Command Skill Template Structure
146
+ ### B2. Command Skill Template Structure
234
147
 
235
148
  For each skill, create `.claude/skills/run-{command}/SKILL.md`:
236
149
 
@@ -274,7 +187,7 @@ Executes the project's {command} command.
274
187
  - Common issues: {list common problems and solutions}
275
188
  ```
276
189
 
277
- ### Command to Skill Name Mapping
190
+ ### B3. Command to Skill Name Mapping
278
191
 
279
192
  **Rule:** Skill name is `run-{category}` (e.g., `build` → `run-build`, `test`/`spec` → `run-tests`, `lint` → `run-lint`). Group variants under the primary category name.
280
193
 
@@ -284,11 +197,11 @@ Executes the project's {command} command.
284
197
 
285
198
  If `rules.generate` is `true` in `.5/config.json`, generate `.claude/rules/` files with project-specific conventions scoped to relevant file types.
286
199
 
287
- Rules are **concise directives** (15-40 lines each), NOT documentation. Documentation lives in `.5/*.md` files. Rules tell Claude what to do when working with specific file types.
200
+ Rules are **concise directives** (15-40 lines each), not documentation. Documentation lives in `.5/*.md` files. Rules tell Claude what to do when working with specific file types.
288
201
 
289
202
  ### C1. Determine Which Rules to Generate
290
203
 
291
- Based on the A1 analysis results, determine which rules apply:
204
+ Based on the codebase analysis results, determine which rules apply:
292
205
 
293
206
  | Rule File | Generate When | Source Analysis |
294
207
  |-----------|---------------|-----------------|
@@ -297,7 +210,7 @@ Based on the A1 analysis results, determine which rules apply:
297
210
  | `api-patterns.md` | Controller/route/handler patterns detected | Architecture Analysis |
298
211
  | `dependencies.md` | External integrations detected | Integration Analysis |
299
212
 
300
- **Skip** any rule whose prerequisite patterns were not detected. Do NOT generate empty or placeholder rule files.
213
+ **Skip** any rule whose prerequisite patterns were not detected. Do not generate empty or placeholder rule files.
301
214
 
302
215
  ### C2. Extract Directives and Write Rules
303
216
 
@@ -306,7 +219,7 @@ For each applicable rule:
306
219
  1. **Derive `paths:` globs** from detected file locations (e.g., if tests are at `src/**/*.test.ts` and `tests/**/*.spec.ts`, use those patterns)
307
220
  2. **Convert analysis observations into imperative directives** — "Use X", "Always Y", "Never Z"
308
221
  3. **Keep each file 15-40 lines** — be concise and actionable
309
- 4. **Do NOT repeat** the 6 mandatory coding guidelines from CLAUDE.md
222
+ 4. **Do not repeat** the 6 mandatory coding guidelines from `CLAUDE.md`
310
223
 
311
224
  Write files to `.claude/rules/`:
312
225
 
@@ -365,9 +278,10 @@ paths:
365
278
  ### Refresh Mode Behavior for Rules
366
279
 
367
280
  When running in REFRESH MODE:
368
- - Re-analyze codebase and overwrite all existing rule files with updated directives
369
- - Remove rule files for patterns no longer detected in the codebase
370
- - Create new rule files if new patterns are detected that weren't present before
281
+ - Re-analyze codebase and overwrite all existing workflow-generated rule files with updated directives
282
+ - Remove rule files for patterns no longer detected in the codebase when instructed by the refresh prompt
283
+ - Create new rule files if new patterns are detected and selected
284
+ - Never modify or remove user-created rules outside the workflow-generated set
371
285
 
372
286
  ---
373
287
 
@@ -376,11 +290,6 @@ When running in REFRESH MODE:
376
290
  Returns structured results for each component:
377
291
 
378
292
  ```
379
- Component A (Documentation): SUCCESS - Created documentation files + CLAUDE.md
380
- - .5/ARCHITECTURE.md (Pattern: Layered, 4 layers identified)
381
- - .5/TESTING.md (mocking patterns, gotchas documented)
382
- - .5/CONCERNS.md (3 TODO items, 1 security note) [or "skipped — no concerns found"]
383
- - CLAUDE.md (updated with references)
384
293
  Component B (Pattern Skills): SUCCESS - Generated 3 create-* skills (create-component, create-hook, create-context)
385
294
  Component C (Command Skills): SUCCESS - Generated 2 run-* skills (run-tests, run-lint)
386
295
  Component D (Rules): SUCCESS - Generated 3 rule files (code-style, testing, dependencies)
@@ -389,19 +298,17 @@ Component D (Rules): SUCCESS - Generated 3 rule files (code-style, testing, depe
389
298
  Or on failure:
390
299
 
391
300
  ```
392
- Component A (Documentation): FAILED - Unable to read template files
393
301
  Component B (Pattern Skills): FAILED - No patterns found in codebase
394
302
  Component D (Rules): SKIPPED - rules.generate is false in config
395
303
  ```
396
304
 
397
305
  ## DO NOT
398
306
 
399
- - DO NOT overwrite existing user-written CLAUDE.md sections
400
- - DO NOT generate skills for patterns that don't exist in the project
307
+ - DO NOT generate skills for patterns that don't exist in the project unless the refresh/configure prompt explicitly told you to create them
401
308
  - DO NOT generate command skills for commands that don't exist in the project
402
309
  - DO NOT generate rules for patterns not detected in the codebase
403
310
  - DO NOT include `steps` in config.json
404
311
  - DO NOT hardcode conventions - always derive from actual project analysis
405
312
  - DO NOT generate empty or placeholder skill or rule files
406
313
  - DO NOT assume command syntax - always read from actual config files (package.json, Makefile, etc.)
407
- - DO NOT repeat the 6 mandatory coding guidelines from CLAUDE.md in rule files
314
+ - DO NOT repeat the 6 mandatory coding guidelines from `CLAUDE.md` in rule files