@codename_inc/spectre 3.7.0 → 4.0.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/README.md +3 -4
- package/package.json +3 -2
- package/plugins/spectre/.claude-plugin/plugin.json +1 -1
- package/plugins/spectre/bin/spectre-register +5 -0
- package/plugins/spectre/hooks/hooks.json +3 -14
- package/plugins/spectre/hooks/scripts/bootstrap.mjs +98 -0
- package/plugins/spectre/hooks/scripts/handoff-resume.mjs +404 -0
- package/plugins/spectre/hooks/scripts/lib.mjs +82 -0
- package/plugins/spectre/hooks/scripts/load-knowledge.mjs +189 -0
- package/plugins/spectre/hooks/scripts/register_learning.mjs +264 -0
- package/plugins/spectre/hooks/scripts/{test_bootstrap.cjs → test_bootstrap.mjs} +12 -7
- package/plugins/spectre/hooks/scripts/{test_handoff-resume.cjs → test_handoff-resume.mjs} +13 -11
- package/plugins/spectre/hooks/scripts/{test_load-knowledge.cjs → test_load-knowledge.mjs} +103 -22
- package/plugins/spectre/hooks/scripts/test_register-learning.mjs +335 -0
- package/plugins/spectre/skills/apply/SKILL.md +87 -0
- package/plugins/spectre/{commands/architecture_review.md → skills/architecture_review/SKILL.md} +9 -0
- package/plugins/spectre/{commands/clean.md → skills/clean/SKILL.md} +9 -0
- package/plugins/spectre/{commands/code_review.md → skills/code_review/SKILL.md} +9 -0
- package/plugins/spectre/{commands/create_plan.md → skills/create_plan/SKILL.md} +9 -0
- package/plugins/spectre/{commands/create_tasks.md → skills/create_tasks/SKILL.md} +9 -0
- package/plugins/spectre/{commands/create_test_guide.md → skills/create_test_guide/SKILL.md} +9 -0
- package/plugins/spectre/{commands/evaluate.md → skills/evaluate/SKILL.md} +11 -2
- package/plugins/spectre/{commands/execute.md → skills/execute/SKILL.md} +12 -3
- package/plugins/spectre/{commands/fix.md → skills/fix/SKILL.md} +9 -0
- package/plugins/spectre/{commands/forget.md → skills/forget/SKILL.md} +9 -0
- package/plugins/spectre/skills/{spectre-guide → guide}/SKILL.md +2 -1
- package/plugins/spectre/{commands/handoff.md → skills/handoff/SKILL.md} +9 -0
- package/plugins/spectre/{commands/kickoff.md → skills/kickoff/SKILL.md} +9 -0
- package/plugins/spectre/skills/{spectre-learn → learn}/SKILL.md +19 -59
- package/plugins/spectre/skills/learn/references/recall-template.md +34 -0
- package/plugins/spectre/{commands/plan.md → skills/plan/SKILL.md} +66 -25
- package/plugins/spectre/{commands/plan_review.md → skills/plan_review/SKILL.md} +9 -0
- package/plugins/spectre/{commands/quick_dev.md → skills/quick_dev/SKILL.md} +9 -0
- package/plugins/spectre/{commands/rebase.md → skills/rebase/SKILL.md} +9 -0
- package/plugins/spectre/skills/recall/SKILL.md +17 -0
- package/plugins/spectre/{commands/research.md → skills/research/SKILL.md} +9 -0
- package/plugins/spectre/{commands/scope.md → skills/scope/SKILL.md} +9 -0
- package/plugins/spectre/{commands/ship.md → skills/ship/SKILL.md} +9 -0
- package/plugins/spectre/{commands/sweep.md → skills/sweep/SKILL.md} +9 -0
- package/plugins/spectre/skills/tdd/SKILL.md +111 -0
- package/plugins/spectre/{commands/test.md → skills/test/SKILL.md} +9 -0
- package/plugins/spectre/{commands/ux_spec.md → skills/ux_spec/SKILL.md} +9 -0
- package/plugins/spectre/{commands/validate.md → skills/validate/SKILL.md} +9 -0
- package/plugins/spectre-codex/agents/analyst.toml +117 -0
- package/plugins/spectre-codex/agents/dev.toml +65 -0
- package/plugins/spectre-codex/agents/finder.toml +101 -0
- package/plugins/spectre-codex/agents/patterns.toml +203 -0
- package/plugins/spectre-codex/agents/reviewer.toml +123 -0
- package/plugins/spectre-codex/agents/sync.toml +146 -0
- package/plugins/spectre-codex/agents/tester.toml +205 -0
- package/plugins/spectre-codex/agents/web-research.toml +104 -0
- package/plugins/spectre-codex/hooks/hooks.json +23 -0
- package/plugins/{spectre/hooks/scripts/bootstrap.cjs → spectre-codex/hooks/scripts/bootstrap.mjs} +15 -16
- package/plugins/{spectre/hooks/scripts/handoff-resume.cjs → spectre-codex/hooks/scripts/handoff-resume.mjs} +21 -27
- package/plugins/{spectre/hooks/scripts/lib.cjs → spectre-codex/hooks/scripts/lib.mjs} +3 -4
- package/plugins/spectre-codex/hooks/scripts/load-knowledge.mjs +189 -0
- package/plugins/spectre-codex/hooks/scripts/register_learning.mjs +264 -0
- package/plugins/spectre-codex/skills/apply/SKILL.md +87 -0
- package/plugins/spectre-codex/skills/architecture_review/SKILL.md +129 -0
- package/plugins/spectre-codex/skills/clean/SKILL.md +322 -0
- package/plugins/spectre-codex/skills/code_review/SKILL.md +417 -0
- package/plugins/spectre-codex/skills/create_plan/SKILL.md +126 -0
- package/plugins/spectre-codex/skills/create_tasks/SKILL.md +383 -0
- package/plugins/spectre-codex/skills/create_test_guide/SKILL.md +129 -0
- package/plugins/spectre-codex/skills/evaluate/SKILL.md +59 -0
- package/plugins/spectre-codex/skills/execute/SKILL.md +96 -0
- package/plugins/spectre-codex/skills/fix/SKILL.md +70 -0
- package/plugins/spectre-codex/skills/forget/SKILL.md +67 -0
- package/plugins/spectre-codex/skills/guide/SKILL.md +359 -0
- package/plugins/spectre-codex/skills/handoff/SKILL.md +170 -0
- package/plugins/spectre-codex/skills/kickoff/SKILL.md +124 -0
- package/plugins/spectre-codex/skills/learn/SKILL.md +595 -0
- package/plugins/{spectre/skills/spectre-learn → spectre-codex/skills/learn}/references/recall-template.md +4 -1
- package/plugins/spectre-codex/skills/plan/SKILL.md +211 -0
- package/plugins/spectre-codex/skills/plan_review/SKILL.md +42 -0
- package/plugins/spectre-codex/skills/quick_dev/SKILL.md +110 -0
- package/plugins/spectre-codex/skills/rebase/SKILL.md +82 -0
- package/plugins/spectre-codex/skills/recall/SKILL.md +17 -0
- package/plugins/spectre-codex/skills/research/SKILL.md +168 -0
- package/plugins/spectre-codex/skills/scope/SKILL.md +128 -0
- package/plugins/spectre-codex/skills/ship/SKILL.md +181 -0
- package/plugins/spectre-codex/skills/sweep/SKILL.md +91 -0
- package/plugins/{spectre/skills/spectre-tdd → spectre-codex/skills/tdd}/SKILL.md +1 -1
- package/plugins/spectre-codex/skills/test/SKILL.md +389 -0
- package/plugins/spectre-codex/skills/ux_spec/SKILL.md +100 -0
- package/plugins/spectre-codex/skills/validate/SKILL.md +352 -0
- package/src/config.test.js +6 -5
- package/src/install.test.js +100 -11
- package/src/lib/config.js +107 -54
- package/src/lib/constants.js +17 -23
- package/src/lib/doctor.js +19 -22
- package/src/lib/install.js +98 -313
- package/src/lib/knowledge.js +7 -37
- package/src/lib/paths.js +0 -12
- package/src/pack.test.js +87 -0
- package/plugins/spectre/commands/learn.md +0 -15
- package/plugins/spectre/commands/recall.md +0 -5
- package/plugins/spectre/hooks/scripts/load-knowledge.cjs +0 -120
- package/plugins/spectre/hooks/scripts/precompact-warning.cjs +0 -19
- package/plugins/spectre/hooks/scripts/register_learning.cjs +0 -144
- package/plugins/spectre/hooks/scripts/test_register-learning.cjs +0 -146
- package/plugins/spectre/skills/spectre-apply/SKILL.md +0 -189
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "test"
|
|
3
|
+
description: "👻 | Risk-aware test coverage & commit - primary agent"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# test
|
|
8
|
+
|
|
9
|
+
## Input Handling
|
|
10
|
+
|
|
11
|
+
Treat the current command arguments as this workflow's input. When invoked from a slash command, use the forwarded `$ARGUMENTS` value.
|
|
12
|
+
|
|
13
|
+
# test: test coverage with risk-aware focus
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
- **What** — Triage changes into risk tiers, dispatch @tester subagents to fix lint and write **risk-appropriate tests** (not brute-force 100% line coverage), and commit after each passing batch.
|
|
18
|
+
- **Outcome** — All lint issues fixed, surgical test coverage that maximizes confidence while minimizing token cost, incremental commits per batch, artifacts recorded in OUT_DIR.
|
|
19
|
+
- **Philosophy** — Test behaviors at boundaries, not implementation details. Prioritize code that can hurt users when it breaks. Skip tests that only measure "was this line executed?" without verifying correctness.
|
|
20
|
+
|
|
21
|
+
## ARGUMENTS Input
|
|
22
|
+
|
|
23
|
+
Optional scope hint or specific files to focus on.
|
|
24
|
+
|
|
25
|
+
<ARGUMENTS> $ARGUMENTS </ARGUMENTS>
|
|
26
|
+
|
|
27
|
+
## Instructions
|
|
28
|
+
|
|
29
|
+
- Primary agent plans and verifies; @tester subagents write test code
|
|
30
|
+
- Maximize parallelism: dispatch multiple @tester agents simultaneously, not sequentially
|
|
31
|
+
- Primary agent coordinates; subagents execute test writing in parallel batches
|
|
32
|
+
- No OUT_DIR artifacts — this is a lightweight flow
|
|
33
|
+
- Risk assessment is inline reasoning, not a classification phase
|
|
34
|
+
- Test behaviors at boundaries, not implementation details
|
|
35
|
+
- Skip tests for P3 files (types, configs, simple wrappers)
|
|
36
|
+
- when committing, —no-verify and eslint-disable, or committing code with eslint-disable, is expressly forbidden without the user’s explicit permission.
|
|
37
|
+
|
|
38
|
+
### Why Risk-Weighted > 100% Line Coverage
|
|
39
|
+
|
|
40
|
+
**100% line coverage is a vanity metric that:**
|
|
41
|
+
|
|
42
|
+
- Treats all code equally (a payment handler vs a string formatter)
|
|
43
|
+
- Tests implementation details (brittle, breaks on refactor)
|
|
44
|
+
- Creates maintenance burden (tests that slow you down)
|
|
45
|
+
- Gives false confidence (100% coverage ≠ 100% correctness)
|
|
46
|
+
- Burns tokens on code that can't break in production
|
|
47
|
+
|
|
48
|
+
**Risk-weighted coverage instead:**
|
|
49
|
+
|
|
50
|
+
- Focuses testing effort where bugs cause user pain
|
|
51
|
+
- Tests behaviors and contracts, not internal wiring
|
|
52
|
+
- Creates tests that survive refactoring
|
|
53
|
+
- Catches actual bugs via mutation-resistant assertions
|
|
54
|
+
- Dramatically reduces token cost while increasing safety
|
|
55
|
+
|
|
56
|
+
### Risk Tier Definitions
|
|
57
|
+
|
|
58
|
+
#### P0 — Critical (Must Test Thoroughly)
|
|
59
|
+
|
|
60
|
+
**Identification patterns:**
|
|
61
|
+
|
|
62
|
+
- Path contains: `auth`, `payment`, `security`, `crypto`, `session`, `token`
|
|
63
|
+
- File has `@critical` JSDoc/comment annotation
|
|
64
|
+
- Handles: user data mutations, financial transactions, PII, permissions
|
|
65
|
+
- API handlers for external consumers
|
|
66
|
+
- Database migration files
|
|
67
|
+
|
|
68
|
+
**Coverage requirements:**
|
|
69
|
+
|
|
70
|
+
- 100% **behavioral** coverage (every user-facing outcome has a test)
|
|
71
|
+
- All error paths tested with specific error assertions
|
|
72
|
+
- Edge cases for security-sensitive inputs (null, empty, malformed, overflow)
|
|
73
|
+
- Contract tests for all public APIs (schema validation)
|
|
74
|
+
- Mutation-resistant assertions (would a bug actually fail this test?)
|
|
75
|
+
|
|
76
|
+
**Test quality bar:**
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// ✅ GOOD P0 test - tests behavior and catches real bugs
|
|
80
|
+
it('rejects payment when card is expired', async () => {
|
|
81
|
+
const result = await processPayment({ card: expiredCard, amount: 100 });
|
|
82
|
+
expect(result.status).toBe('DECLINED');
|
|
83
|
+
expect(result.reason).toBe('CARD_EXPIRED');
|
|
84
|
+
expect(chargeService.charge).not.toHaveBeenCalled(); // Side effect prevented
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// ❌ BAD test - tests implementation, not behavior
|
|
88
|
+
it('calls validateCard', async () => {
|
|
89
|
+
await processPayment({ card, amount: 100 });
|
|
90
|
+
expect(validateCard).toHaveBeenCalledWith(card);
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### P1 — Core (Test Key Behaviors)
|
|
95
|
+
|
|
96
|
+
**Identification patterns:**
|
|
97
|
+
|
|
98
|
+
- Main feature components (not utility wrappers)
|
|
99
|
+
- API route handlers (internal)
|
|
100
|
+
- State management (stores, reducers, contexts)
|
|
101
|
+
- Core business logic
|
|
102
|
+
- Data fetching/caching layers
|
|
103
|
+
|
|
104
|
+
**Coverage requirements:**
|
|
105
|
+
|
|
106
|
+
- Happy path coverage for all public functions
|
|
107
|
+
- Critical error paths (ones users would see)
|
|
108
|
+
- Contract tests at team boundaries (exported APIs other modules consume)
|
|
109
|
+
- No need to test internal helper functions
|
|
110
|
+
- No need to test every code branch, just primary behaviors
|
|
111
|
+
|
|
112
|
+
**Test quality bar:**
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// ✅ GOOD P1 test - covers the behavior users care about
|
|
116
|
+
it('fetches and caches user profile', async () => {
|
|
117
|
+
const profile = await getUserProfile(userId);
|
|
118
|
+
expect(profile.name).toBe('Joe');
|
|
119
|
+
|
|
120
|
+
// Second call uses cache
|
|
121
|
+
await getUserProfile(userId);
|
|
122
|
+
expect(api.get).toHaveBeenCalledTimes(1);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ❌ SKIP - internal implementation detail
|
|
126
|
+
it('calls normalizeUserData internally', () => { ... });
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### P2 — Supporting (Test Public Surface Only)
|
|
130
|
+
|
|
131
|
+
**Identification patterns:**
|
|
132
|
+
|
|
133
|
+
- Utility functions and helpers
|
|
134
|
+
- Internal services not exposed to other teams
|
|
135
|
+
- Formatters, validators, transformers
|
|
136
|
+
- Hooks that compose other hooks
|
|
137
|
+
- Adapters and wrappers
|
|
138
|
+
|
|
139
|
+
**Coverage requirements:**
|
|
140
|
+
|
|
141
|
+
- Public exported functions: happy path only
|
|
142
|
+
- Skip internal/private functions entirely
|
|
143
|
+
- Skip trivial functions (single-line returns, simple compositions)
|
|
144
|
+
- Only test if the function has logic worth verifying
|
|
145
|
+
|
|
146
|
+
**Test quality bar:**
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// ✅ GOOD P2 test - public util with actual logic
|
|
150
|
+
it('formats currency correctly', () => {
|
|
151
|
+
expect(formatCurrency(1234.5, 'USD')).toBe('$1,234.50');
|
|
152
|
+
expect(formatCurrency(1234.5, 'EUR')).toBe('€1,234.50');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// ❌ SKIP - trivial wrapper with no logic
|
|
156
|
+
// export const getFullName = (u) => `${u.first} ${u.last}`;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### P3 — Low Risk (Skip Testing)
|
|
160
|
+
|
|
161
|
+
**Identification patterns:**
|
|
162
|
+
|
|
163
|
+
- TypeScript type definitions (`.d.ts`)
|
|
164
|
+
- JSON/YAML configuration files
|
|
165
|
+
- CSS/SCSS/Tailwind styles
|
|
166
|
+
- Markdown documentation
|
|
167
|
+
- Constants and enums (no logic)
|
|
168
|
+
- Re-export barrels (`index.ts` that just re-exports)
|
|
169
|
+
- Simple component wrappers (just pass props through)
|
|
170
|
+
- Build scripts and tooling config
|
|
171
|
+
|
|
172
|
+
**Coverage requirements:**
|
|
173
|
+
|
|
174
|
+
- **NO TESTS REQUIRED** — Types are the test
|
|
175
|
+
- Type checking + linting is sufficient
|
|
176
|
+
- These files cannot break at runtime in ways tests would catch
|
|
177
|
+
|
|
178
|
+
### Test Quality Requirements (All Tiers)
|
|
179
|
+
|
|
180
|
+
#### Each test MUST:
|
|
181
|
+
|
|
182
|
+
- **Test ONE behavior** — Single assertion focus, clear failure message
|
|
183
|
+
- **Use descriptive names** — `when_[condition]_then_[outcome]` or `[action]_should_[result]`
|
|
184
|
+
- **Assert outcomes, not calls** — Verify what happened, not what was invoked
|
|
185
|
+
- **Be refactor-resilient** — Test should pass if behavior unchanged, even if internals change
|
|
186
|
+
- **Catch real bugs** — Ask: "If I introduced a bug, would this test fail?"
|
|
187
|
+
|
|
188
|
+
#### Each test MUST NOT:
|
|
189
|
+
|
|
190
|
+
- **Mock implementation details** — Don't mock internal functions
|
|
191
|
+
- **Assert on call counts** — Unless testing side-effect prevention
|
|
192
|
+
- **Duplicate type coverage** — Don't test that TS types are correct
|
|
193
|
+
- **Test framework behavior** — Don't test that React renders or Express routes
|
|
194
|
+
|
|
195
|
+
#### Mutation Testing Mindset
|
|
196
|
+
|
|
197
|
+
For every test, ask: "If I changed the implementation to return a wrong value, would this test catch it?"
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// ✅ Mutation-resistant — changing the discount calculation would fail this
|
|
201
|
+
it('applies 20% discount for premium users', () => {
|
|
202
|
+
expect(calculateTotal({ items: [100], userTier: 'premium' })).toBe(80);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// ❌ NOT mutation-resistant — always passes regardless of implementation
|
|
206
|
+
it('calls calculateDiscount', () => {
|
|
207
|
+
calculateTotal({ items: [100], userTier: 'premium' });
|
|
208
|
+
expect(calculateDiscount).toHaveBeenCalled();
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Contract Tests at Team Boundaries
|
|
213
|
+
|
|
214
|
+
When your code is consumed by other teams/modules, add contract tests:
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
// API Contract Test
|
|
218
|
+
describe('UserAPI contract', () => {
|
|
219
|
+
it('GET /users/:id returns UserResponse schema', async () => {
|
|
220
|
+
const response = await request(app).get('/users/123');
|
|
221
|
+
expect(response.body).toMatchSchema(UserResponseSchema);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('returns standard APIError shape on 404', async () => {
|
|
225
|
+
const response = await request(app).get('/users/nonexistent');
|
|
226
|
+
expect(response.status).toBe(404);
|
|
227
|
+
expect(response.body).toMatchSchema(APIErrorSchema);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// Event Contract Test
|
|
232
|
+
describe('UserCreated event contract', () => {
|
|
233
|
+
it('emits event matching UserCreatedEvent schema', async () => {
|
|
234
|
+
await createUser({ name: 'Test' });
|
|
235
|
+
expect(eventBus.lastEvent).toMatchSchema(UserCreatedEventSchema);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Steps
|
|
241
|
+
|
|
242
|
+
### Step 1/4 — Discover Full Working Set and Plan
|
|
243
|
+
|
|
244
|
+
- **Action** — DiscoverFullWorkingSet:
|
|
245
|
+
- Validate commit_id if provided
|
|
246
|
+
- Gather: committed changes + staged + unstaged + untracked
|
|
247
|
+
- **Full Working Set** = UNION of all sources
|
|
248
|
+
- **Action** — RecordWorkingSet: Write `OUT_DIR/working_set.json`
|
|
249
|
+
- **Action** — BaselineLintFull: Run lint on ALL files in Full Working Set
|
|
250
|
+
- **Action** — MapDependencies: Build import/dep snapshot
|
|
251
|
+
|
|
252
|
+
### Step (2/4) - Risk Assessment & Test Plan
|
|
253
|
+
|
|
254
|
+
- **Action** — InlineRiskCheck: Quick mental triage of changed files
|
|
255
|
+
|
|
256
|
+
**P0 Critical** (thorough coverage required):
|
|
257
|
+
|
|
258
|
+
- Paths containing: `auth`, `payment`, `security`, `crypto`, `session`, `token`
|
|
259
|
+
- Handles: user data mutations, financial transactions, PII, permissions
|
|
260
|
+
- Has `@critical` annotation
|
|
261
|
+
|
|
262
|
+
**P1 Core** (key behaviors):
|
|
263
|
+
|
|
264
|
+
- API handlers, feature components, state management, services
|
|
265
|
+
|
|
266
|
+
**P2 Supporting** (public surface only):
|
|
267
|
+
|
|
268
|
+
- Utils, helpers, hooks, formatters
|
|
269
|
+
|
|
270
|
+
**P3 Skip** (no tests):
|
|
271
|
+
|
|
272
|
+
- Type definitions (`.d.ts`), configs, styles, index barrels, simple wrappers
|
|
273
|
+
|
|
274
|
+
- **Action** — CreateTestPlan: Write 3-7 bullet test plan
|
|
275
|
+
|
|
276
|
+
- Format: `- [P{tier}] {file}: {behavior to test}`
|
|
277
|
+
- P0 files get multiple bullets (all behaviors + error paths)
|
|
278
|
+
- P1 files get 1-2 bullets (happy path + critical errors)
|
|
279
|
+
- P2 files get 1 bullet (public function smoke test)
|
|
280
|
+
- P3 files listed as "SKIP — {reason}"
|
|
281
|
+
|
|
282
|
+
- **Action** - Update`OUT_DIR/working_set.json` with risk tier categorization.
|
|
283
|
+
|
|
284
|
+
### Step (3/4) - Write Tests & Verify
|
|
285
|
+
|
|
286
|
+
- **Action** — DispatchTestWriter: Spawn MULTIPLE @tester subagents IN PARALLEL
|
|
287
|
+
|
|
288
|
+
- **Parallelization Strategy**:
|
|
289
|
+
- Partition test plan items into independent batches (by file or logical grouping)
|
|
290
|
+
- Dispatch one @tester per batch — aim for 3-5 parallel agents for medium scope, up to 8 for large scope
|
|
291
|
+
- Each agent receives: its batch of test plan items, file paths, risk tier context
|
|
292
|
+
- **Critical**: Use a single message with multiple Task tool calls to launch all agents simultaneously
|
|
293
|
+
- **Batching Heuristics**:
|
|
294
|
+
- P0 files: 1 agent per file (thorough coverage requires focus)
|
|
295
|
+
- P1 files: Group 2-3 related files per agent
|
|
296
|
+
- P2 files: Group 3-5 files per agent (lighter coverage)
|
|
297
|
+
- Instruct each: "Write behavioral tests, assert outcomes not calls, mutation-resistant"
|
|
298
|
+
- Wait for all agents to complete before proceeding to lint/test verification
|
|
299
|
+
|
|
300
|
+
- **Action** — RunLint: Execute linter; fix violations
|
|
301
|
+
|
|
302
|
+
- **If** lint fails → autofix first, then manual fix
|
|
303
|
+
- **Else** → continue
|
|
304
|
+
|
|
305
|
+
- **Action** — RunTests: Execute full test suite
|
|
306
|
+
|
|
307
|
+
- **If** tests fail → analyze failure, fix via @tester or direct edit
|
|
308
|
+
- **Else** → continue
|
|
309
|
+
|
|
310
|
+
- **Action** — VerifyQuality: Spot-check 1-2 tests
|
|
311
|
+
|
|
312
|
+
- Confirm: tests assert behaviors, would catch real bugs, survive refactoring
|
|
313
|
+
- **If** test quality poor → rework via @tester
|
|
314
|
+
- **Else** → continue
|
|
315
|
+
|
|
316
|
+
### Step (4/4) - Commit
|
|
317
|
+
|
|
318
|
+
- **Action** — CommitPlanningArtifacts: Gather and commit planning/working docs FIRST
|
|
319
|
+
- Check for uncommitted files in `OUT_DIR/`:
|
|
320
|
+
- `working_set.json` (scope and risk tier categorization)
|
|
321
|
+
- Any other `.md` or `.json` artifacts created during this flow
|
|
322
|
+
- Check for uncommitted docs in `docs/tasks/{branch_name}/` or related planning directories
|
|
323
|
+
- **If** uncommitted planning artifacts exist:
|
|
324
|
+
- Stage all: `git add docs/tasks/{branch_name}/ OUT_DIR/`
|
|
325
|
+
- Commit: `docs(test): add test planning artifacts for {branch_name}`
|
|
326
|
+
|
|
327
|
+
- **Action** — GroupChanges: Organize code changes into logical commits
|
|
328
|
+
|
|
329
|
+
- Group by: feat/fix/refactor/test/chore
|
|
330
|
+
- Tests can be bundled with their feature or separate (your judgment)
|
|
331
|
+
|
|
332
|
+
- **Action** — CommitAll: Create conventional commits for code changes
|
|
333
|
+
|
|
334
|
+
- Format: `type(scope): description`
|
|
335
|
+
- Each commit answers: What changed and why?
|
|
336
|
+
|
|
337
|
+
- **Action** — RenderFooter: Render Next Steps footer using `Skill(spectre-guide)` skill (contains format template and spectre command options)
|
|
338
|
+
|
|
339
|
+
## Next Steps
|
|
340
|
+
|
|
341
|
+
See `Skill(spectre-guide)` skill for footer format and command options.
|
|
342
|
+
|
|
343
|
+
## Success Criteria
|
|
344
|
+
|
|
345
|
+
**Step 1 - Analyze Diff**:
|
|
346
|
+
|
|
347
|
+
- [ ] Scope identified (files changed) and documented
|
|
348
|
+
|
|
349
|
+
- [ ] Behaviors changed listed (not just file names)
|
|
350
|
+
|
|
351
|
+
**Step 2 - Risk Assessment & Test Plan**:
|
|
352
|
+
|
|
353
|
+
- [ ] Each changed file assigned P0-P3 tier
|
|
354
|
+
|
|
355
|
+
- [ ] Test plan created with 3-7 bullets
|
|
356
|
+
|
|
357
|
+
- [ ] P3 files explicitly marked SKIP
|
|
358
|
+
|
|
359
|
+
**Step 3 - Write Tests & Verify**:
|
|
360
|
+
|
|
361
|
+
- [ ] Multiple @tester agents dispatched in parallel (not sequential)
|
|
362
|
+
|
|
363
|
+
- [ ] Test plan partitioned into independent batches
|
|
364
|
+
|
|
365
|
+
- [ ] All agents launched in single message (parallel tool calls)
|
|
366
|
+
|
|
367
|
+
- [ ] P0 files have thorough behavioral coverage
|
|
368
|
+
|
|
369
|
+
- [ ] P1 files have key path coverage
|
|
370
|
+
|
|
371
|
+
- [ ] P2 files have public surface coverage
|
|
372
|
+
|
|
373
|
+
- [ ] P3 files have NO tests (confirmed skipped)
|
|
374
|
+
|
|
375
|
+
- [ ] Lint passes
|
|
376
|
+
|
|
377
|
+
- [ ] All tests pass
|
|
378
|
+
|
|
379
|
+
- [ ] Test quality spot-checked
|
|
380
|
+
|
|
381
|
+
**Step 4 - Commit**:
|
|
382
|
+
|
|
383
|
+
- [ ] Changes grouped logically
|
|
384
|
+
|
|
385
|
+
- [ ] Conventional commit format used
|
|
386
|
+
|
|
387
|
+
- [ ] Single Next Steps footer rendered
|
|
388
|
+
|
|
389
|
+
- [ ] Next steps guide read and options sourced
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "ux_spec"
|
|
3
|
+
description: "Define the User Flows and generate a UX Spec - primary agent"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ux_spec
|
|
8
|
+
|
|
9
|
+
## Input Handling
|
|
10
|
+
|
|
11
|
+
Treat the current command arguments as this workflow's input. When invoked from a slash command, use the forwarded `$ARGUMENTS` value.
|
|
12
|
+
|
|
13
|
+
# ux_spec: Define Exactly How the Feature Works
|
|
14
|
+
|
|
15
|
+
Transform product requirements into a definitive behavioral specification. Two stages: align on user flows, then generate detailed spec. Output: `ux.md` ready for implementation.
|
|
16
|
+
|
|
17
|
+
<ARGUMENTS> $ARGUMENTS </ARGUMENTS>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# STAGE 1: Flow Discovery & Alignment
|
|
22
|
+
|
|
23
|
+
**Goal**: Align on HOW the feature works before specifying details.
|
|
24
|
+
|
|
25
|
+
## Step 1 — Understand the Feature
|
|
26
|
+
|
|
27
|
+
1. **Read requirements**: `docs/tasks/{branch}/task_summary.md` and `docs/tasks/{branch}/specs/prd.md`
|
|
28
|
+
2. **Research patterns**: Find existing screens/components similar to what we're building, note conventions
|
|
29
|
+
3. **Identify journeys**: List user goals, entry points, and completion states
|
|
30
|
+
|
|
31
|
+
## Step 2 — Present User Flows
|
|
32
|
+
|
|
33
|
+
Write each flow as a narrative walkthrough:
|
|
34
|
+
|
|
35
|
+
**Per flow include**: Goal, Entry point, Journey steps (User sees → User does → System responds), Decision points with branches, Success state, Questions where ambiguity exists
|
|
36
|
+
|
|
37
|
+
After writing all flows, prompt:
|
|
38
|
+
|
|
39
|
+
> **User Flows for Review**
|
|
40
|
+
>
|
|
41
|
+
> I've mapped {N} flows: {list with one-line summaries}
|
|
42
|
+
>
|
|
43
|
+
> Please review: Are these the right flows? Any missing? Do journeys feel right? Answer flagged questions.
|
|
44
|
+
>
|
|
45
|
+
> Reply with feedback, or **"Flows approved"** to proceed.
|
|
46
|
+
|
|
47
|
+
**Wait for approval. If feedback → revise and re-present. If approved → Stage 2.**
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# STAGE 2: Detailed Specification
|
|
52
|
+
|
|
53
|
+
**Gate**: Only proceed after explicit flow approval.
|
|
54
|
+
|
|
55
|
+
## Step 3 — Clarify Remaining Details
|
|
56
|
+
|
|
57
|
+
Review approved flows for gaps: component behaviors, edge cases, state definitions.
|
|
58
|
+
|
|
59
|
+
If significant gaps, ask 3-5 targeted questions (empty states, error handling, loading, limits). Save to `clarifications/ux_clarifications_{timestamp}.md`, prompt user to read, incorporate answers.
|
|
60
|
+
|
|
61
|
+
## Step 4 — Write the Specification
|
|
62
|
+
|
|
63
|
+
Generate complete spec with these sections:
|
|
64
|
+
|
|
65
|
+
### Required Sections
|
|
66
|
+
|
|
67
|
+
1. **Overview** — What this feature is, problem it solves, primary user goal (1 paragraph)
|
|
68
|
+
2. **Screens** — Every screen: name, purpose (1 line), navigation relationships
|
|
69
|
+
3. **Flows** — Formalized from Stage 1 with alternate paths (validation fail, cancel, network error)
|
|
70
|
+
4. **Layouts** — Per screen: header/main/footer structure + responsive behavior (desktop >1024, tablet 768-1024, mobile <768)
|
|
71
|
+
5. **Components** — Each interactive element: purpose, location, states (default, hover, active, disabled, loading, error)
|
|
72
|
+
6. **Interactions** — Table format: Element | Action | Result (exhaustive)
|
|
73
|
+
7. **States** — Table format: State | Trigger | Appearance | Available Actions (empty, loading, loaded, error)
|
|
74
|
+
8. **Content** — Exact copy: page titles, buttons, empty states, error messages, confirmation dialogs
|
|
75
|
+
9. **Edge Cases** — Limits/boundaries, null/long data handling, permissions, offline/network failures
|
|
76
|
+
10. **Accessibility** — Tab order, keyboard actions (Enter/Space/Escape), screen reader announcements, focus management
|
|
77
|
+
|
|
78
|
+
Save to `docs/tasks/{branch}/ux.md`
|
|
79
|
+
|
|
80
|
+
Prompt:
|
|
81
|
+
|
|
82
|
+
> **UX Specification Complete**
|
|
83
|
+
>
|
|
84
|
+
> Written to `{path}`. Please review: Any behaviors wrong or missing? Edge cases not covered?
|
|
85
|
+
>
|
|
86
|
+
> Reply with feedback, or **"Approved"** to finalize.
|
|
87
|
+
|
|
88
|
+
**Wait for approval.**
|
|
89
|
+
|
|
90
|
+
## Step 5 — Handoff
|
|
91
|
+
|
|
92
|
+
Confirm completion with summary: screens specified, flows documented, components with states, edge cases and accessibility covered.
|
|
93
|
+
|
|
94
|
+
Read `.spectre/next_steps_guide.md` and render Next Steps footer:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Next Steps | Phase: Scope | Status: UX Complete
|
|
98
|
+
Recommendation: {contextual next action}
|
|
99
|
+
Options: /create_plan, /create_tasks, /tdd
|
|
100
|
+
```
|