devflow-kit 1.0.0 → 1.2.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.
- package/CHANGELOG.md +69 -0
- package/README.md +35 -11
- package/dist/cli.js +5 -1
- package/dist/commands/ambient.d.ts +18 -0
- package/dist/commands/ambient.js +136 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +97 -10
- package/dist/commands/memory.d.ts +22 -0
- package/dist/commands/memory.js +175 -0
- package/dist/commands/uninstall.js +72 -5
- package/dist/plugins.js +74 -3
- package/dist/utils/post-install.d.ts +12 -0
- package/dist/utils/post-install.js +82 -1
- package/dist/utils/safe-delete-install.d.ts +7 -0
- package/dist/utils/safe-delete-install.js +40 -5
- package/package.json +2 -1
- package/plugins/devflow-accessibility/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-ambient/.claude-plugin/plugin.json +7 -0
- package/plugins/devflow-ambient/README.md +49 -0
- package/plugins/devflow-ambient/commands/ambient.md +110 -0
- package/plugins/devflow-ambient/skills/ambient-router/SKILL.md +89 -0
- package/plugins/devflow-ambient/skills/ambient-router/references/skill-catalog.md +68 -0
- package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-code-review/.claude-plugin/plugin.json +1 -4
- package/plugins/devflow-code-review/agents/reviewer.md +8 -0
- package/plugins/devflow-code-review/commands/code-review-teams.md +11 -1
- package/plugins/devflow-code-review/commands/code-review.md +12 -2
- package/plugins/devflow-core-skills/.claude-plugin/plugin.json +3 -6
- package/plugins/devflow-core-skills/skills/docs-framework/SKILL.md +10 -6
- package/plugins/devflow-core-skills/skills/test-driven-development/SKILL.md +139 -0
- package/plugins/devflow-core-skills/skills/test-driven-development/references/rationalization-prevention.md +111 -0
- package/plugins/devflow-debug/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-frontend-design/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-go/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-go/skills/go/SKILL.md +187 -0
- package/plugins/devflow-go/skills/go/references/concurrency.md +312 -0
- package/plugins/devflow-go/skills/go/references/detection.md +129 -0
- package/plugins/devflow-go/skills/go/references/patterns.md +232 -0
- package/plugins/devflow-go/skills/go/references/violations.md +205 -0
- package/plugins/devflow-implement/.claude-plugin/plugin.json +1 -3
- package/plugins/devflow-implement/agents/coder.md +11 -6
- package/plugins/devflow-java/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-java/skills/java/SKILL.md +183 -0
- package/plugins/devflow-java/skills/java/references/detection.md +120 -0
- package/plugins/devflow-java/skills/java/references/modern-java.md +270 -0
- package/plugins/devflow-java/skills/java/references/patterns.md +235 -0
- package/plugins/devflow-java/skills/java/references/violations.md +213 -0
- package/plugins/devflow-python/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-python/skills/python/SKILL.md +188 -0
- package/plugins/devflow-python/skills/python/references/async.md +220 -0
- package/plugins/devflow-python/skills/python/references/detection.md +128 -0
- package/plugins/devflow-python/skills/python/references/patterns.md +226 -0
- package/plugins/devflow-python/skills/python/references/violations.md +204 -0
- package/plugins/devflow-react/.claude-plugin/plugin.json +15 -0
- package/plugins/{devflow-core-skills → devflow-react}/skills/react/SKILL.md +1 -1
- package/plugins/{devflow-core-skills → devflow-react}/skills/react/references/patterns.md +3 -3
- package/plugins/devflow-resolve/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-rust/.claude-plugin/plugin.json +15 -0
- package/plugins/devflow-rust/skills/rust/SKILL.md +193 -0
- package/plugins/devflow-rust/skills/rust/references/detection.md +131 -0
- package/plugins/devflow-rust/skills/rust/references/ownership.md +242 -0
- package/plugins/devflow-rust/skills/rust/references/patterns.md +210 -0
- package/plugins/devflow-rust/skills/rust/references/violations.md +191 -0
- package/plugins/devflow-self-review/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-specify/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-typescript/.claude-plugin/plugin.json +15 -0
- package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/patterns.md +3 -3
- package/scripts/hooks/ambient-prompt.sh +48 -0
- package/scripts/hooks/background-memory-update.sh +49 -8
- package/scripts/hooks/ensure-memory-gitignore.sh +17 -0
- package/scripts/hooks/pre-compact-memory.sh +12 -6
- package/scripts/hooks/session-start-memory.sh +50 -8
- package/scripts/hooks/stop-update-memory.sh +10 -6
- package/shared/agents/coder.md +11 -6
- package/shared/agents/reviewer.md +8 -0
- package/shared/skills/ambient-router/SKILL.md +89 -0
- package/shared/skills/ambient-router/references/skill-catalog.md +68 -0
- package/shared/skills/docs-framework/SKILL.md +10 -6
- package/shared/skills/go/SKILL.md +187 -0
- package/shared/skills/go/references/concurrency.md +312 -0
- package/shared/skills/go/references/detection.md +129 -0
- package/shared/skills/go/references/patterns.md +232 -0
- package/shared/skills/go/references/violations.md +205 -0
- package/shared/skills/java/SKILL.md +183 -0
- package/shared/skills/java/references/detection.md +120 -0
- package/shared/skills/java/references/modern-java.md +270 -0
- package/shared/skills/java/references/patterns.md +235 -0
- package/shared/skills/java/references/violations.md +213 -0
- package/shared/skills/python/SKILL.md +188 -0
- package/shared/skills/python/references/async.md +220 -0
- package/shared/skills/python/references/detection.md +128 -0
- package/shared/skills/python/references/patterns.md +226 -0
- package/shared/skills/python/references/violations.md +204 -0
- package/shared/skills/react/SKILL.md +1 -1
- package/shared/skills/react/references/patterns.md +3 -3
- package/shared/skills/rust/SKILL.md +193 -0
- package/shared/skills/rust/references/detection.md +131 -0
- package/shared/skills/rust/references/ownership.md +242 -0
- package/shared/skills/rust/references/patterns.md +210 -0
- package/shared/skills/rust/references/violations.md +191 -0
- package/shared/skills/test-driven-development/SKILL.md +139 -0
- package/shared/skills/test-driven-development/references/rationalization-prevention.md +111 -0
- package/shared/skills/typescript/references/patterns.md +3 -3
- package/src/templates/managed-settings.json +14 -0
- package/plugins/devflow-code-review/skills/react/SKILL.md +0 -276
- package/plugins/devflow-code-review/skills/react/references/patterns.md +0 -1331
- package/plugins/devflow-core-skills/skills/accessibility/SKILL.md +0 -229
- package/plugins/devflow-core-skills/skills/accessibility/references/detection.md +0 -171
- package/plugins/devflow-core-skills/skills/accessibility/references/patterns.md +0 -670
- package/plugins/devflow-core-skills/skills/accessibility/references/violations.md +0 -419
- package/plugins/devflow-core-skills/skills/frontend-design/SKILL.md +0 -254
- package/plugins/devflow-core-skills/skills/frontend-design/references/detection.md +0 -184
- package/plugins/devflow-core-skills/skills/frontend-design/references/patterns.md +0 -511
- package/plugins/devflow-core-skills/skills/frontend-design/references/violations.md +0 -453
- package/plugins/devflow-core-skills/skills/react/references/violations.md +0 -565
- package/plugins/devflow-implement/skills/accessibility/SKILL.md +0 -229
- package/plugins/devflow-implement/skills/accessibility/references/detection.md +0 -171
- package/plugins/devflow-implement/skills/accessibility/references/patterns.md +0 -670
- package/plugins/devflow-implement/skills/accessibility/references/violations.md +0 -419
- package/plugins/devflow-implement/skills/frontend-design/SKILL.md +0 -254
- package/plugins/devflow-implement/skills/frontend-design/references/detection.md +0 -184
- package/plugins/devflow-implement/skills/frontend-design/references/patterns.md +0 -511
- package/plugins/devflow-implement/skills/frontend-design/references/violations.md +0 -453
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/SKILL.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/detection.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/patterns.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/violations.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/SKILL.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/detection.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/patterns.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/violations.md +0 -0
- /package/plugins/{devflow-code-review → devflow-react}/skills/react/references/violations.md +0 -0
- /package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/SKILL.md +0 -0
- /package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/violations.md +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# devflow-ambient
|
|
2
|
+
|
|
3
|
+
Ambient mode — auto-loads relevant skills based on each prompt, no explicit commands needed.
|
|
4
|
+
|
|
5
|
+
## Command
|
|
6
|
+
|
|
7
|
+
### `/ambient`
|
|
8
|
+
|
|
9
|
+
Classify user intent and apply proportional skill enforcement to any prompt.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/ambient add a login form # BUILD/STANDARD — loads TDD + implementation-patterns
|
|
13
|
+
/ambient fix the auth error # DEBUG/STANDARD — loads test-patterns + core-patterns
|
|
14
|
+
/ambient where is the config? # EXPLORE/QUICK — responds normally, zero overhead
|
|
15
|
+
/ambient refactor the auth system # BUILD/ESCALATE — suggests /implement
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Always-On Mode
|
|
19
|
+
|
|
20
|
+
Enable ambient classification on every prompt without typing `/ambient`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
devflow ambient --enable # Register UserPromptSubmit hook
|
|
24
|
+
devflow ambient --disable # Remove hook
|
|
25
|
+
devflow ambient --status # Check if enabled
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
When enabled, a `UserPromptSubmit` hook injects a classification preamble before every prompt. Slash commands (`/implement`, `/code-review`, etc.) and short confirmations ("yes", "ok") are skipped automatically.
|
|
29
|
+
|
|
30
|
+
## How It Works
|
|
31
|
+
|
|
32
|
+
1. **Classify intent** — BUILD, DEBUG, REVIEW, PLAN, EXPLORE, or CHAT
|
|
33
|
+
2. **Classify depth** — QUICK (zero overhead), STANDARD (2-3 skills), or ESCALATE (workflow nudge)
|
|
34
|
+
3. **Apply proportionally**:
|
|
35
|
+
- QUICK: respond normally
|
|
36
|
+
- STANDARD: load relevant skills, enforce TDD for BUILD
|
|
37
|
+
- ESCALATE: respond + recommend full workflow command
|
|
38
|
+
|
|
39
|
+
## Depth Tiers
|
|
40
|
+
|
|
41
|
+
| Depth | When | Overhead |
|
|
42
|
+
|-------|------|----------|
|
|
43
|
+
| QUICK | Chat, simple exploration, git/devops ops, single-word confirmations | ~0 tokens |
|
|
44
|
+
| STANDARD | BUILD/DEBUG/REVIEW/PLAN, 1-5 file scope | ~500-1000 tokens (skill reads) |
|
|
45
|
+
| ESCALATE | Multi-file, architectural, system-wide scope | ~0 extra tokens (nudge only) |
|
|
46
|
+
|
|
47
|
+
## Skills
|
|
48
|
+
|
|
49
|
+
- `ambient-router` — Intent + depth classification, skill selection matrix
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Ambient mode — classify intent and auto-load relevant skills for any prompt
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Ambient Command
|
|
6
|
+
|
|
7
|
+
Classify user intent and auto-load relevant skills. No agents spawned — enhances the main session only.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/ambient <prompt> Classify and respond with skill enforcement
|
|
13
|
+
/ambient Show usage
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Phases
|
|
17
|
+
|
|
18
|
+
### Phase 1: Load Router
|
|
19
|
+
|
|
20
|
+
Read the `ambient-router` skill:
|
|
21
|
+
- `~/.claude/skills/ambient-router/SKILL.md`
|
|
22
|
+
|
|
23
|
+
### Phase 2: Classify
|
|
24
|
+
|
|
25
|
+
Apply the ambient-router classification to `$ARGUMENTS`:
|
|
26
|
+
|
|
27
|
+
1. **Intent:** BUILD | DEBUG | REVIEW | PLAN | EXPLORE | CHAT
|
|
28
|
+
2. **Depth:** QUICK | STANDARD | ESCALATE
|
|
29
|
+
|
|
30
|
+
If no arguments provided, output:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
## Ambient Mode
|
|
34
|
+
|
|
35
|
+
Classify intent and auto-load relevant skills.
|
|
36
|
+
|
|
37
|
+
Usage: /ambient <your prompt>
|
|
38
|
+
|
|
39
|
+
Examples:
|
|
40
|
+
/ambient add a login form → BUILD/STANDARD (loads TDD + implementation-patterns)
|
|
41
|
+
/ambient fix the auth error → DEBUG/STANDARD (loads test-patterns + core-patterns)
|
|
42
|
+
/ambient where is the config? → EXPLORE/QUICK (responds normally)
|
|
43
|
+
/ambient refactor the auth system → BUILD/ESCALATE (suggests /implement)
|
|
44
|
+
|
|
45
|
+
Always-on: devflow ambient --enable
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then stop.
|
|
49
|
+
|
|
50
|
+
### Phase 3: State Classification
|
|
51
|
+
|
|
52
|
+
- **QUICK:** Skip this phase entirely. Respond directly in Phase 4.
|
|
53
|
+
- **STANDARD:** Output one line: `Ambient: {INTENT}/{DEPTH}. Loading: {skill1}, {skill2}.`
|
|
54
|
+
- **ESCALATE:** Skip — recommendation happens in Phase 4.
|
|
55
|
+
|
|
56
|
+
### Phase 4: Apply
|
|
57
|
+
|
|
58
|
+
**QUICK:**
|
|
59
|
+
Respond to the user's prompt normally. Zero skill loading. Zero overhead.
|
|
60
|
+
|
|
61
|
+
**STANDARD:**
|
|
62
|
+
Read the selected skills based on the ambient-router's skill selection matrix:
|
|
63
|
+
|
|
64
|
+
| Intent | Primary Skills | Secondary (conditional) |
|
|
65
|
+
|--------|---------------|------------------------|
|
|
66
|
+
| BUILD | test-driven-development, implementation-patterns | typescript (.ts), react (.tsx), frontend-design (CSS/UI), input-validation (forms/API), security-patterns (auth/crypto) |
|
|
67
|
+
| DEBUG | test-patterns, core-patterns | git-safety (if git ops) |
|
|
68
|
+
| REVIEW | self-review, core-patterns | test-patterns |
|
|
69
|
+
| PLAN | implementation-patterns | core-patterns |
|
|
70
|
+
|
|
71
|
+
Read up to 3 skills from `~/.claude/skills/{name}/SKILL.md`. Apply their patterns and constraints when responding to the user's prompt.
|
|
72
|
+
|
|
73
|
+
For BUILD intent: enforce RED-GREEN-REFACTOR from test-driven-development. Write failing tests before production code.
|
|
74
|
+
|
|
75
|
+
**ESCALATE:**
|
|
76
|
+
Respond to the user's prompt with your best effort, then append:
|
|
77
|
+
|
|
78
|
+
> This task spans multiple files/systems. Consider `/implement` for full lifecycle management (exploration → planning → implementation → review).
|
|
79
|
+
|
|
80
|
+
## Architecture
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
/ambient <prompt> (main session, no agents)
|
|
84
|
+
│
|
|
85
|
+
├─ Phase 1: Load ambient-router skill
|
|
86
|
+
├─ Phase 2: Classify intent + depth
|
|
87
|
+
├─ Phase 3: State classification (STANDARD only)
|
|
88
|
+
└─ Phase 4: Apply
|
|
89
|
+
├─ QUICK → respond directly
|
|
90
|
+
├─ STANDARD → load 2-3 skills, apply patterns, respond
|
|
91
|
+
└─ ESCALATE → respond + workflow nudge
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Edge Cases
|
|
95
|
+
|
|
96
|
+
| Case | Handling |
|
|
97
|
+
|------|----------|
|
|
98
|
+
| No arguments | Show usage and stop |
|
|
99
|
+
| Single word ("help") | Classify — likely CHAT/QUICK |
|
|
100
|
+
| Prompt references `/implement` etc. | Classify as normal — user chose /ambient intentionally |
|
|
101
|
+
| Mixed intent ("fix and add test") | Use higher-overhead intent (BUILD > DEBUG) |
|
|
102
|
+
| User says "no enforcement" | Respect immediately — treat as QUICK |
|
|
103
|
+
|
|
104
|
+
## Principles
|
|
105
|
+
|
|
106
|
+
1. **No agents** — Ambient enhances the main session, never spawns subagents
|
|
107
|
+
2. **Proportional** — QUICK gets zero overhead, STANDARD gets 2-3 skills, ESCALATE gets a nudge
|
|
108
|
+
3. **Transparent** — State classification for STANDARD/ESCALATE, silent for QUICK
|
|
109
|
+
4. **Respectful** — Never over-classify; when in doubt, go one tier lower
|
|
110
|
+
5. **TDD for BUILD** — STANDARD depth BUILD tasks enforce test-first workflow
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ambient-router
|
|
3
|
+
description: >-
|
|
4
|
+
Classify user intent and response depth for ambient mode. Auto-loads relevant
|
|
5
|
+
skills without explicit command invocation. Used by /ambient command and
|
|
6
|
+
always-on UserPromptSubmit hook.
|
|
7
|
+
user-invocable: false
|
|
8
|
+
allowed-tools: Read, Grep, Glob
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Ambient Router
|
|
12
|
+
|
|
13
|
+
Classify user intent and auto-load relevant skills. Zero overhead for simple requests, skill injection for substantive work, workflow nudges for complex tasks.
|
|
14
|
+
|
|
15
|
+
## Iron Law
|
|
16
|
+
|
|
17
|
+
> **PROPORTIONAL RESPONSE**
|
|
18
|
+
>
|
|
19
|
+
> Match effort to intent. Never apply heavyweight processes to lightweight requests.
|
|
20
|
+
> A chat question gets zero overhead. A 3-file feature gets 2-3 skills. A system
|
|
21
|
+
> refactor gets a nudge toward `/implement`. Misclassification in either direction
|
|
22
|
+
> is a failure.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Step 1: Classify Intent
|
|
27
|
+
|
|
28
|
+
Determine what the user is trying to do from their prompt.
|
|
29
|
+
|
|
30
|
+
| Intent | Signal Words / Patterns | Examples |
|
|
31
|
+
|--------|------------------------|---------|
|
|
32
|
+
| **BUILD** | "add", "create", "implement", "build", "write", "make" | "add a login form", "create an API endpoint" |
|
|
33
|
+
| **DEBUG** | "fix", "bug", "broken", "failing", "error", "why does" | "fix the auth error", "why is this test failing" |
|
|
34
|
+
| **REVIEW** | "check", "look at", "review", "is this ok", "any issues" | "check this function", "any issues with this?" |
|
|
35
|
+
| **PLAN** | "how should", "design", "architecture", "approach", "strategy" | "how should I structure auth?", "what's the approach for caching?" |
|
|
36
|
+
| **EXPLORE** | "what is", "where is", "find", "show me", "explain", "how does" | "where is the config?", "explain this function" |
|
|
37
|
+
| **CHAT** | greetings, meta-questions, confirmations, short responses | "thanks", "yes", "what can you do?" |
|
|
38
|
+
|
|
39
|
+
**Ambiguous prompts:** Default to the lowest-overhead classification. "Update the README" → BUILD/STANDARD. Git operations like "commit this" → QUICK.
|
|
40
|
+
|
|
41
|
+
## Step 2: Classify Depth
|
|
42
|
+
|
|
43
|
+
Determine how much enforcement the prompt warrants.
|
|
44
|
+
|
|
45
|
+
| Depth | Criteria | Action |
|
|
46
|
+
|-------|----------|--------|
|
|
47
|
+
| **QUICK** | CHAT intent. EXPLORE with no analytical depth ("where is X?"). Git/devops operations (commit, push, merge, branch, pr, deploy, reinstall). Single-word continuations. | Respond normally. Zero overhead. Do not state classification. |
|
|
48
|
+
| **STANDARD** | BUILD/DEBUG/REVIEW/PLAN intent (any word count). EXPLORE with analytical depth ("analyze our X", "discuss how Y works"). | Read and apply 2-3 relevant skills from the selection matrix below. State classification briefly. |
|
|
49
|
+
| **ESCALATE** | Multi-file architectural change, system-wide scope, > 5 files. Detailed implementation plan (100+ words with plan structure). | Respond at best effort + recommend: "This looks like it would benefit from `/implement` for full lifecycle management." |
|
|
50
|
+
|
|
51
|
+
## Step 3: Select Skills (STANDARD depth only)
|
|
52
|
+
|
|
53
|
+
Based on classified intent, read the following skills to inform your response.
|
|
54
|
+
|
|
55
|
+
| Intent | Primary Skills | Secondary (if file type matches) |
|
|
56
|
+
|--------|---------------|----------------------------------|
|
|
57
|
+
| **BUILD** | test-driven-development, implementation-patterns | typescript (.ts), react (.tsx/.jsx), go (.go), java (.java), python (.py), rust (.rs), frontend-design (CSS/UI), input-validation (forms/API), security-patterns (auth/crypto) |
|
|
58
|
+
| **DEBUG** | test-patterns, core-patterns | git-safety (if git operations involved) |
|
|
59
|
+
| **REVIEW** | self-review, core-patterns | test-patterns |
|
|
60
|
+
| **PLAN** | implementation-patterns | core-patterns |
|
|
61
|
+
|
|
62
|
+
**Excluded from ambient** (review-command-only): review-methodology, complexity-patterns, consistency-patterns, database-patterns, dependencies-patterns, documentation-patterns, regression-patterns, architecture-patterns, accessibility.
|
|
63
|
+
|
|
64
|
+
See `references/skill-catalog.md` for the full skill-to-intent mapping with file pattern triggers.
|
|
65
|
+
|
|
66
|
+
## Step 4: Apply
|
|
67
|
+
|
|
68
|
+
- **QUICK:** Respond directly. No preamble, no classification statement.
|
|
69
|
+
- **STANDARD:** State classification briefly: `Ambient: BUILD/STANDARD. Loading: test-driven-development, implementation-patterns.` Then read the selected skills and apply their patterns to your response. For BUILD intent, enforce RED-GREEN-REFACTOR from test-driven-development.
|
|
70
|
+
- **ESCALATE:** Respond with your best effort, then append: `> This task spans multiple files/systems. Consider \`/implement\` for full lifecycle (exploration → planning → implementation → review).`
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Transparency Rules
|
|
75
|
+
|
|
76
|
+
1. **QUICK → silent.** No classification output.
|
|
77
|
+
2. **STANDARD → brief statement.** One line: intent, depth, skills loaded.
|
|
78
|
+
3. **ESCALATE → recommendation.** Best-effort response + workflow nudge.
|
|
79
|
+
4. **Never lie about classification.** If uncertain, say so.
|
|
80
|
+
5. **Never over-classify.** When in doubt, go one tier lower.
|
|
81
|
+
|
|
82
|
+
## Edge Cases
|
|
83
|
+
|
|
84
|
+
| Case | Handling |
|
|
85
|
+
|------|----------|
|
|
86
|
+
| Mixed intent ("fix this bug and add a test") | Use the higher-overhead intent (BUILD > DEBUG) |
|
|
87
|
+
| Continuation of previous conversation | Inherit previous classification unless prompt clearly shifts |
|
|
88
|
+
| User explicitly requests no enforcement | Respect immediately — classify as QUICK |
|
|
89
|
+
| Prompt references specific DevFlow command | Skip ambient — the command has its own orchestration |
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Ambient Router — Skill Catalog
|
|
2
|
+
|
|
3
|
+
Full mapping of DevFlow skills to ambient intents and file-type triggers. The ambient-router SKILL.md references this for detailed selection logic.
|
|
4
|
+
|
|
5
|
+
## Skills Available for Ambient Loading
|
|
6
|
+
|
|
7
|
+
These skills may be loaded during STANDARD-depth ambient routing.
|
|
8
|
+
|
|
9
|
+
### BUILD Intent
|
|
10
|
+
|
|
11
|
+
| Skill | When to Load | File Patterns |
|
|
12
|
+
|-------|-------------|---------------|
|
|
13
|
+
| test-driven-development | Always for BUILD | `*.ts`, `*.tsx`, `*.js`, `*.jsx`, `*.py` |
|
|
14
|
+
| implementation-patterns | Always for BUILD | Any code file |
|
|
15
|
+
| typescript | TypeScript files in scope | `*.ts`, `*.tsx` |
|
|
16
|
+
| react | React components in scope | `*.tsx`, `*.jsx` |
|
|
17
|
+
| frontend-design | UI/styling work | `*.css`, `*.scss`, `*.tsx` with styling keywords |
|
|
18
|
+
| input-validation | Forms, APIs, user input | Files with form/input/validation keywords |
|
|
19
|
+
| go | Go files in scope | `*.go` |
|
|
20
|
+
| java | Java files in scope | `*.java` |
|
|
21
|
+
| python | Python files in scope | `*.py` |
|
|
22
|
+
| rust | Rust files in scope | `*.rs` |
|
|
23
|
+
| security-patterns | Auth, crypto, secrets | Files with auth/token/crypto/password keywords |
|
|
24
|
+
|
|
25
|
+
### DEBUG Intent
|
|
26
|
+
|
|
27
|
+
| Skill | When to Load | File Patterns |
|
|
28
|
+
|-------|-------------|---------------|
|
|
29
|
+
| test-patterns | Always for DEBUG | Any test-related context |
|
|
30
|
+
| core-patterns | Always for DEBUG | Any code file |
|
|
31
|
+
| git-safety | Git operations involved | User mentions git, rebase, merge, etc. |
|
|
32
|
+
|
|
33
|
+
### REVIEW Intent
|
|
34
|
+
|
|
35
|
+
| Skill | When to Load | File Patterns |
|
|
36
|
+
|-------|-------------|---------------|
|
|
37
|
+
| self-review | Always for REVIEW | Any code file |
|
|
38
|
+
| core-patterns | Always for REVIEW | Any code file |
|
|
39
|
+
| test-patterns | Test files in scope | `*.test.*`, `*.spec.*` |
|
|
40
|
+
|
|
41
|
+
### PLAN Intent
|
|
42
|
+
|
|
43
|
+
| Skill | When to Load | File Patterns |
|
|
44
|
+
|-------|-------------|---------------|
|
|
45
|
+
| implementation-patterns | Always for PLAN | Any planning context |
|
|
46
|
+
| core-patterns | Architectural planning | System design discussions |
|
|
47
|
+
|
|
48
|
+
## Skills Excluded from Ambient
|
|
49
|
+
|
|
50
|
+
These skills are loaded only by explicit DevFlow commands (primarily `/code-review`):
|
|
51
|
+
|
|
52
|
+
- review-methodology — Full review process (6-step, 3-category classification)
|
|
53
|
+
- complexity-patterns — Cyclomatic complexity, deep nesting analysis
|
|
54
|
+
- consistency-patterns — Naming convention, pattern deviation detection
|
|
55
|
+
- database-patterns — Index analysis, query optimization, migration safety
|
|
56
|
+
- dependencies-patterns — CVE detection, license audit, outdated packages
|
|
57
|
+
- documentation-patterns — Doc drift, stale comments, missing API docs
|
|
58
|
+
- regression-patterns — Lost functionality, broken exports, behavioral changes
|
|
59
|
+
- architecture-patterns — SOLID analysis, coupling detection, layering issues
|
|
60
|
+
- accessibility — WCAG compliance, ARIA roles, keyboard navigation
|
|
61
|
+
- performance-patterns — N+1 queries, memory leaks, caching opportunities
|
|
62
|
+
|
|
63
|
+
## Selection Limits
|
|
64
|
+
|
|
65
|
+
- **Maximum 3 skills** per ambient response (primary + up to 2 secondary)
|
|
66
|
+
- **Primary skills** are always loaded for the classified intent
|
|
67
|
+
- **Secondary skills** are loaded only when file patterns match conversation context
|
|
68
|
+
- If more than 3 skills seem relevant, this is an ESCALATE signal
|
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
"name": "DevFlow Contributors",
|
|
6
6
|
"email": "dean@keren.dev"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.2.0",
|
|
9
9
|
"homepage": "https://github.com/dean0x/devflow",
|
|
10
10
|
"repository": "https://github.com/dean0x/devflow",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"keywords": ["review", "code-quality", "security", "architecture", "pr-review"],
|
|
13
13
|
"agents": ["git", "reviewer", "synthesizer"],
|
|
14
14
|
"skills": [
|
|
15
|
-
"accessibility",
|
|
16
15
|
"agent-teams",
|
|
17
16
|
"architecture-patterns",
|
|
18
17
|
"complexity-patterns",
|
|
@@ -20,9 +19,7 @@
|
|
|
20
19
|
"database-patterns",
|
|
21
20
|
"dependencies-patterns",
|
|
22
21
|
"documentation-patterns",
|
|
23
|
-
"frontend-design",
|
|
24
22
|
"performance-patterns",
|
|
25
|
-
"react",
|
|
26
23
|
"regression-patterns",
|
|
27
24
|
"review-methodology",
|
|
28
25
|
"security-patterns",
|
|
@@ -34,6 +34,10 @@ The orchestrator provides:
|
|
|
34
34
|
| `react` | `~/.claude/skills/react/SKILL.md` |
|
|
35
35
|
| `accessibility` | `~/.claude/skills/accessibility/SKILL.md` |
|
|
36
36
|
| `frontend-design` | `~/.claude/skills/frontend-design/SKILL.md` |
|
|
37
|
+
| `go` | `~/.claude/skills/go/SKILL.md` |
|
|
38
|
+
| `java` | `~/.claude/skills/java/SKILL.md` |
|
|
39
|
+
| `python` | `~/.claude/skills/python/SKILL.md` |
|
|
40
|
+
| `rust` | `~/.claude/skills/rust/SKILL.md` |
|
|
37
41
|
|
|
38
42
|
## Responsibilities
|
|
39
43
|
|
|
@@ -117,3 +121,7 @@ Report format for `{output_path}`:
|
|
|
117
121
|
| react | If .tsx/.jsx files changed |
|
|
118
122
|
| accessibility | If .tsx/.jsx files changed |
|
|
119
123
|
| frontend-design | If .tsx/.jsx/.css/.scss files changed |
|
|
124
|
+
| go | If .go files changed |
|
|
125
|
+
| java | If .java files changed |
|
|
126
|
+
| python | If .py files changed |
|
|
127
|
+
| rust | If .rs files changed |
|
|
@@ -42,10 +42,16 @@ Detect file types in diff to determine conditional reviews:
|
|
|
42
42
|
| .tsx/.jsx files | react |
|
|
43
43
|
| .tsx/.jsx files | accessibility |
|
|
44
44
|
| .tsx/.jsx/.css/.scss files | frontend-design |
|
|
45
|
+
| .go files | go |
|
|
46
|
+
| .java files | java |
|
|
47
|
+
| .py files | python |
|
|
48
|
+
| .rs files | rust |
|
|
45
49
|
| DB/migration files | database |
|
|
46
50
|
| Dependency files changed | dependencies |
|
|
47
51
|
| Docs or significant code | documentation |
|
|
48
52
|
|
|
53
|
+
**Skill availability check**: Language/ecosystem reviews (typescript, react, accessibility, frontend-design, go, java, python, rust) require their optional skill plugin to be installed. Before adding a conditional perspective, check if `~/.claude/skills/{focus}/SKILL.md` exists (use Glob). If the skill file doesn't exist, **skip that perspective** — the language plugin isn't installed. Non-language reviews (database, dependencies, documentation) use skills bundled with this plugin and are always available.
|
|
54
|
+
|
|
49
55
|
### Phase 2: Spawn Review Team
|
|
50
56
|
|
|
51
57
|
Create an agent team for adversarial review. Always include 4 core perspectives; conditionally add more based on Phase 1 analysis.
|
|
@@ -61,6 +67,10 @@ Create an agent team for adversarial review. Always include 4 core perspectives;
|
|
|
61
67
|
- **React**: hooks, state, rendering, composition (if .tsx/.jsx changed)
|
|
62
68
|
- **Accessibility**: ARIA, keyboard nav, focus management (if .tsx/.jsx changed)
|
|
63
69
|
- **Frontend Design**: visual consistency, spacing, typography (if .tsx/.jsx/.css changed)
|
|
70
|
+
- **Go**: error handling, interfaces, concurrency (if .go changed)
|
|
71
|
+
- **Java**: records, sealed classes, composition (if .java changed)
|
|
72
|
+
- **Python**: type hints, protocols, data modeling (if .py changed)
|
|
73
|
+
- **Rust**: ownership, error handling, type system (if .rs changed)
|
|
64
74
|
- **Database**: schema, queries, migrations, indexes (if DB files changed)
|
|
65
75
|
- **Dependencies**: CVEs, versions, licenses, supply chain (if package files changed)
|
|
66
76
|
- **Documentation**: doc drift, missing docs, stale comments (if docs or significant code changed)
|
|
@@ -238,7 +248,7 @@ Display results:
|
|
|
238
248
|
│ ├─ Architecture Reviewer (teammate)
|
|
239
249
|
│ ├─ Performance Reviewer (teammate)
|
|
240
250
|
│ ├─ Quality Reviewer (teammate)
|
|
241
|
-
│ └─ [Conditional: TypeScript, React, A11y, Design, DB, Deps, Docs]
|
|
251
|
+
│ └─ [Conditional: TypeScript, React, A11y, Design, Go, Java, Python, Rust, DB, Deps, Docs]
|
|
242
252
|
│
|
|
243
253
|
├─ Phase 3: Debate round
|
|
244
254
|
│ └─ Reviewers challenge each other (max 2 rounds)
|
|
@@ -42,13 +42,19 @@ Detect file types in diff to determine conditional reviews:
|
|
|
42
42
|
| .tsx/.jsx files | react |
|
|
43
43
|
| .tsx/.jsx files | accessibility |
|
|
44
44
|
| .tsx/.jsx/.css/.scss files | frontend-design |
|
|
45
|
+
| .go files | go |
|
|
46
|
+
| .java files | java |
|
|
47
|
+
| .py files | python |
|
|
48
|
+
| .rs files | rust |
|
|
45
49
|
| DB/migration files | database |
|
|
46
50
|
| Dependency files changed | dependencies |
|
|
47
51
|
| Docs or significant code | documentation |
|
|
48
52
|
|
|
53
|
+
**Skill availability check**: Language/ecosystem reviews (typescript, react, accessibility, frontend-design, go, java, python, rust) require their optional skill plugin to be installed. Before spawning a conditional Reviewer for these focuses, check if `~/.claude/skills/{focus}/SKILL.md` exists (use Glob). If the skill file doesn't exist, **skip that review** — the language plugin isn't installed. Non-language reviews (database, dependencies, documentation) use skills bundled with this plugin and are always available.
|
|
54
|
+
|
|
49
55
|
### Phase 2: Run Reviews (Parallel)
|
|
50
56
|
|
|
51
|
-
Spawn Reviewer agents **in a single message**. Always run 7 core reviews; conditionally add
|
|
57
|
+
Spawn Reviewer agents **in a single message**. Always run 7 core reviews; conditionally add more based on changed file types:
|
|
52
58
|
|
|
53
59
|
| Focus | Always | Pattern Skill |
|
|
54
60
|
|-------|--------|---------------|
|
|
@@ -63,6 +69,10 @@ Spawn Reviewer agents **in a single message**. Always run 7 core reviews; condit
|
|
|
63
69
|
| react | conditional | react |
|
|
64
70
|
| accessibility | conditional | accessibility |
|
|
65
71
|
| frontend-design | conditional | frontend-design |
|
|
72
|
+
| go | conditional | go |
|
|
73
|
+
| java | conditional | java |
|
|
74
|
+
| python | conditional | python |
|
|
75
|
+
| rust | conditional | rust |
|
|
66
76
|
| database | conditional | database-patterns |
|
|
67
77
|
| dependencies | conditional | dependencies-patterns |
|
|
68
78
|
| documentation | conditional | documentation-patterns |
|
|
@@ -123,7 +133,7 @@ Display results from all agents:
|
|
|
123
133
|
│ ├─ Reviewer: consistency
|
|
124
134
|
│ ├─ Reviewer: regression
|
|
125
135
|
│ ├─ Reviewer: tests
|
|
126
|
-
│ └─ Reviewer: [conditional: typescript, react, a11y, design, database, deps, docs]
|
|
136
|
+
│ └─ Reviewer: [conditional: typescript, react, a11y, design, go, java, python, rust, database, deps, docs]
|
|
127
137
|
│
|
|
128
138
|
├─ Phase 3: Synthesis (PARALLEL)
|
|
129
139
|
│ ├─ Git agent (comment-pr)
|
|
@@ -5,23 +5,20 @@
|
|
|
5
5
|
"name": "DevFlow Contributors",
|
|
6
6
|
"email": "dean@keren.dev"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.2.0",
|
|
9
9
|
"homepage": "https://github.com/dean0x/devflow",
|
|
10
10
|
"repository": "https://github.com/dean0x/devflow",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"keywords": ["skills", "quality", "patterns", "auto-activate", "enforcement", "foundation"],
|
|
13
13
|
"agents": [],
|
|
14
14
|
"skills": [
|
|
15
|
-
"accessibility",
|
|
16
15
|
"core-patterns",
|
|
17
16
|
"docs-framework",
|
|
18
|
-
"frontend-design",
|
|
19
17
|
"git-safety",
|
|
20
18
|
"git-workflow",
|
|
21
19
|
"github-patterns",
|
|
22
20
|
"input-validation",
|
|
23
|
-
"
|
|
24
|
-
"test-patterns"
|
|
25
|
-
"typescript"
|
|
21
|
+
"test-driven-development",
|
|
22
|
+
"test-patterns"
|
|
26
23
|
]
|
|
27
24
|
}
|
|
@@ -32,10 +32,14 @@ All generated documentation lives under `.docs/` in the project root:
|
|
|
32
32
|
│ ├── {timestamp}.md
|
|
33
33
|
│ ├── compact/{timestamp}.md
|
|
34
34
|
│ └── INDEX.md
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
└── swarm/ # Swarm operation state
|
|
36
|
+
├── state.json
|
|
37
|
+
└── plans/
|
|
38
|
+
|
|
39
|
+
.memory/
|
|
40
|
+
├── WORKING-MEMORY.md # Auto-maintained by Stop hook (overwritten)
|
|
41
|
+
├── PROJECT-PATTERNS.md # Accumulated patterns (merged across sessions)
|
|
42
|
+
└── backup.json # Pre-compact git state snapshot
|
|
39
43
|
```
|
|
40
44
|
|
|
41
45
|
---
|
|
@@ -92,7 +96,7 @@ source .devflow/scripts/docs-helpers.sh 2>/dev/null || {
|
|
|
92
96
|
| Agent | Output Location | Behavior |
|
|
93
97
|
|-------|-----------------|----------|
|
|
94
98
|
| Reviewer | `.docs/reviews/{branch-slug}/{type}-report.{timestamp}.md` | Creates new |
|
|
95
|
-
| Working Memory | `.
|
|
99
|
+
| Working Memory | `.memory/WORKING-MEMORY.md` | Overwrites (auto-maintained by Stop hook) |
|
|
96
100
|
|
|
97
101
|
### Agents That Don't Persist
|
|
98
102
|
|
|
@@ -120,7 +124,7 @@ When creating or modifying persisting agents:
|
|
|
120
124
|
|
|
121
125
|
This framework is used by:
|
|
122
126
|
- **Review agents**: Creates review reports
|
|
123
|
-
- **Working Memory hooks**: Auto-maintains `.
|
|
127
|
+
- **Working Memory hooks**: Auto-maintains `.memory/WORKING-MEMORY.md`
|
|
124
128
|
|
|
125
129
|
All persisting agents should load this skill to ensure consistent documentation.
|
|
126
130
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-driven-development
|
|
3
|
+
description: >-
|
|
4
|
+
Enforce RED-GREEN-REFACTOR cycle during implementation. Write failing tests before
|
|
5
|
+
production code. Distinct from test-patterns (which reviews test quality) — this
|
|
6
|
+
skill enforces the TDD workflow during code generation.
|
|
7
|
+
user-invocable: false
|
|
8
|
+
allowed-tools: Read, Grep, Glob
|
|
9
|
+
activation:
|
|
10
|
+
file-patterns:
|
|
11
|
+
- "**/*.ts"
|
|
12
|
+
- "**/*.tsx"
|
|
13
|
+
- "**/*.js"
|
|
14
|
+
- "**/*.jsx"
|
|
15
|
+
- "**/*.py"
|
|
16
|
+
exclude:
|
|
17
|
+
- "node_modules/**"
|
|
18
|
+
- "dist/**"
|
|
19
|
+
- "**/*.test.*"
|
|
20
|
+
- "**/*.spec.*"
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Test-Driven Development
|
|
24
|
+
|
|
25
|
+
Enforce the RED-GREEN-REFACTOR cycle for all implementation work. Tests define the design. Code satisfies the tests. Refactoring improves the design without changing behavior.
|
|
26
|
+
|
|
27
|
+
## Iron Law
|
|
28
|
+
|
|
29
|
+
> **TESTS FIRST, ALWAYS**
|
|
30
|
+
>
|
|
31
|
+
> Write the failing test before the production code. No exceptions. If you catch
|
|
32
|
+
> yourself writing production code without a failing test, stop immediately, delete
|
|
33
|
+
> the production code, write the test, watch it fail, then write the minimum code
|
|
34
|
+
> to make it pass. The test IS the specification.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## The Cycle
|
|
39
|
+
|
|
40
|
+
### Step 1: RED — Write a Failing Test
|
|
41
|
+
|
|
42
|
+
Write a test that describes the behavior you want. Run it. Watch it fail. The failure message IS your specification.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Describe what the code SHOULD do, not how it does it.
|
|
46
|
+
One behavior per test. One assertion per test (ideally).
|
|
47
|
+
Name tests as sentences: "returns error when email is invalid"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Checkpoint:** The test MUST fail before proceeding. A test that passes immediately proves nothing.
|
|
51
|
+
|
|
52
|
+
### Step 2: GREEN — Write Minimum Code to Pass
|
|
53
|
+
|
|
54
|
+
Write the simplest production code that makes the failing test pass. No more, no less.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Hardcode first if that's simplest. Generalize when the next test forces it.
|
|
58
|
+
Don't write code "you'll need later." Write code the test demands NOW.
|
|
59
|
+
Don't optimize. Don't refactor. Don't clean up. Just pass the test.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Checkpoint:** All tests pass. If any test fails, fix it before moving on.
|
|
63
|
+
|
|
64
|
+
### Step 3: REFACTOR — Improve Without Changing Behavior
|
|
65
|
+
|
|
66
|
+
Now clean up. Extract helpers, rename variables, simplify logic. Tests stay green throughout.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Run tests after every refactoring step.
|
|
70
|
+
If a test breaks during refactor, undo immediately — you changed behavior.
|
|
71
|
+
Apply DRY, extract patterns, improve readability.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Checkpoint:** All tests still pass. Code is clean. Repeat from Step 1 for next behavior.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Rationalization Prevention
|
|
79
|
+
|
|
80
|
+
These are the excuses developers use to skip TDD. Recognize and reject them.
|
|
81
|
+
|
|
82
|
+
| Excuse | Why It Feels Right | Why It's Wrong | Correct Action |
|
|
83
|
+
|--------|-------------------|---------------|----------------|
|
|
84
|
+
| "I'll write tests after" | Need to see the shape first | Tests ARE the shape — they define the interface before implementation exists | Write the test first |
|
|
85
|
+
| "Too simple to test" | It's just a getter/setter | Getters break, defaults change, edge cases hide in "simple" code | Write it — takes 30 seconds |
|
|
86
|
+
| "I'll refactor later" | Just get it working now | "Later" never comes; technical debt compounds silently | Refactor now in Step 3 |
|
|
87
|
+
| "Test is too hard to write" | Setup is complex, mocking is painful | Hard-to-test code = bad design; the test is telling you the interface is wrong | Simplify the interface first |
|
|
88
|
+
| "Need to see the whole picture" | Can't test what I haven't designed yet | TDD IS design; each test reveals the next piece of the interface | Let the test guide the design |
|
|
89
|
+
| "Tests slow me down" | Faster to just write the code | Faster until the first regression; TDD is faster for anything > 50 lines | Trust the cycle |
|
|
90
|
+
|
|
91
|
+
See `references/rationalization-prevention.md` for extended examples with code.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Process Enforcement
|
|
96
|
+
|
|
97
|
+
When implementing any feature under ambient BUILD/STANDARD:
|
|
98
|
+
|
|
99
|
+
1. **Identify the first behavior** — What is the simplest thing this feature must do?
|
|
100
|
+
2. **Write the test** — Describe that behavior as a failing test
|
|
101
|
+
3. **Run the test** — Confirm it fails (RED)
|
|
102
|
+
4. **Write minimum code** — Just enough to pass (GREEN)
|
|
103
|
+
5. **Refactor** — Clean up while tests stay green (REFACTOR)
|
|
104
|
+
6. **Repeat** — Next behavior, next test, next cycle
|
|
105
|
+
|
|
106
|
+
### File Organization
|
|
107
|
+
|
|
108
|
+
- Test file lives next to production file: `user.ts` → `user.test.ts`
|
|
109
|
+
- Follow project's existing test conventions (Jest, Vitest, pytest, etc.)
|
|
110
|
+
- Import the module under test, not internal helpers
|
|
111
|
+
|
|
112
|
+
### What to Test
|
|
113
|
+
|
|
114
|
+
| Test | Don't Test |
|
|
115
|
+
|------|-----------|
|
|
116
|
+
| Public API behavior | Private implementation details |
|
|
117
|
+
| Error conditions and edge cases | Framework internals |
|
|
118
|
+
| Integration points (boundaries) | Third-party library correctness |
|
|
119
|
+
| State transitions | Getter/setter plumbing (unless non-trivial) |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## When TDD Does Not Apply
|
|
124
|
+
|
|
125
|
+
- **QUICK depth** — Ambient classified as QUICK (chat, exploration, trivial edits)
|
|
126
|
+
- **Non-code tasks** — Documentation, configuration, CI changes
|
|
127
|
+
- **Exploratory prototyping** — User explicitly says "just spike this" or "prototype"
|
|
128
|
+
- **Existing test suite changes** — Modifying tests themselves (test-patterns skill applies instead)
|
|
129
|
+
|
|
130
|
+
When skipping TDD, never rationalize. State clearly: "Skipping TDD because: [specific reason from list above]."
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Integration with Ambient Mode
|
|
135
|
+
|
|
136
|
+
- **BUILD/STANDARD** → TDD enforced. Every new function/method gets test-first treatment.
|
|
137
|
+
- **BUILD/QUICK** → TDD skipped (trivial single-file edit).
|
|
138
|
+
- **BUILD/ESCALATE** → TDD mentioned in nudge toward `/implement`.
|
|
139
|
+
- **DEBUG/STANDARD** → TDD applies to the fix: write a test that reproduces the bug first, then fix.
|