5-phase-workflow 1.2.1 → 1.3.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.
@@ -9,6 +9,27 @@ user-invocable: true
9
9
 
10
10
  # Review Code (Phase 5)
11
11
 
12
+ ## Prerequisites Check
13
+
14
+ **CRITICAL: Check for configuration before proceeding**
15
+
16
+ ```bash
17
+ if [ ! -f ".claude/.5/config.json" ]; then
18
+ echo "❌ Configuration not found"
19
+ echo ""
20
+ echo "Please run /5:configure first to set up your project."
21
+ echo ""
22
+ echo "The configure command will:"
23
+ echo " • Detect your project type and build commands"
24
+ echo " • Set up ticket tracking conventions"
25
+ echo " • Generate documentation (CLAUDE.md)"
26
+ echo " • Create project-specific skills"
27
+ exit 1
28
+ fi
29
+ ```
30
+
31
+ **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
32
+
12
33
  ## Overview
13
34
 
14
35
  This command automates code review using a configurable review tool. The review tool is set in `.claude/.5/config.json` (`reviewTool` field). Two tools are supported:
@@ -27,7 +48,7 @@ Both tools produce the same structured output format, so all downstream steps (p
27
48
  6. Reports results
28
49
 
29
50
  **Workflow B: File-Based Annotation** (user preference)
30
- 1. Runs review and saves findings to `.5/{feature-name}/review-{timestamp}-findings.md`
51
+ 1. Runs review and saves findings to `.5/features/{feature-name}/review-{timestamp}-findings.md`
31
52
  2. User edits the file to mark which findings to fix ([FIX], [SKIP], [MANUAL])
32
53
  3. User runs `/review-code apply` to read annotations and apply marked fixes
33
54
 
@@ -395,13 +416,13 @@ The template contains placeholders for:
395
416
  When user selects "Save to file", create a structured findings file that allows user annotation.
396
417
 
397
418
  **Determine feature name:**
398
- - Check most recent state file in `.5/*/state.json` to find current feature
419
+ - Check most recent state file in `.5/features/*/state.json` to find current feature
399
420
  - Or ask user which feature they're reviewing
400
421
  - Use feature name for organizing review files
401
422
 
402
423
  **Create directory if needed:**
403
424
  ```bash
404
- mkdir -p .5/{feature-name}
425
+ mkdir -p .5/features/{feature-name}
405
426
  ```
406
427
 
407
428
  **Generate timestamp:**
@@ -412,7 +433,7 @@ Example: 20260128-103045
412
433
 
413
434
  **File path:**
414
435
  ```
415
- .5/{feature-name}/review-{timestamp}-findings.md
436
+ .5/features/{feature-name}/review-{timestamp}-findings.md
416
437
  ```
417
438
 
418
439
  **File format:**
@@ -433,7 +454,7 @@ The template contains:
433
454
  - **Next Steps:** Instructions to edit and run `/review-code apply`
434
455
 
435
456
  **After saving file:**
436
- - Inform user: "Findings saved to .5/{feature-name}/review-{timestamp}-findings.md"
457
+ - Inform user: "Findings saved to .5/features/{feature-name}/review-{timestamp}-findings.md"
437
458
  - Provide instructions: "Edit the file to mark findings, then run: /review-code apply"
438
459
  - Skip remaining steps (don't apply fixes interactively)
439
460
 
@@ -442,13 +463,13 @@ The template contains:
442
463
  When user runs `/review-code apply`, read the most recent findings file and apply marked fixes.
443
464
 
444
465
  **Determine feature name:**
445
- - Check most recent state file in `.5/*/state.json` to find current feature
466
+ - Check most recent state file in `.5/features/*/state.json` to find current feature
446
467
  - Or ask user which feature they're reviewing
447
468
 
448
469
  **Find the most recent findings file:**
449
470
  ```bash
450
471
  # Find most recent review findings file in the feature folder
451
- ls -t .5/{feature-name}/review-*-findings.md | head -1
472
+ ls -t .5/features/{feature-name}/review-*-findings.md | head -1
452
473
  ```
453
474
 
454
475
  **If no findings file exists:**
@@ -528,7 +549,7 @@ After applying fixes from an annotated file, update the findings file with resul
528
549
 
529
550
  For interactive mode only, save the review summary to:
530
551
  ```
531
- .5/{feature-name}/review-{timestamp}.md
552
+ .5/features/{feature-name}/review-{timestamp}.md
532
553
  ```
533
554
 
534
555
  ## Error Handling
@@ -614,7 +635,7 @@ Action: Please review the suggested fix manually.
614
635
 
615
636
  ## Configuration
616
637
 
617
- **Directory:** `.5/{feature-name}/` (organized by feature)
638
+ **Directory:** `.5/features/{feature-name}/` (organized by feature)
618
639
 
619
640
  **File Types:**
620
641
  - `review-{timestamp}-findings.md` - Annotatable findings (file-based mode)
@@ -623,7 +644,7 @@ Action: Please review the suggested fix manually.
623
644
  **Timestamp Format:** Custom format `YYYYMMDD-HHmmss` (e.g., `20260128-103045`)
624
645
 
625
646
  **Feature Detection:** Review files are organized by feature. The command will:
626
- - Check most recent state file in `.5/*/state.json` to find current feature
647
+ - Check most recent state file in `.5/features/*/state.json` to find current feature
627
648
  - Or ask user which feature they're reviewing if unclear
628
649
 
629
650
  ## Related Documentation
@@ -8,6 +8,27 @@ user-invocable: true
8
8
 
9
9
  # Verify Implementation (Phase 4)
10
10
 
11
+ ## Prerequisites Check
12
+
13
+ **CRITICAL: Check for configuration before proceeding**
14
+
15
+ ```bash
16
+ if [ ! -f ".claude/.5/config.json" ]; then
17
+ echo "❌ Configuration not found"
18
+ echo ""
19
+ echo "Please run /5:configure first to set up your project."
20
+ echo ""
21
+ echo "The configure command will:"
22
+ echo " • Detect your project type and build commands"
23
+ echo " • Set up ticket tracking conventions"
24
+ echo " • Generate documentation (CLAUDE.md)"
25
+ echo " • Create project-specific skills"
26
+ exit 1
27
+ fi
28
+ ```
29
+
30
+ **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
31
+
11
32
  Verify that an implementation is complete, correct, and meets feature requirements through multi-layer verification.
12
33
 
13
34
  ## Scope
@@ -26,11 +47,11 @@ If verification finds gaps, it generates a fix plan and offers to apply fixes au
26
47
  Read all workflow artifacts for the feature:
27
48
 
28
49
  **Required:**
29
- - `.5/{feature-name}/plan.md` — implementation plan (Phase 2)
30
- - `.5/{feature-name}/state.json` — implementation state (Phase 3)
50
+ - `.5/features/{feature-name}/plan.md` — implementation plan (Phase 2)
51
+ - `.5/features/{feature-name}/state.json` — implementation state (Phase 3)
31
52
 
32
53
  **Optional:**
33
- - `.5/{feature-name}/feature.md` — feature spec (Phase 1)
54
+ - `.5/features/{feature-name}/feature.md` — feature spec (Phase 1)
34
55
 
35
56
  **If `plan.md` or `state.json` is missing:** hard stop.
36
57
  ```
@@ -198,7 +219,7 @@ Evaluate all three layers:
198
219
 
199
220
  ### Step 6: Generate Verification Report
200
221
 
201
- Write `.5/{feature-name}/verification.md` using the template structure from `.claude/templates/workflow/VERIFICATION-REPORT.md`.
222
+ Write `.5/features/{feature-name}/verification.md` using the template structure from `.claude/templates/workflow/VERIFICATION-REPORT.md`.
202
223
 
203
224
  The report covers:
204
225
  - **Header:** ticket, feature, status, timestamp
@@ -209,7 +230,7 @@ The report covers:
209
230
 
210
231
  ### Step 7: Update State
211
232
 
212
- Update `.5/{feature-name}/state.json`:
233
+ Update `.5/features/{feature-name}/state.json`:
213
234
  ```json
214
235
  {
215
236
  "verificationStatus": "passed | partial | failed",
@@ -264,7 +285,7 @@ Continue to Step 9.
264
285
 
265
286
  ### Step 9: Generate Fix Plan (PARTIAL or FAILED only)
266
287
 
267
- Write `.5/{feature-name}/fix-plan.md` using the template structure from `.claude/templates/workflow/FIX-PLAN.md`.
288
+ Write `.5/features/{feature-name}/fix-plan.md` using the template structure from `.claude/templates/workflow/FIX-PLAN.md`.
268
289
 
269
290
  Build fix entries from verification results:
270
291
 
@@ -62,7 +62,7 @@ It handles three distinct tasks, invoked with different parameters per component
62
62
  ```
63
63
 
64
64
  **Process:**
65
- 1. Read all values from the feature spec (`.5/CONFIGURE/feature.md`)
65
+ 1. Read all values from the feature spec (`.5/features/CONFIGURE/feature.md`)
66
66
  2. Ensure `.claude/.5/` directory exists (create with `mkdir -p` if needed)
67
67
  3. Write `config.json` with pretty-printed JSON
68
68
  4. Read back to verify correctness
@@ -250,75 +250,231 @@ If CLAUDE.md already exists:
250
250
 
251
251
  ## C. Generate Project-Specific Skills
252
252
 
253
+ **Reads:** Pattern selections from feature spec (`.5/CONFIGURE/feature.md`)
254
+
253
255
  **Creates:** SKILL.md files in `.claude/skills/{name}/SKILL.md`
254
256
 
255
- Each skill follows the standard frontmatter pattern and contains instructions derived from analyzing the actual project structure (reads existing files to derive patterns/templates).
256
-
257
- ### Skill Detection by Project Type
258
-
259
- | Project Type | Skills |
260
- |---|---|
261
- | Next.js | create-page, create-api-route, create-component |
262
- | NestJS | create-module, create-service, create-controller |
263
- | Express | create-route, create-middleware, create-service |
264
- | React | create-component, create-hook, create-context |
265
- | Django | create-model, create-view, create-serializer |
266
- | Flask | create-blueprint, create-model |
267
- | Java (Gradle/Maven) | create-entity, create-service, create-controller, create-repository |
268
- | Rust | create-module |
269
- | Go | create-handler, create-service |
270
- | Rails | create-model, create-controller |
271
- | Generic | create-module |
272
-
273
- ### Skill Generation Process
274
-
275
- For each skill to generate:
276
- 1. Identify existing examples of that pattern in the codebase (e.g., find existing components for `create-component`)
277
- 2. Read 1-2 examples to extract the project's conventions and structure
278
- 3. Create a SKILL.md that instructs the agent to follow those conventions
279
- 4. Each generated SKILL.md should include:
280
- - Standard frontmatter (name, description, allowed-tools, model: sonnet, context: fork, user-invocable: false)
281
- - What the skill creates
282
- - File naming and location conventions (derived from existing code)
283
- - Template/pattern to follow (derived from existing code)
284
- - Checklist of what to include
285
-
286
- ### Example Generated Skill
257
+ ### Pattern-Based Skill Generation
258
+
259
+ Skills are determined by what patterns exist in the codebase (detected during `/5:configure`) and what the user selected—NOT by project type.
260
+
261
+ For EACH pattern selected by the user in the feature spec:
262
+
263
+ 1. **Find examples** - Read 2-3 files from the pattern's location
264
+ 2. **Extract conventions:**
265
+ - File naming (PascalCase, kebab-case, suffix patterns)
266
+ - Directory structure (flat, nested, co-located tests)
267
+ - Import patterns (absolute, relative, aliases)
268
+ - Export patterns (default, named, barrel files)
269
+ - Common boilerplate (decorators, annotations, base classes)
270
+ 3. **Generate SKILL.md** with:
271
+ - Detected conventions as instructions
272
+ - Template derived from actual code
273
+ - Checklist based on common elements found
274
+
275
+ ### Skill Template Structure
276
+
277
+ For each skill, create `.claude/skills/create-{pattern}/SKILL.md`:
287
278
 
288
279
  ```yaml
289
280
  ---
290
- name: create-component
291
- description: Creates a React component following project conventions.
281
+ name: create-{pattern}
282
+ description: Creates a {Pattern} following project conventions at {location}.
292
283
  allowed-tools: Read, Write, Glob, Grep
293
- model: sonnet
284
+ model: haiku
294
285
  context: fork
295
- user-invocable: false
286
+ user-invocable: true
296
287
  ---
297
288
  ```
298
289
 
299
290
  ```markdown
300
- # Create Component
291
+ # Create {Pattern}
301
292
 
302
293
  ## What This Skill Creates
303
- A React component following this project's conventions.
294
+ A {pattern} following this project's conventions.
304
295
 
305
- ## Conventions (from project analysis)
306
- - Location: `src/components/{ComponentName}/`
307
- - Files: `index.tsx`, `{ComponentName}.tsx`, `{ComponentName}.test.tsx`
308
- - Style: CSS Modules at `{ComponentName}.module.css`
309
- - Exports: Named export from component file, re-exported from index
296
+ ## Detected Conventions
297
+ - **Location:** {detected-location}
298
+ - **Naming:** {detected-naming-pattern}
299
+ - **Structure:** {detected-structure}
300
+ - **Imports:** {detected-import-pattern}
310
301
 
311
302
  ## Template
312
- {Derived from existing components in the project}
303
+ Based on {example-file}, new {patterns} should follow:
304
+
305
+ \`\`\`{language}
306
+ {template-derived-from-analysis}
307
+ \`\`\`
313
308
 
314
309
  ## Checklist
315
- - [ ] Component file created
316
- - [ ] Props interface defined
317
- - [ ] Test file created
318
- - [ ] Index file with re-export
319
- - [ ] Follows naming conventions
310
+ - [ ] File created at correct location
311
+ - [ ] Naming convention followed
312
+ - [ ] Required imports added
313
+ - [ ] {pattern-specific-items}
314
+ ```
315
+
316
+ ### Pattern to Skill Name Mapping
317
+
318
+ | Detected Pattern | Skill Name |
319
+ |------------------|------------|
320
+ | **Core Architecture** | |
321
+ | controller | create-controller |
322
+ | service | create-service |
323
+ | repository | create-repository |
324
+ | model/entity | create-model |
325
+ | handler | create-handler |
326
+ | **Data Transfer** | |
327
+ | dto | create-dto |
328
+ | request | create-request |
329
+ | response | create-response |
330
+ | mapper | create-mapper |
331
+ | validator | create-validator |
332
+ | schema | create-schema |
333
+ | **Frontend** | |
334
+ | component | create-component |
335
+ | hook | create-hook |
336
+ | context | create-context |
337
+ | store | create-store |
338
+ | page | create-page |
339
+ | layout | create-layout |
340
+ | **API/Routes** | |
341
+ | api-route | create-api-route |
342
+ | middleware | create-middleware |
343
+ | guard | create-guard |
344
+ | interceptor | create-interceptor |
345
+ | filter | create-filter |
346
+ | **Testing** | |
347
+ | test | create-test |
348
+ | spec | create-spec |
349
+ | fixture | create-fixture |
350
+ | factory | create-factory |
351
+ | mock | create-mock |
352
+ | **Utilities** | |
353
+ | util | create-util |
354
+ | helper | create-helper |
355
+ | constant | create-constant |
356
+ | type | create-type |
357
+ | config | create-config |
358
+ | **Framework-Specific** | |
359
+ | module | create-module |
360
+ | pipe | create-pipe |
361
+ | decorator | create-decorator |
362
+ | blueprint | create-blueprint |
363
+ | view | create-view |
364
+ | serializer | create-serializer |
365
+ | **Background/Async** | |
366
+ | job | create-job |
367
+ | worker | create-worker |
368
+ | event | create-event |
369
+ | listener | create-listener |
370
+ | command | create-command |
371
+ | **Database** | |
372
+ | migration | create-migration |
373
+ | seed | create-seed |
374
+ | **Error Handling** | |
375
+ | exception | create-exception |
376
+ | error | create-error |
377
+
378
+ ### Why `user-invocable: true`
379
+
380
+ Generated skills are user-invocable so users can invoke them directly:
381
+ - `/create-controller UserController`
382
+ - `/create-component Button`
383
+ - `/create-service AuthService`
384
+
385
+ This is more useful than internal-only skills.
386
+
387
+ ### Why `model: haiku`
388
+
389
+ Pattern-following is simple once conventions are documented:
390
+ - Faster and cheaper than sonnet
391
+ - Deep analysis already happened during generation
392
+ - The skill just needs to follow the documented template
393
+
394
+ ---
395
+
396
+ ## C2. Generate Command Skills (run-*)
397
+
398
+ **Reads:** Command selections from feature spec (`.5/CONFIGURE/feature.md`)
399
+
400
+ **Creates:** SKILL.md files in `.claude/skills/run-{command}/SKILL.md`
401
+
402
+ ### Command-Based Skill Generation
403
+
404
+ For EACH command selected by the user in the feature spec:
405
+
406
+ 1. **Read the source** - Check package.json scripts, Makefile, etc.
407
+ 2. **Document the command:**
408
+ - Exact command syntax
409
+ - Available variants (e.g., test:unit, test:e2e)
410
+ - Common flags and options
411
+ - Expected output format
412
+ 3. **Generate SKILL.md** with:
413
+ - Command execution instructions
414
+ - Output parsing guidance
415
+ - Error handling patterns
416
+
417
+ ### Command Skill Template Structure
418
+
419
+ For each skill, create `.claude/skills/run-{command}/SKILL.md`:
420
+
421
+ ```yaml
422
+ ---
423
+ name: run-{command}
424
+ description: Runs {command} for this project using {source}.
425
+ allowed-tools: Bash
426
+ model: haiku
427
+ context: fork
428
+ user-invocable: true
429
+ ---
430
+ ```
431
+
432
+ ```markdown
433
+ # Run {Command}
434
+
435
+ ## What This Skill Does
436
+ Executes the project's {command} command.
437
+
438
+ ## Command
439
+ \`\`\`bash
440
+ {exact-command}
441
+ \`\`\`
442
+
443
+ ## Variants
444
+ {if variants exist}
445
+ - `{variant1}` - {description}
446
+ - `{variant2}` - {description}
447
+
448
+ ## Common Options
449
+ - `--watch` - Run in watch mode (if available)
450
+ - `--coverage` - Generate coverage report (for tests)
451
+ - `--fix` - Auto-fix issues (for lint/format)
452
+
453
+ ## Expected Output
454
+ {describe what success/failure looks like}
455
+
456
+ ## Error Handling
457
+ - If command fails, report the error output
458
+ - Common issues: {list common problems and solutions}
320
459
  ```
321
460
 
461
+ ### Command to Skill Name Mapping
462
+
463
+ | Detected Command | Skill Name |
464
+ |------------------|------------|
465
+ | build | run-build |
466
+ | test, spec | run-tests |
467
+ | lint, eslint | run-lint |
468
+ | format, prettier | run-format |
469
+ | typecheck, tsc | run-typecheck |
470
+ | dev, start | run-dev |
471
+ | db:migrate, migrate | run-migrate |
472
+ | db:seed, seed | run-seed |
473
+ | docker:build | run-docker-build |
474
+ | docker:up, compose up | run-docker-up |
475
+ | clean | run-clean |
476
+ | generate, codegen | run-generate |
477
+
322
478
  ---
323
479
 
324
480
  ## Output Contract
@@ -336,7 +492,8 @@ Component B (Documentation): SUCCESS - Created 7 documentation files + index
336
492
  - .5/INTEGRATIONS.md (PostgreSQL, 2 APIs, GitHub Actions)
337
493
  - .5/CONCERNS.md (3 TODO items, 1 deprecated dependency)
338
494
  - CLAUDE.md (index with references)
339
- Component C (Skills): SUCCESS - Generated 3 skills (create-component, create-hook, create-context)
495
+ Component C (Pattern Skills): SUCCESS - Generated 3 create-* skills (create-component, create-hook, create-context)
496
+ Component D (Command Skills): SUCCESS - Generated 2 run-* skills (run-tests, run-lint)
340
497
  ```
341
498
 
342
499
  Or on failure:
@@ -350,6 +507,8 @@ Component B (Documentation): FAILED - Unable to read template files
350
507
 
351
508
  - DO NOT overwrite existing user-written CLAUDE.md sections
352
509
  - DO NOT generate skills for patterns that don't exist in the project
510
+ - DO NOT generate command skills for commands that don't exist in the project
353
511
  - DO NOT include `steps` in config.json
354
512
  - DO NOT hardcode conventions - always derive from actual project analysis
355
513
  - DO NOT generate empty or placeholder skill files
514
+ - DO NOT assume command syntax - always read from actual config files (package.json, Makefile, etc.)