5-phase-workflow 1.8.6 → 1.8.8
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.
- package/README.md +67 -33
- package/bin/install.js +510 -34
- package/docs/workflow-guide.md +1 -1
- package/package.json +1 -1
- package/src/commands/5/address-review-findings.md +2 -2
- package/src/commands/5/configure.md +39 -27
- package/src/commands/5/eject.md +110 -0
- package/src/commands/5/plan-feature.md +0 -1
- package/src/commands/5/plan-implementation.md +0 -1
- package/src/commands/5/quick-implement.md +0 -1
- package/src/commands/5/reconfigure.md +20 -17
- package/src/commands/5/update.md +16 -3
- package/src/hooks/statusline.js +80 -41
- package/src/skills/configure-docs-index/SKILL.md +196 -0
- package/src/skills/configure-skills/SKILL.md +314 -0
- package/src/skills/generate-readme/SKILL.md +1 -2
- package/src/templates/ARCHITECTURE.md +16 -47
- package/src/templates/CONCERNS.md +12 -54
- package/src/templates/TESTING.md +12 -95
- package/src/skills/build-project/SKILL.md +0 -151
- package/src/skills/configure-project/SKILL.md +0 -465
- package/src/skills/run-tests/SKILL.md +0 -162
- package/src/templates/CONVENTIONS.md +0 -75
- package/src/templates/INTEGRATIONS.md +0 -65
- package/src/templates/STACK.md +0 -60
- package/src/templates/STRUCTURE.md +0 -60
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-project
|
|
3
|
-
description: Analyzes codebase for CLAUDE.md and generates project-specific skills. Used during /5:implement-feature CONFIGURE.
|
|
4
|
-
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
5
|
-
model: sonnet
|
|
6
|
-
context: fork
|
|
7
|
-
user-invocable: false
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Configure Project Skill
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
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.
|
|
15
|
-
|
|
16
|
-
It handles two distinct tasks, invoked with different parameters per component:
|
|
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
|
|
20
|
-
|
|
21
|
-
Note: config.json is written directly by `/5:configure` during the Q&A phase.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Modes
|
|
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.
|
|
28
|
-
|
|
29
|
-
### Full Mode (default)
|
|
30
|
-
|
|
31
|
-
Used by `/5:configure` → `/5:implement-feature CONFIGURE` flow.
|
|
32
|
-
|
|
33
|
-
- **Input:** Pattern/command selections from feature spec (`.5/features/CONFIGURE/feature.md`)
|
|
34
|
-
- **Behavior:** Creates everything from scratch based on feature spec requirements
|
|
35
|
-
|
|
36
|
-
### Refresh Mode
|
|
37
|
-
|
|
38
|
-
Used by `/5:reconfigure` for lightweight refresh.
|
|
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
|
|
42
|
-
- **Trigger:** Task prompt includes "REFRESH MODE"
|
|
43
|
-
|
|
44
|
-
In both modes, the analysis and generation logic is identical — only where the skill list comes from differs.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## A. Analyze Codebase and Create/Update CLAUDE.md
|
|
49
|
-
|
|
50
|
-
**Process:**
|
|
51
|
-
|
|
52
|
-
### A1. Unified Codebase Analysis
|
|
53
|
-
|
|
54
|
-
Perform comprehensive analysis once to gather data for ALL templates:
|
|
55
|
-
|
|
56
|
-
**Structure Analysis** (for STRUCTURE.md):
|
|
57
|
-
- Use Glob to map directory tree: `**/*` (with depth limits to avoid overwhelming results)
|
|
58
|
-
- Identify source directories (`src/`, `lib/`, `app/`, etc.)
|
|
59
|
-
- Identify test directories and their organization
|
|
60
|
-
- Identify configuration directories
|
|
61
|
-
- Determine file naming conventions (camelCase, kebab-case, PascalCase)
|
|
62
|
-
- Locate key files (entry points, configurations)
|
|
63
|
-
|
|
64
|
-
**Stack Analysis** (for STACK.md):
|
|
65
|
-
- Read package manifests: `package.json`, `Cargo.toml`, `go.mod`, `pom.xml`, `requirements.txt`, `Gemfile`
|
|
66
|
-
- Extract: language, version, runtime, package manager
|
|
67
|
-
- Identify frameworks in dependencies (React, Express, Django, Rails, etc.)
|
|
68
|
-
- List critical dependencies and their versions
|
|
69
|
-
- Find config files: `tsconfig.json`, `.eslintrc`, etc.
|
|
70
|
-
|
|
71
|
-
**Architecture Analysis** (for ARCHITECTURE.md):
|
|
72
|
-
- Identify architectural pattern (MVC, layered, modular, microservices) from directory structure
|
|
73
|
-
- Map layers by directory structure (controllers/, services/, models/, routes/, etc.)
|
|
74
|
-
- Trace data flow patterns (read 2-3 example files from different layers)
|
|
75
|
-
- Identify key abstractions (interfaces, base classes, common patterns)
|
|
76
|
-
- Find entry points (`index.ts`, `main.go`, `app.py`, `server.js`)
|
|
77
|
-
- Analyze error handling strategy (try/catch, Result types, middleware, error boundaries)
|
|
78
|
-
|
|
79
|
-
**Conventions Analysis** (for CONVENTIONS.md):
|
|
80
|
-
- Sample 5-10 files from main source directory
|
|
81
|
-
- Extract naming patterns: files, functions, variables, types/classes
|
|
82
|
-
- Find formatters/linters: `.prettierrc`, `.eslintrc`, `black.toml`, `.rubocop.yml`
|
|
83
|
-
- Identify import organization patterns (order, grouping, aliases)
|
|
84
|
-
- Determine logging approach (console, winston, log4j, etc.)
|
|
85
|
-
- Check comment/documentation patterns (JSDoc, Javadoc, etc.)
|
|
86
|
-
|
|
87
|
-
**Testing Analysis** (for TESTING.md):
|
|
88
|
-
- Find test files: `**/*.test.{ts,js}`, `**/*.spec.{ts,js}`, `**/*_test.go`, `test_*.py`, `*_spec.rb`
|
|
89
|
-
- Read test config: `jest.config.js`, `vitest.config.ts`, `pytest.ini`, `spec/spec_helper.rb`
|
|
90
|
-
- Determine test organization (co-located vs separate `test/` or `spec/`)
|
|
91
|
-
- Extract test naming patterns
|
|
92
|
-
- Identify mocking framework (jest.mock, sinon, pytest-mock, etc.)
|
|
93
|
-
- Find fixture/factory patterns
|
|
94
|
-
- Extract test run commands from package.json, Makefile, or similar
|
|
95
|
-
|
|
96
|
-
**Integration Analysis** (for INTEGRATIONS.md):
|
|
97
|
-
- Scan dependencies for SDK packages (axios, @aws-sdk, stripe, @google-cloud, etc.)
|
|
98
|
-
- Identify database clients/ORMs (prisma, mongoose, sqlalchemy, activerecord, etc.)
|
|
99
|
-
- Find auth providers (passport, next-auth, devise, etc.)
|
|
100
|
-
- Detect monitoring/logging services (datadog, sentry, newrelic)
|
|
101
|
-
- Read CI/CD config: `.github/workflows/`, `.gitlab-ci.yml`, `.circleci/config.yml`
|
|
102
|
-
- Grep for environment variables: `process.env`, `os.getenv`, `ENV[`, etc.
|
|
103
|
-
|
|
104
|
-
**Concerns Analysis** (for CONCERNS.md):
|
|
105
|
-
- Grep for TODO/FIXME/HACK/XXX/DEPRECATED comments across all code
|
|
106
|
-
- Check for common security issues (SQL injection patterns, XSS vulnerabilities)
|
|
107
|
-
- Identify deprecated dependencies (check for warnings in package manifests)
|
|
108
|
-
- Look for complex code sections (deeply nested conditionals, long functions)
|
|
109
|
-
|
|
110
|
-
### A2. Fill Templates
|
|
111
|
-
|
|
112
|
-
For each template in `src/templates/`:
|
|
113
|
-
|
|
114
|
-
1. Read template content with Read tool
|
|
115
|
-
2. Replace placeholders with analyzed data:
|
|
116
|
-
- Date placeholders: `{YYYY-MM-DD}`, `{date}` → current date (format: YYYY-MM-DD)
|
|
117
|
-
- Template-specific placeholders → actual project data from B1 analysis
|
|
118
|
-
3. Handle missing data gracefully: mark sections as "Not detected" or "None found" rather than omitting
|
|
119
|
-
|
|
120
|
-
**Placeholder mapping examples**:
|
|
121
|
-
|
|
122
|
-
ARCHITECTURE.md:
|
|
123
|
-
- `{Pattern name}` → "Layered Architecture" or "MVC" or "Modular Monolith"
|
|
124
|
-
- `{Layer Name}` → "Controllers", "Services", "Repositories"
|
|
125
|
-
- `{path}` → "src/controllers/", "src/services/"
|
|
126
|
-
|
|
127
|
-
STACK.md:
|
|
128
|
-
- `{Language} {Version}` → "TypeScript 5.3.3", "Python 3.11"
|
|
129
|
-
- `{Framework} {Version}` → "Express 4.18.2", "Django 4.2"
|
|
130
|
-
- `{Package} {Version}` → "axios 1.6.0"
|
|
131
|
-
|
|
132
|
-
CONVENTIONS.md:
|
|
133
|
-
- `{Pattern observed}` → "PascalCase for classes, camelCase for functions"
|
|
134
|
-
- `{Tool used}` → "Prettier with 2-space indent"
|
|
135
|
-
|
|
136
|
-
TESTING.md:
|
|
137
|
-
- `{Framework} {Version}` → "Jest 29.5.0"
|
|
138
|
-
- `{command}` → "npm test", "pytest"
|
|
139
|
-
|
|
140
|
-
INTEGRATIONS.md:
|
|
141
|
-
- `{Service}` → "PostgreSQL", "Stripe API"
|
|
142
|
-
- `{package}` → "@stripe/stripe-js"
|
|
143
|
-
|
|
144
|
-
CONCERNS.md:
|
|
145
|
-
- `{file paths}` → Actual file paths from grep results
|
|
146
|
-
|
|
147
|
-
### A3. Write Documentation Files
|
|
148
|
-
|
|
149
|
-
Write filled templates to `.5/` folder:
|
|
150
|
-
|
|
151
|
-
1. Ensure `.5/` directory exists: `mkdir -p .5`
|
|
152
|
-
2. Write each filled template:
|
|
153
|
-
- `.5/ARCHITECTURE.md`
|
|
154
|
-
- `.5/STACK.md`
|
|
155
|
-
- `.5/STRUCTURE.md`
|
|
156
|
-
- `.5/CONVENTIONS.md`
|
|
157
|
-
- `.5/TESTING.md`
|
|
158
|
-
- `.5/INTEGRATIONS.md`
|
|
159
|
-
- `.5/CONCERNS.md`
|
|
160
|
-
|
|
161
|
-
### A4. Create Master CLAUDE.md
|
|
162
|
-
|
|
163
|
-
Generate CLAUDE.md as a navigation hub:
|
|
164
|
-
|
|
165
|
-
CLAUDE.md structure:
|
|
166
|
-
- **Quick Reference:** Links to all 7 `.5/*.md` files (STACK, STRUCTURE, ARCHITECTURE, CONVENTIONS, TESTING, INTEGRATIONS, CONCERNS)
|
|
167
|
-
- **Project Overview:** 1-2 paragraphs from README/package.json
|
|
168
|
-
- **Build & Run Commands:** Build, test, and other detected commands
|
|
169
|
-
- **Workflow Rules:** Include this section verbatim:
|
|
170
|
-
```
|
|
171
|
-
## Workflow Rules
|
|
172
|
-
When running `/5:` workflow commands, follow the command instructions exactly as written.
|
|
173
|
-
Do not skip steps, combine phases, or proceed to actions not specified in the current command.
|
|
174
|
-
Each phase produces a specific artifact — do not create artifacts belonging to other phases.
|
|
175
|
-
```
|
|
176
|
-
- **Coding Guidelines:** The 6 mandatory principles (types, concise docs, short files, extract methods, SRP/DRY, maintainable/modular)
|
|
177
|
-
- **Getting Started:** Links to relevant `.5/` files for new devs and specific tasks
|
|
178
|
-
|
|
179
|
-
### A5. Preserve Existing Content
|
|
180
|
-
|
|
181
|
-
If CLAUDE.md already exists:
|
|
182
|
-
- Read current content
|
|
183
|
-
- Identify user-written custom sections (not matching template structure)
|
|
184
|
-
- Preserve under "Custom Documentation" section in new CLAUDE.md
|
|
185
|
-
- Ensure 6 mandatory coding guidelines are retained
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
## B. Generate Project-Specific Skills
|
|
190
|
-
|
|
191
|
-
### Using skill-creator plugin
|
|
192
|
-
|
|
193
|
-
If `tools.skillCreator.available` is `true` in `.5/config.json`, use the skill-creator plugin's tools (e.g., `create-skill`, `scaffold-skill`) to generate each SKILL.md instead of the template-based approach below. Pass the extracted patterns, conventions, and example file paths as context to the skill-creator tool so it can produce structured, high-quality skill files.
|
|
194
|
-
|
|
195
|
-
If skill-creator is not available, use the existing template-based generation below — no degradation in workflow behavior.
|
|
196
|
-
|
|
197
|
-
**Reads:** Pattern selections from feature spec (`.5/CONFIGURE/feature.md`)
|
|
198
|
-
|
|
199
|
-
**Creates:** SKILL.md files in `.claude/skills/{name}/SKILL.md`
|
|
200
|
-
|
|
201
|
-
### Pattern-Based Skill Generation
|
|
202
|
-
|
|
203
|
-
Skills are determined by what patterns exist in the codebase (detected during `/5:configure`) and what the user selected—NOT by project type.
|
|
204
|
-
|
|
205
|
-
For EACH pattern selected by the user in the feature spec:
|
|
206
|
-
|
|
207
|
-
1. **Find examples** - Read 2-3 files from the pattern's location
|
|
208
|
-
2. **Extract conventions:**
|
|
209
|
-
- File naming (PascalCase, kebab-case, suffix patterns)
|
|
210
|
-
- Directory structure (flat, nested, co-located tests)
|
|
211
|
-
- Import patterns (absolute, relative, aliases)
|
|
212
|
-
- Export patterns (default, named, barrel files)
|
|
213
|
-
- Common boilerplate (decorators, annotations, base classes)
|
|
214
|
-
3. **Generate SKILL.md** with:
|
|
215
|
-
- Detected conventions as instructions
|
|
216
|
-
- Template derived from actual code
|
|
217
|
-
- Checklist based on common elements found
|
|
218
|
-
|
|
219
|
-
### Skill Template Structure
|
|
220
|
-
|
|
221
|
-
For each skill, create `.claude/skills/create-{pattern}/SKILL.md`:
|
|
222
|
-
|
|
223
|
-
```yaml
|
|
224
|
-
---
|
|
225
|
-
name: create-{pattern}
|
|
226
|
-
description: Creates a {Pattern} following project conventions at {location}.
|
|
227
|
-
allowed-tools: Read, Write, Glob, Grep
|
|
228
|
-
model: haiku
|
|
229
|
-
context: fork
|
|
230
|
-
user-invocable: true
|
|
231
|
-
---
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
```markdown
|
|
235
|
-
# Create {Pattern}
|
|
236
|
-
|
|
237
|
-
## What This Skill Creates
|
|
238
|
-
A {pattern} following this project's conventions.
|
|
239
|
-
|
|
240
|
-
## Detected Conventions
|
|
241
|
-
- **Location:** {detected-location}
|
|
242
|
-
- **Naming:** {detected-naming-pattern}
|
|
243
|
-
- **Structure:** {detected-structure}
|
|
244
|
-
- **Imports:** {detected-import-pattern}
|
|
245
|
-
|
|
246
|
-
## Template
|
|
247
|
-
Based on {example-file}, new {patterns} should follow:
|
|
248
|
-
|
|
249
|
-
\`\`\`{language}
|
|
250
|
-
{template-derived-from-analysis}
|
|
251
|
-
\`\`\`
|
|
252
|
-
|
|
253
|
-
## Checklist
|
|
254
|
-
- [ ] File created at correct location
|
|
255
|
-
- [ ] Naming convention followed
|
|
256
|
-
- [ ] Required imports added
|
|
257
|
-
- [ ] {pattern-specific-items}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Pattern to Skill Name Mapping
|
|
261
|
-
|
|
262
|
-
**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`.
|
|
263
|
-
|
|
264
|
-
---
|
|
265
|
-
|
|
266
|
-
## B2. Generate Command Skills (run-*)
|
|
267
|
-
|
|
268
|
-
**Reads:** Command selections from feature spec (`.5/CONFIGURE/feature.md`)
|
|
269
|
-
|
|
270
|
-
**Creates:** SKILL.md files in `.claude/skills/run-{command}/SKILL.md`
|
|
271
|
-
|
|
272
|
-
### Command-Based Skill Generation
|
|
273
|
-
|
|
274
|
-
For EACH command selected by the user in the feature spec:
|
|
275
|
-
|
|
276
|
-
1. **Read the source** - Check package.json scripts, Makefile, etc.
|
|
277
|
-
2. **Document the command:**
|
|
278
|
-
- Exact command syntax
|
|
279
|
-
- Available variants (e.g., test:unit, test:e2e)
|
|
280
|
-
- Common flags and options
|
|
281
|
-
- Expected output format
|
|
282
|
-
3. **Generate SKILL.md** with:
|
|
283
|
-
- Command execution instructions
|
|
284
|
-
- Output parsing guidance
|
|
285
|
-
- Error handling patterns
|
|
286
|
-
|
|
287
|
-
### Command Skill Template Structure
|
|
288
|
-
|
|
289
|
-
For each skill, create `.claude/skills/run-{command}/SKILL.md`:
|
|
290
|
-
|
|
291
|
-
```yaml
|
|
292
|
-
---
|
|
293
|
-
name: run-{command}
|
|
294
|
-
description: Runs {command} for this project using {source}.
|
|
295
|
-
allowed-tools: Bash
|
|
296
|
-
model: haiku
|
|
297
|
-
context: fork
|
|
298
|
-
user-invocable: true
|
|
299
|
-
---
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
```markdown
|
|
303
|
-
# Run {Command}
|
|
304
|
-
|
|
305
|
-
## What This Skill Does
|
|
306
|
-
Executes the project's {command} command.
|
|
307
|
-
|
|
308
|
-
## Command
|
|
309
|
-
\`\`\`bash
|
|
310
|
-
{exact-command}
|
|
311
|
-
\`\`\`
|
|
312
|
-
|
|
313
|
-
## Variants
|
|
314
|
-
{if variants exist}
|
|
315
|
-
- `{variant1}` - {description}
|
|
316
|
-
- `{variant2}` - {description}
|
|
317
|
-
|
|
318
|
-
## Common Options
|
|
319
|
-
- `--watch` - Run in watch mode (if available)
|
|
320
|
-
- `--coverage` - Generate coverage report (for tests)
|
|
321
|
-
- `--fix` - Auto-fix issues (for lint/format)
|
|
322
|
-
|
|
323
|
-
## Expected Output
|
|
324
|
-
{describe what success/failure looks like}
|
|
325
|
-
|
|
326
|
-
## Error Handling
|
|
327
|
-
- If command fails, report the error output
|
|
328
|
-
- Common issues: {list common problems and solutions}
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Command to Skill Name Mapping
|
|
332
|
-
|
|
333
|
-
**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.
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## C. Generate Scoped Rules
|
|
338
|
-
|
|
339
|
-
If `rules.generate` is `true` in `.5/config.json`, generate `.claude/rules/` files with project-specific conventions scoped to relevant file types.
|
|
340
|
-
|
|
341
|
-
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.
|
|
342
|
-
|
|
343
|
-
### C1. Determine Which Rules to Generate
|
|
344
|
-
|
|
345
|
-
Based on the A1 analysis results, determine which rules apply:
|
|
346
|
-
|
|
347
|
-
| Rule File | Generate When | Source Analysis |
|
|
348
|
-
|-----------|---------------|-----------------|
|
|
349
|
-
| `code-style.md` | Always (if source files exist) | Conventions Analysis |
|
|
350
|
-
| `testing.md` | Test files detected | Testing Analysis |
|
|
351
|
-
| `api-patterns.md` | Controller/route/handler patterns detected | Architecture Analysis |
|
|
352
|
-
| `dependencies.md` | External integrations detected | Integration Analysis |
|
|
353
|
-
|
|
354
|
-
**Skip** any rule whose prerequisite patterns were not detected. Do NOT generate empty or placeholder rule files.
|
|
355
|
-
|
|
356
|
-
### C2. Extract Directives and Write Rules
|
|
357
|
-
|
|
358
|
-
For each applicable rule:
|
|
359
|
-
|
|
360
|
-
1. **Derive `paths:` globs** from detected file locations (e.g., if tests are at `src/**/*.test.ts` and `tests/**/*.spec.ts`, use those patterns)
|
|
361
|
-
2. **Convert analysis observations into imperative directives** — "Use X", "Always Y", "Never Z"
|
|
362
|
-
3. **Keep each file 15-40 lines** — be concise and actionable
|
|
363
|
-
4. **Do NOT repeat** the 6 mandatory coding guidelines from CLAUDE.md
|
|
364
|
-
|
|
365
|
-
Write files to `.claude/rules/`:
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
mkdir -p .claude/rules
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
### C3. Rule File Format
|
|
372
|
-
|
|
373
|
-
Each rule file uses YAML frontmatter with `paths:` for scoping. Rules without `paths:` load unconditionally.
|
|
374
|
-
|
|
375
|
-
**Example — `testing.md`:**
|
|
376
|
-
|
|
377
|
-
```markdown
|
|
378
|
-
---
|
|
379
|
-
paths:
|
|
380
|
-
- "**/*.test.ts"
|
|
381
|
-
- "**/*.spec.ts"
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
# Testing Conventions
|
|
385
|
-
|
|
386
|
-
- Use `describe`/`it` blocks with descriptive names
|
|
387
|
-
- Mock external dependencies with jest.mock, never mock internal modules
|
|
388
|
-
- Use factory functions from `tests/factories/` for test data
|
|
389
|
-
- Each test file mirrors its source file path: `src/foo/Bar.ts` → `src/foo/__tests__/Bar.test.ts`
|
|
390
|
-
- Assert one behavior per test
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**Example — `code-style.md`:**
|
|
394
|
-
|
|
395
|
-
```markdown
|
|
396
|
-
---
|
|
397
|
-
paths:
|
|
398
|
-
- "src/**/*.{ts,tsx}"
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
# Code Style
|
|
402
|
-
|
|
403
|
-
- Use PascalCase for classes and types, camelCase for functions and variables
|
|
404
|
-
- Import order: external packages → internal modules → relative imports
|
|
405
|
-
- Use absolute imports with `@/` alias
|
|
406
|
-
- Prefer named exports over default exports
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
**Example — `dependencies.md` (unconditional):**
|
|
410
|
-
|
|
411
|
-
```markdown
|
|
412
|
-
# Dependency Conventions
|
|
413
|
-
|
|
414
|
-
- Database access through Prisma client only, never raw SQL
|
|
415
|
-
- HTTP requests use axios instance from `src/lib/http.ts`
|
|
416
|
-
- Environment variables accessed via `src/config/env.ts`, never `process.env` directly
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
### Refresh Mode Behavior for Rules
|
|
420
|
-
|
|
421
|
-
When running in REFRESH MODE:
|
|
422
|
-
- Re-analyze codebase and overwrite all existing rule files with updated directives
|
|
423
|
-
- Remove rule files for patterns no longer detected in the codebase
|
|
424
|
-
- Create new rule files if new patterns are detected that weren't present before
|
|
425
|
-
|
|
426
|
-
---
|
|
427
|
-
|
|
428
|
-
## Output Contract
|
|
429
|
-
|
|
430
|
-
Returns structured results for each component:
|
|
431
|
-
|
|
432
|
-
```
|
|
433
|
-
Component A (Documentation): SUCCESS - Created 7 documentation files + index
|
|
434
|
-
- .5/ARCHITECTURE.md (Pattern: Layered, 4 layers identified)
|
|
435
|
-
- .5/STACK.md (TypeScript + Express, 23 dependencies)
|
|
436
|
-
- .5/STRUCTURE.md (8 top-level directories mapped)
|
|
437
|
-
- .5/CONVENTIONS.md (PascalCase/camelCase, Prettier formatting)
|
|
438
|
-
- .5/TESTING.md (Jest framework, 45 test files)
|
|
439
|
-
- .5/INTEGRATIONS.md (PostgreSQL, 2 APIs, GitHub Actions)
|
|
440
|
-
- .5/CONCERNS.md (3 TODO items, 1 deprecated dependency)
|
|
441
|
-
- CLAUDE.md (index with references)
|
|
442
|
-
Component B (Pattern Skills): SUCCESS - Generated 3 create-* skills (create-component, create-hook, create-context)
|
|
443
|
-
Component C (Command Skills): SUCCESS - Generated 2 run-* skills (run-tests, run-lint)
|
|
444
|
-
Component D (Rules): SUCCESS - Generated 3 rule files (code-style, testing, dependencies)
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
Or on failure:
|
|
448
|
-
|
|
449
|
-
```
|
|
450
|
-
Component A (Documentation): FAILED - Unable to read template files
|
|
451
|
-
Component B (Pattern Skills): FAILED - No patterns found in codebase
|
|
452
|
-
Component D (Rules): SKIPPED - rules.generate is false in config
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
## DO NOT
|
|
456
|
-
|
|
457
|
-
- DO NOT overwrite existing user-written CLAUDE.md sections
|
|
458
|
-
- DO NOT generate skills for patterns that don't exist in the project
|
|
459
|
-
- DO NOT generate command skills for commands that don't exist in the project
|
|
460
|
-
- DO NOT generate rules for patterns not detected in the codebase
|
|
461
|
-
- DO NOT include `steps` in config.json
|
|
462
|
-
- DO NOT hardcode conventions - always derive from actual project analysis
|
|
463
|
-
- DO NOT generate empty or placeholder skill or rule files
|
|
464
|
-
- DO NOT assume command syntax - always read from actual config files (package.json, Makefile, etc.)
|
|
465
|
-
- DO NOT repeat the 6 mandatory coding guidelines from CLAUDE.md in rule files
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: run-tests
|
|
3
|
-
description: Executes tests using auto-detected or configured test runner. Supports jest, pytest, cargo test, go test, gradle, maven, and more. Use when running tests, verifying test results, or checking test status.
|
|
4
|
-
allowed-tools: Bash, Read, Grep
|
|
5
|
-
model: sonnet
|
|
6
|
-
context: fork
|
|
7
|
-
user-invocable: true
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Run Tests
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
This skill executes test tasks with auto-detection of the test runner and sufficient timeout for long-running test suites. It provides structured test result reporting and actionable suggestions when tests fail.
|
|
15
|
-
|
|
16
|
-
## Test Runner Detection
|
|
17
|
-
|
|
18
|
-
The skill automatically detects the test runner using:
|
|
19
|
-
|
|
20
|
-
1. **Config file** (`.5/config.json`) - if `build.testCommand` is specified
|
|
21
|
-
2. **Auto-detection** - by examining project files and package.json scripts:
|
|
22
|
-
- `package.json` with jest/vitest/mocha → npm test
|
|
23
|
-
- `pytest.ini` or test files → pytest
|
|
24
|
-
- `Cargo.toml` → cargo test
|
|
25
|
-
- `go.mod` → go test
|
|
26
|
-
- `build.gradle` → gradle test
|
|
27
|
-
- `pom.xml` → mvn test
|
|
28
|
-
|
|
29
|
-
## Test Targets
|
|
30
|
-
|
|
31
|
-
| Target | Use Case |
|
|
32
|
-
|--------|----------|
|
|
33
|
-
| `all` | Run all tests in all modules |
|
|
34
|
-
| `module` | Run all tests in a specific module |
|
|
35
|
-
| `file` | Run tests in a specific file |
|
|
36
|
-
| `test` | Run a specific test by name |
|
|
37
|
-
|
|
38
|
-
## Parameters
|
|
39
|
-
|
|
40
|
-
When invoked, the skill expects:
|
|
41
|
-
|
|
42
|
-
- **target** (optional, default: `all`): One of `all`, `module`, `file`, `test`
|
|
43
|
-
- **module** (optional): Module name (for monorepos)
|
|
44
|
-
- **file** (optional): Test file path (for `file` target)
|
|
45
|
-
- **test** (optional): Specific test name (for `test` target)
|
|
46
|
-
- **pattern** (optional): Test name pattern/filter
|
|
47
|
-
|
|
48
|
-
## Execution Process
|
|
49
|
-
|
|
50
|
-
### 1. Load Configuration
|
|
51
|
-
|
|
52
|
-
Read `.5/config.json` if it exists:
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{
|
|
56
|
-
"build": {
|
|
57
|
-
"testCommand": "npm test",
|
|
58
|
-
"testFileCommand": "npm test -- {{file}}",
|
|
59
|
-
"testNameCommand": "npm test -- -t {{name}}"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
If commands are specified, use them with variable substitution. Otherwise, auto-detect.
|
|
65
|
-
|
|
66
|
-
### 2. Detect Test Runner
|
|
67
|
-
|
|
68
|
-
If no config, detect by checking project files: `package.json` (jest/vitest/mocha), `pytest.ini`/test files (pytest), `Cargo.toml` (cargo), `go.mod` (go), `build.gradle` (gradle), `pom.xml` (mvn).
|
|
69
|
-
|
|
70
|
-
### 3. Determine Test Command
|
|
71
|
-
|
|
72
|
-
Based on detected runner and target:
|
|
73
|
-
|
|
74
|
-
| Runner | all | module | file | test |
|
|
75
|
-
|--------|-----|--------|------|------|
|
|
76
|
-
| npm | `npm test` | `npm test -- {module}` | `npm test -- {file}` | `npm test -- -t "{name}"` |
|
|
77
|
-
| jest | `jest` | `jest {module}` | `jest {file}` | `jest -t "{name}"` |
|
|
78
|
-
| vitest | `vitest run` | `vitest run {module}` | `vitest run {file}` | `vitest run -t "{name}"` |
|
|
79
|
-
| pytest | `pytest` | `pytest {module}` | `pytest {file}` | `pytest -k "{name}"` |
|
|
80
|
-
| cargo | `cargo test` | `cargo test -p {module}` | N/A | `cargo test {name}` |
|
|
81
|
-
| go | `go test ./...` | `go test ./{module}/...` | `go test {file}` | `go test -run {name}` |
|
|
82
|
-
| gradle | `./gradlew test --offline` | `./gradlew :{module}:test --offline` | N/A | `./gradlew test --tests {name} --offline` |
|
|
83
|
-
| mvn | `mvn test` | `mvn test -pl {module}` | `mvn test -Dtest={ClassName}` | `mvn test -Dtest={ClassName}#{method}` |
|
|
84
|
-
|
|
85
|
-
### 4. Execute Tests with Proper Timeout
|
|
86
|
-
|
|
87
|
-
**IMPORTANT**: Test suites can take several minutes. Use generous timeout:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Timeout based on target:
|
|
91
|
-
# - single test: 1 minute (60000ms)
|
|
92
|
-
# - file: 5 minutes (300000ms)
|
|
93
|
-
# - module: 10 minutes (600000ms)
|
|
94
|
-
# - all: 15 minutes (900000ms)
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Execute the command and capture output.
|
|
98
|
-
|
|
99
|
-
### 5. Parse Test Output
|
|
100
|
-
|
|
101
|
-
Parse runner-specific output to extract: total tests, passed, failed, skipped, duration, and failed test names with error messages and file/line info.
|
|
102
|
-
|
|
103
|
-
### 6. Format Output
|
|
104
|
-
|
|
105
|
-
Provide structured response:
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
TEST STATUS: ✓ PASSED | ✗ FAILED | ⚠ PARTIAL
|
|
109
|
-
DURATION: 1m 23s
|
|
110
|
-
RUNNER: {detected-runner}
|
|
111
|
-
TARGET: {target type}
|
|
112
|
-
MODULE: {module or "all"}
|
|
113
|
-
|
|
114
|
-
SUMMARY:
|
|
115
|
-
- {N} tests total
|
|
116
|
-
- {N} passed
|
|
117
|
-
- {N} failed
|
|
118
|
-
- {N} skipped
|
|
119
|
-
|
|
120
|
-
FAILED TESTS: (if any)
|
|
121
|
-
|
|
122
|
-
1. {TestSuite} › {test name}
|
|
123
|
-
File: path/to/file.test.ext:42
|
|
124
|
-
Error: {error message}
|
|
125
|
-
|
|
126
|
-
2. {Another test}
|
|
127
|
-
File: path/to/another.test.ext:15
|
|
128
|
-
Error: {error message}
|
|
129
|
-
|
|
130
|
-
SUGGESTIONS:
|
|
131
|
-
- Review failed test assertions
|
|
132
|
-
- Check test fixtures and mocks
|
|
133
|
-
- Run specific failed tests individually to debug
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Error Handling
|
|
137
|
-
|
|
138
|
-
- If test runner cannot be detected, return error with detection attempted
|
|
139
|
-
- If command times out, report timeout with suggestion
|
|
140
|
-
- Always include failed test details with file locations
|
|
141
|
-
- If no tests found, report warning (not error)
|
|
142
|
-
- Include suggestion to check test file patterns
|
|
143
|
-
|
|
144
|
-
## DO NOT
|
|
145
|
-
|
|
146
|
-
- DO NOT modify source or test files
|
|
147
|
-
- DO NOT retry failed tests automatically (user decides)
|
|
148
|
-
- DO NOT run build before tests (use `/build-project` first if needed)
|
|
149
|
-
- DO NOT assume a specific test framework - always detect or use config
|
|
150
|
-
- DO NOT truncate test output too aggressively (users need full error messages)
|
|
151
|
-
|
|
152
|
-
## Example
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
User: /run-tests
|
|
156
|
-
Skill: [Detects jest] → [Runs: jest] → [Reports: 47 passed, 0 failed]
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Related Documentation
|
|
160
|
-
|
|
161
|
-
- [5-Phase Workflow Guide](../../docs/workflow-guide.md)
|
|
162
|
-
- [/build-project skill](../build-project/SKILL.md)
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Coding Conventions
|
|
2
|
-
|
|
3
|
-
**Analysis Date:** {YYYY-MM-DD}
|
|
4
|
-
|
|
5
|
-
## Naming Patterns
|
|
6
|
-
|
|
7
|
-
**Files:**
|
|
8
|
-
- {Pattern observed}
|
|
9
|
-
|
|
10
|
-
**Functions:**
|
|
11
|
-
- {Pattern observed}
|
|
12
|
-
|
|
13
|
-
**Variables:**
|
|
14
|
-
- {Pattern observed}
|
|
15
|
-
|
|
16
|
-
**Types:**
|
|
17
|
-
- {Pattern observed}
|
|
18
|
-
|
|
19
|
-
## Code Style
|
|
20
|
-
|
|
21
|
-
**Formatting:**
|
|
22
|
-
- {Tool used}
|
|
23
|
-
- {Key settings}
|
|
24
|
-
|
|
25
|
-
**Linting:**
|
|
26
|
-
- {Tool used}
|
|
27
|
-
- {Key rules}
|
|
28
|
-
|
|
29
|
-
## Import Organization
|
|
30
|
-
|
|
31
|
-
**Order:**
|
|
32
|
-
1. {First group}
|
|
33
|
-
2. {Second group}
|
|
34
|
-
3. {Third group}
|
|
35
|
-
|
|
36
|
-
**Path Aliases:**
|
|
37
|
-
- {Aliases used}
|
|
38
|
-
|
|
39
|
-
## Error Handling
|
|
40
|
-
|
|
41
|
-
**Patterns:**
|
|
42
|
-
- {How errors are handled}
|
|
43
|
-
|
|
44
|
-
## Logging
|
|
45
|
-
|
|
46
|
-
**Framework:** {Tool or "console"}
|
|
47
|
-
|
|
48
|
-
**Patterns:**
|
|
49
|
-
- {When/how to log}
|
|
50
|
-
|
|
51
|
-
## Comments
|
|
52
|
-
|
|
53
|
-
**When to Comment:**
|
|
54
|
-
- {Guidelines observed}
|
|
55
|
-
|
|
56
|
-
**JSDoc/TSDoc:**
|
|
57
|
-
- {Usage pattern}
|
|
58
|
-
|
|
59
|
-
## Function Design
|
|
60
|
-
|
|
61
|
-
**Size:** {Guidelines}
|
|
62
|
-
|
|
63
|
-
**Parameters:** {Pattern}
|
|
64
|
-
|
|
65
|
-
**Return Values:** {Pattern}
|
|
66
|
-
|
|
67
|
-
## Module Design
|
|
68
|
-
|
|
69
|
-
**Exports:** {Pattern}
|
|
70
|
-
|
|
71
|
-
**Barrel Files:** {Usage}
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
*Convention analysis: {date}*
|