liteagents 2.9.0 → 2.11.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 +43 -0
- package/README.md +27 -33
- package/installer/cli.js +6 -2
- package/package.json +3 -3
- package/packages/ampcode/AGENT.md +11 -16
- package/packages/ampcode/agents/code-developer.md +11 -12
- package/packages/ampcode/agents/quality-assurance.md +1 -1
- package/packages/{droid/commands/systematic-debugging.md → ampcode/commands/debug-method.md} +9 -9
- package/packages/ampcode/commands/diff-review.md +78 -0
- package/packages/ampcode/commands/friction/friction.js +28 -6
- package/packages/ampcode/commands/optimize.md +45 -4
- package/packages/ampcode/commands/refactor.md +33 -1
- package/packages/ampcode/commands/release.md +88 -0
- package/packages/ampcode/commands/remember.md +34 -3
- package/packages/ampcode/commands/security.md +28 -1
- package/packages/ampcode/commands/stash.md +7 -0
- package/packages/{droid/commands/test-driven-development.md → ampcode/commands/tdd-flow.md} +2 -2
- package/packages/ampcode/commands/test-generate.md +64 -15
- package/packages/{opencode/command/testing-anti-patterns.md → ampcode/commands/test-traps.md} +77 -3
- package/packages/{droid/commands/root-cause-tracing.md → ampcode/commands/trace-back.md} +3 -3
- package/packages/ampcode/commands/{verification-before-completion.md → verify-done.md} +3 -3
- package/packages/claude/CLAUDE.md +10 -15
- package/packages/claude/agents/code-developer.md +11 -12
- package/packages/claude/agents/quality-assurance.md +1 -1
- package/packages/claude/commands/diff-review.md +78 -0
- package/packages/claude/commands/friction/friction.js +28 -6
- package/packages/claude/commands/optimize.md +45 -4
- package/packages/claude/commands/refactor.md +33 -1
- package/packages/claude/commands/release.md +88 -0
- package/packages/claude/commands/remember.md +34 -3
- package/packages/claude/commands/security.md +28 -1
- package/packages/claude/commands/stash.md +7 -0
- package/packages/claude/commands/test-generate.md +64 -15
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package-lock.json +3 -3
- package/packages/claude/skills/{systematic-debugging → debug-method}/CREATION-LOG.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/SKILL.md +9 -9
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-academic.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-1.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-2.md +1 -1
- package/packages/claude/skills/{systematic-debugging → debug-method}/test-pressure-3.md +1 -1
- package/packages/claude/skills/{test-driven-development → tdd-flow}/SKILL.md +3 -3
- package/packages/claude/skills/{testing-anti-patterns → test-traps}/SKILL.md +77 -3
- package/packages/claude/skills/{root-cause-tracing → trace-back}/SKILL.md +3 -3
- package/packages/claude/skills/{verification-before-completion → verify-done}/SKILL.md +3 -3
- package/packages/droid/AGENTS.md +9 -14
- package/packages/{opencode/command/systematic-debugging.md → droid/commands/debug-method.md} +9 -9
- package/packages/droid/commands/diff-review.md +78 -0
- package/packages/droid/commands/friction/friction.js +28 -6
- package/packages/droid/commands/optimize.md +45 -4
- package/packages/droid/commands/refactor.md +33 -1
- package/packages/droid/commands/release.md +88 -0
- package/packages/droid/commands/remember.md +34 -3
- package/packages/droid/commands/security.md +28 -1
- package/packages/droid/commands/stash.md +7 -0
- package/packages/{opencode/command/test-driven-development.md → droid/commands/tdd-flow.md} +2 -2
- package/packages/droid/commands/test-generate.md +64 -15
- package/packages/droid/commands/{testing-anti-patterns.md → test-traps.md} +77 -3
- package/packages/{opencode/command/root-cause-tracing.md → droid/commands/trace-back.md} +3 -3
- package/packages/droid/commands/{verification-before-completion.md → verify-done.md} +3 -3
- package/packages/droid/droids/code-developer.md +11 -12
- package/packages/droid/droids/quality-assurance.md +1 -1
- package/packages/opencode/AGENTS.md +9 -14
- package/packages/opencode/agent/code-developer.md +11 -12
- package/packages/opencode/agent/quality-assurance.md +1 -1
- package/packages/{ampcode/commands/systematic-debugging.md → opencode/command/debug-method.md} +9 -9
- package/packages/opencode/command/diff-review.md +78 -0
- package/packages/opencode/command/friction/friction.js +28 -6
- package/packages/opencode/command/optimize.md +45 -4
- package/packages/opencode/command/refactor.md +33 -1
- package/packages/opencode/command/release.md +88 -0
- package/packages/opencode/command/remember.md +34 -3
- package/packages/opencode/command/security.md +28 -1
- package/packages/opencode/command/stash.md +7 -0
- package/packages/{ampcode/commands/test-driven-development.md → opencode/command/tdd-flow.md} +2 -2
- package/packages/opencode/command/test-generate.md +64 -15
- package/packages/{ampcode/commands/testing-anti-patterns.md → opencode/command/test-traps.md} +77 -3
- package/packages/{ampcode/commands/root-cause-tracing.md → opencode/command/trace-back.md} +3 -3
- package/packages/opencode/command/{verification-before-completion.md → verify-done.md} +3 -3
- package/packages/opencode/opencode.jsonc +16 -36
- package/packages/subagentic-manual.md +56 -51
- package/packages/ampcode/commands/code-review.md +0 -107
- package/packages/ampcode/commands/condition-based-waiting.md +0 -122
- package/packages/ampcode/commands/debug.md +0 -20
- package/packages/ampcode/commands/explain.md +0 -18
- package/packages/ampcode/commands/friction.md +0 -139
- package/packages/ampcode/commands/git-commit.md +0 -14
- package/packages/ampcode/commands/review.md +0 -18
- package/packages/claude/commands/debug.md +0 -20
- package/packages/claude/commands/explain.md +0 -18
- package/packages/claude/commands/friction.md +0 -139
- package/packages/claude/commands/git-commit.md +0 -14
- package/packages/claude/commands/review.md +0 -18
- package/packages/claude/skills/code-review/SKILL.md +0 -107
- package/packages/claude/skills/code-review/code-reviewer.md +0 -146
- package/packages/claude/skills/condition-based-waiting/SKILL.md +0 -122
- package/packages/droid/commands/code-review.md +0 -107
- package/packages/droid/commands/condition-based-waiting.md +0 -122
- package/packages/droid/commands/debug.md +0 -20
- package/packages/droid/commands/explain.md +0 -18
- package/packages/droid/commands/friction.md +0 -139
- package/packages/droid/commands/git-commit.md +0 -14
- package/packages/droid/commands/review.md +0 -18
- package/packages/opencode/command/code-review.md +0 -107
- package/packages/opencode/command/condition-based-waiting.md +0 -122
- package/packages/opencode/command/debug.md +0 -20
- package/packages/opencode/command/explain.md +0 -18
- package/packages/opencode/command/friction.md +0 -139
- package/packages/opencode/command/git-commit.md +0 -14
- package/packages/opencode/command/review.md +0 -18
- /package/packages/ampcode/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/ampcode/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
- /package/packages/claude/skills/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/claude/skills/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
- /package/packages/droid/commands/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/droid/commands/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
- /package/packages/opencode/command/{condition-based-waiting → test-traps}/example.ts +0 -0
- /package/packages/opencode/command/{root-cause-tracing → trace-back}/find-polluter.sh +0 -0
|
@@ -3,7 +3,7 @@ name: security
|
|
|
3
3
|
description: Scan security [target]
|
|
4
4
|
usage: /security
|
|
5
5
|
argument-hint: [file, directory, or leave empty for full scan]
|
|
6
|
-
allowed-tools: Read, Grep, Glob, Bash(git log *), Bash(git grep *), Bash(rg *)
|
|
6
|
+
allowed-tools: Read, Edit, Grep, Glob, Bash(git log *), Bash(git grep *), Bash(rg *)
|
|
7
7
|
---
|
|
8
8
|
Audit $ARGUMENTS for security vulnerabilities. Adapt scope to what the target
|
|
9
9
|
actually is — a library, CLI, web app, and service won't all have every
|
|
@@ -57,3 +57,30 @@ Severity-ranked findings (Critical → High → Medium → Low), each with:
|
|
|
57
57
|
End with: which of the six classes were checked and found **clean**, and any
|
|
58
58
|
marked **N/A** for this target — so the scan's coverage is auditable, not just
|
|
59
59
|
its hits.
|
|
60
|
+
|
|
61
|
+
## After the scan — verify, then fix
|
|
62
|
+
|
|
63
|
+
Findings are claims, not facts. Validate before acting; validate again after.
|
|
64
|
+
|
|
65
|
+
**Verify each claim.** Re-read the cited `file:line` in context. Confirm the
|
|
66
|
+
risk actually holds here — not in the abstract. Mark each **confirmed**, **false
|
|
67
|
+
positive** (with reason), or **uncertain**.
|
|
68
|
+
|
|
69
|
+
**Fix what's confirmed and unambiguous** — minimal shape, one obvious way, no
|
|
70
|
+
change to a public API / response / caller contract. Apply directly. After
|
|
71
|
+
each edit, re-read the changed region and confirm it closes the gap without
|
|
72
|
+
breaking nearby logic. A fix isn't done until you've grounded it the same way
|
|
73
|
+
you grounded the claim.
|
|
74
|
+
|
|
75
|
+
**Stop and ask** when any of these hold (HITL gates — not all the time, only
|
|
76
|
+
here):
|
|
77
|
+
- the finding is **uncertain** after grounding (you'd need info you don't have),
|
|
78
|
+
- the fix has **multiple reasonable shapes** (e.g. reject-vs-sanitize,
|
|
79
|
+
index-vs-paginate) — present options with tradeoffs, not a chosen path,
|
|
80
|
+
- it **affects downstream** (function signatures, response shape, DB schema,
|
|
81
|
+
any caller contract), or
|
|
82
|
+
- it touches **auth / crypto / session / token** primitives — even an "obvious"
|
|
83
|
+
fix here warrants confirmation.
|
|
84
|
+
|
|
85
|
+
Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why + options)
|
|
86
|
+
· **false-positive** (why) · **uncertain** (what's needed to decide).
|
|
@@ -17,6 +17,13 @@ Save session context for compaction recovery or handoffs.
|
|
|
17
17
|
3. Stores important findings and insights
|
|
18
18
|
4. Creates stash file in `.factory/stash/`
|
|
19
19
|
5. Enables context restoration after compaction
|
|
20
|
+
6. **Consolidation nudge** — after saving, count the unprocessed backlog:
|
|
21
|
+
`unprocessed = (files in .factory/stash/*.md) − (entries in .factory/memory/.processed)`
|
|
22
|
+
(a missing `.processed` manifest means 0 processed). If `unprocessed >= 5`, end with one line:
|
|
23
|
+
> 📝 N stashes since last consolidation — run `/remember` to fold them into memory.
|
|
24
|
+
|
|
25
|
+
No counter is stored — the count is derived each time, and running `/remember` updates
|
|
26
|
+
`.processed`, so the backlog drops on its own. Just emit the nudge; never run `/remember` automatically.
|
|
20
27
|
|
|
21
28
|
**When to use**
|
|
22
29
|
- Before long-running tasks that may trigger compaction
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: tdd-flow
|
|
3
3
|
description: Use when implementing any feature or bugfix, before writing implementation code - write the test first, watch it fail, write minimal code to pass; ensures tests actually verify behavior by requiring failure first
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# TDD Flow
|
|
7
7
|
|
|
8
8
|
## Auto-Trigger
|
|
9
9
|
|
|
@@ -1,18 +1,67 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: test-generate
|
|
3
|
-
description: Generate tests [file]
|
|
4
|
-
usage: /test-generate <
|
|
5
|
-
argument-hint: [file
|
|
3
|
+
description: Generate and run tests [file]
|
|
4
|
+
usage: /test-generate <file>
|
|
5
|
+
argument-hint: [file or symbol to test]
|
|
6
|
+
allowed-tools: Read, Edit, Write, Grep, Glob, Bash(npm test *), Bash(npx jest *), Bash(npx vitest *), Bash(pnpm test *), Bash(yarn test *), Bash(pytest *), Bash(python *), Bash(go test *), Bash(cargo test *), Bash(make test *)
|
|
6
7
|
---
|
|
7
|
-
Generate tests for $ARGUMENTS.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
Generate tests for $ARGUMENTS, then run them. This is a generate → run →
|
|
9
|
+
verify loop, not just file generation.
|
|
10
|
+
|
|
11
|
+
## 1. Discover
|
|
12
|
+
- Detect the test framework already in use (look for `jest.config*`,
|
|
13
|
+
`vitest.config*`, `pytest.ini` / `pyproject.toml [tool.pytest]`, Go's
|
|
14
|
+
`_test.go` convention, `Cargo.toml [dev-dependencies]`, etc.). **Never
|
|
15
|
+
add a new framework or runner.**
|
|
16
|
+
- Skim 1–2 existing test files near the target to mirror style, fixtures,
|
|
17
|
+
setup/teardown, assertion style, and naming convention.
|
|
18
|
+
|
|
19
|
+
## 2. Generate
|
|
20
|
+
Cover:
|
|
21
|
+
- **Happy path** (expected usage)
|
|
22
|
+
- **Edges** (empty / null / boundary / malformed)
|
|
23
|
+
- **Errors** (invalid input, IO / network / DB failures)
|
|
24
|
+
|
|
25
|
+
Match existing patterns:
|
|
26
|
+
- Same framework, same fixture style, same naming convention.
|
|
27
|
+
- Reuse existing setup/teardown helpers; do **not** add new mock libraries
|
|
28
|
+
or new test-runner config.
|
|
29
|
+
- Do **not** add test-only public methods or exports to production code to
|
|
30
|
+
make a test possible — if the test wants a hook the prod code doesn't
|
|
31
|
+
expose, stop and ask (`test-traps` territory).
|
|
32
|
+
|
|
33
|
+
## 3. Run
|
|
34
|
+
Execute the project's real test command, scoped to just the new tests
|
|
35
|
+
(`-t <name>`, `--testPathPattern`, `pytest path/to/test.py`, `go test
|
|
36
|
+
./pkg`, etc.). Report:
|
|
37
|
+
- Pass / fail counts.
|
|
38
|
+
- Any failure with the assertion message and `file:line`.
|
|
39
|
+
|
|
40
|
+
## 4. Verify the tests BITE
|
|
41
|
+
A test that passes is not the same as a test that **exercises** the code.
|
|
42
|
+
For each new test, confirm:
|
|
43
|
+
- It would fail if the function under test returned the wrong value.
|
|
44
|
+
Mentally swap a broken impl — does the assertion actually catch it?
|
|
45
|
+
- It isn't `expect(true).toBe(true)`, `expect(fn).toBeDefined()`, or a
|
|
46
|
+
mock asserting itself.
|
|
47
|
+
- It isn't passing only because the setup masked the real call.
|
|
48
|
+
|
|
49
|
+
Mark each new test **biting** or **superficial** (with reason).
|
|
50
|
+
Superficial tests count as a failure to ship — either fix or delete.
|
|
51
|
+
|
|
52
|
+
## 5. Report
|
|
53
|
+
- Files added / modified.
|
|
54
|
+
- Pass / fail.
|
|
55
|
+
- Biting vs superficial breakdown.
|
|
56
|
+
- What was deliberately **not** tested, and why (third-party shims,
|
|
57
|
+
trivial getters/setters, generated code). Documented gaps beat fake
|
|
58
|
+
coverage.
|
|
59
|
+
|
|
60
|
+
**Stop and ask** when:
|
|
61
|
+
- A meaningful test would require a non-obvious design change to
|
|
62
|
+
production code (don't pollute prod to make tests pass — present the
|
|
63
|
+
options instead).
|
|
64
|
+
- The existing test setup has multiple reasonable patterns and it's
|
|
65
|
+
unclear which to mirror.
|
|
66
|
+
- An existing dependency would need to be mocked in a way the project
|
|
67
|
+
doesn't currently do (introducing a new mock style is a design choice).
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: test-traps
|
|
3
3
|
description: Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies
|
|
4
|
-
usage: /
|
|
4
|
+
usage: /test-traps <testing-scenario>
|
|
5
5
|
auto_trigger: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Test Traps
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
@@ -253,6 +253,79 @@ TDD cycle:
|
|
|
253
253
|
4. THEN claim complete
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
+
## Anti-Pattern 6: Timeout-Based Waiting
|
|
257
|
+
|
|
258
|
+
**The violation:**
|
|
259
|
+
```typescript
|
|
260
|
+
// Wait an arbitrary amount of time, then check
|
|
261
|
+
await new Promise(r => setTimeout(r, 50));
|
|
262
|
+
const result = getResult();
|
|
263
|
+
expect(result).toBeDefined();
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
time.sleep(0.5)
|
|
268
|
+
assert get_result() is not None
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Why this is wrong:**
|
|
272
|
+
- Passes on fast machines, fails in CI under load (or vice versa).
|
|
273
|
+
- Either too short (flaky) or too long (slow suite) — every value is wrong somewhere.
|
|
274
|
+
- Hides the actual condition the test cares about.
|
|
275
|
+
- A real bug in the async machinery looks identical to a "too-short sleep."
|
|
276
|
+
|
|
277
|
+
**The fix — poll for the actual condition:**
|
|
278
|
+
```typescript
|
|
279
|
+
await waitFor(() => getResult() !== undefined);
|
|
280
|
+
const result = getResult();
|
|
281
|
+
expect(result).toBeDefined();
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
| Scenario | Pattern |
|
|
285
|
+
|----------|---------|
|
|
286
|
+
| Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
|
|
287
|
+
| Wait for state | `waitFor(() => machine.state === 'ready')` |
|
|
288
|
+
| Wait for count | `waitFor(() => items.length >= 5)` |
|
|
289
|
+
| Wait for file | `waitFor(() => fs.existsSync(path))` |
|
|
290
|
+
| Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
|
|
291
|
+
|
|
292
|
+
Minimal generic poller:
|
|
293
|
+
```typescript
|
|
294
|
+
async function waitFor<T>(
|
|
295
|
+
condition: () => T | undefined | null | false,
|
|
296
|
+
description = 'condition',
|
|
297
|
+
timeoutMs = 5000
|
|
298
|
+
): Promise<T> {
|
|
299
|
+
const start = Date.now();
|
|
300
|
+
while (true) {
|
|
301
|
+
const result = condition();
|
|
302
|
+
if (result) return result;
|
|
303
|
+
if (Date.now() - start > timeoutMs) {
|
|
304
|
+
throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
|
|
305
|
+
}
|
|
306
|
+
await new Promise(r => setTimeout(r, 10));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
See `example.ts` for domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) drawn from a real debugging session.
|
|
312
|
+
|
|
313
|
+
**Polling pitfalls:**
|
|
314
|
+
- **Polling too fast** (`setTimeout(check, 1)`) wastes CPU. **Fix:** poll every ~10ms.
|
|
315
|
+
- **No timeout** means a never-met condition hangs the suite forever. **Fix:** always include a timeout with a descriptive error.
|
|
316
|
+
- **Stale data** — if you read state once before the loop, you'll never see updates. **Fix:** call the getter *inside* the loop.
|
|
317
|
+
|
|
318
|
+
**When an arbitrary timeout IS correct:**
|
|
319
|
+
```typescript
|
|
320
|
+
// Tool ticks every 100ms; observe 2 ticks of partial output.
|
|
321
|
+
await waitForEvent(manager, 'TOOL_STARTED'); // condition first
|
|
322
|
+
await new Promise(r => setTimeout(r, 200)); // then a documented, calculated wait
|
|
323
|
+
// 200ms = 2 ticks at the documented 100ms cadence
|
|
324
|
+
```
|
|
325
|
+
Requirements: (1) wait for the triggering condition first, (2) the delay is based on a *known* interval (not a guess), (3) a comment explains why a sleep is correct here.
|
|
326
|
+
|
|
327
|
+
**Real-world impact** (debugging session, 2025-10-03): 15 flaky tests across 3 files, pass rate 60% → 100%, suite 40% faster, race conditions gone.
|
|
328
|
+
|
|
256
329
|
## When Mocks Become Too Complex
|
|
257
330
|
|
|
258
331
|
**Warning signs:**
|
|
@@ -284,6 +357,7 @@ TDD cycle:
|
|
|
284
357
|
| Mock without understanding | Understand dependencies first, mock minimally |
|
|
285
358
|
| Incomplete mocks | Mirror real API completely |
|
|
286
359
|
| Tests as afterthought | TDD - tests first |
|
|
360
|
+
| Timeout-based waiting | Poll for the actual condition with `waitFor()` |
|
|
287
361
|
| Over-complex mocks | Consider integration tests |
|
|
288
362
|
|
|
289
363
|
## Red Flags
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: trace-back
|
|
3
3
|
description: Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior
|
|
4
|
-
usage: /
|
|
4
|
+
usage: /trace-back <issue-description>
|
|
5
5
|
auto_trigger: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Trace Back
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: verify-done
|
|
3
3
|
description: Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
|
|
4
|
-
usage: /
|
|
4
|
+
usage: /verify-done <work-to-verify>
|
|
5
5
|
auto_trigger: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Verify Done
|
|
9
9
|
|
|
10
10
|
## Auto-Trigger
|
|
11
11
|
|
|
@@ -41,7 +41,7 @@ digraph CodeDeveloper {
|
|
|
41
41
|
context_discovery [label="Context Discovery\n(search related code,\ndeps, usages)", fillcolor=lightyellow];
|
|
42
42
|
|
|
43
43
|
// Debug path
|
|
44
|
-
use_debug [label="Use /
|
|
44
|
+
use_debug [label="Use /debug-method\nor /trace-back"];
|
|
45
45
|
|
|
46
46
|
// Refactor path
|
|
47
47
|
use_refactor [label="Use /refactor"];
|
|
@@ -54,12 +54,12 @@ digraph CodeDeveloper {
|
|
|
54
54
|
|
|
55
55
|
// Conditional testing
|
|
56
56
|
tdd_needed [label="TDD specified\nor tests needed?", shape=diamond];
|
|
57
|
-
use_tdd [label="Use /
|
|
57
|
+
use_tdd [label="Use /tdd-flow\nor /test-generate"];
|
|
58
58
|
|
|
59
59
|
// Validation
|
|
60
60
|
run_validations [label="Run validations\n(lint, build, tests)"];
|
|
61
61
|
validations_pass [label="Pass?", shape=diamond];
|
|
62
|
-
fix_issues [label="Fix issues\n(use /debug if needed)"];
|
|
62
|
+
fix_issues [label="Fix issues\n(use /debug-method if needed)"];
|
|
63
63
|
failure_count [label="3+ failures?", shape=diamond];
|
|
64
64
|
|
|
65
65
|
// Security check
|
|
@@ -75,8 +75,8 @@ digraph CodeDeveloper {
|
|
|
75
75
|
regression_fixable [label="Fixable?", shape=diamond];
|
|
76
76
|
|
|
77
77
|
// Review and complete
|
|
78
|
-
code_review [label="Run /
|
|
79
|
-
verification [label="Run /
|
|
78
|
+
code_review [label="Run /diff-review"];
|
|
79
|
+
verification [label="Run /verify-done", fillcolor=orange];
|
|
80
80
|
|
|
81
81
|
// Story-specific
|
|
82
82
|
update_story [label="Update story\n(checkbox, changelog)"];
|
|
@@ -184,15 +184,14 @@ All require `*` prefix. Invocation commands in table above. Additional:
|
|
|
184
184
|
|
|
185
185
|
| Situation | Delegate To |
|
|
186
186
|
|-----------|-------------|
|
|
187
|
-
| Bug encountered | `/
|
|
188
|
-
| Error deep in stack | `/
|
|
187
|
+
| Bug encountered | `/debug-method` (use `/trace-back` when the error is deep in the stack) |
|
|
188
|
+
| Error deep in stack | `/trace-back` |
|
|
189
189
|
| Refactoring code | `/refactor` |
|
|
190
|
-
| Need tests (when required) | `/test-generate` or `/
|
|
191
|
-
| Writing any test | `/
|
|
192
|
-
| Before completion | `/
|
|
190
|
+
| Need tests (when required) | `/test-generate` or `/tdd-flow` |
|
|
191
|
+
| Writing any test | `/test-traps` (avoid mocks, production pollution) |
|
|
192
|
+
| Before completion | `/verify-done` |
|
|
193
193
|
| After code changes | `/security` |
|
|
194
|
-
| Task complete
|
|
195
|
-
| General code review | `/review` (comprehensive quality check) |
|
|
194
|
+
| Task complete / general review | `/diff-review` (diffs branch or staged changes, verifies, fixes confirmed issues, asks on ambiguous ones) |
|
|
196
195
|
| Performance issues | `/optimize` |
|
|
197
196
|
|
|
198
197
|
You are an autonomous implementation specialist. Execute with precision, delegate appropriately, and communicate clearly when you need guidance or encounter blockers.
|
|
@@ -65,7 +65,7 @@ Before any analysis, read (if exists):
|
|
|
65
65
|
|
|
66
66
|
## Slash Commands Available
|
|
67
67
|
|
|
68
|
-
Use these during analysis: `/
|
|
68
|
+
Use these during analysis: `/diff-review`, `/security`, `/verify-done`
|
|
69
69
|
|
|
70
70
|
## Analysis Areas
|
|
71
71
|
|
|
@@ -22,33 +22,28 @@ These subagents are available when using Claude Code CLI. Opencode can reference
|
|
|
22
22
|
| system-architect | Architect | Use for system design, architecture documents, technology selection, API design, and infrastructure planning |
|
|
23
23
|
| ui-designer | UX Expert | Use for UI/UX design, wireframes, prototypes, front-end specifications, and user experience optimization |
|
|
24
24
|
|
|
25
|
-
## Opencode Commands (
|
|
25
|
+
## Opencode Commands (18 total)
|
|
26
26
|
|
|
27
27
|
| ID | Description | Usage | Auto |
|
|
28
28
|
|---|---|---|---|
|
|
29
29
|
| brainstorming | Refines rough ideas into fully-formed designs through collaborative questioning | /brainstorming <session-type> <topic> | false |
|
|
30
|
-
| code-review | Reviews implementation against plan or requirements before proceeding | /code-review <review-scope> <focus-areas> | false |
|
|
31
|
-
| condition-based-waiting | Replaces arbitrary timeouts with condition polling to wait for actual state changes | /condition-based-waiting <condition-type> <timeout-specs> | false |
|
|
32
|
-
| debug | Debug an issue systematically using structured investigation techniques | /debug <issue-description> | - |
|
|
33
30
|
| docs-builder | Create comprehensive project documentation with structured /docs hierarchy | /docs-builder | false |
|
|
34
|
-
| explain | Explain code for someone new to the codebase | /explain <code-section> | - |
|
|
35
|
-
| friction | Analyze session logs for failure patterns and behavioral signals | /friction <sessions-path> | - |
|
|
36
|
-
| git-commit | Analyze changes and create intelligent git commits | /git-commit | - |
|
|
37
31
|
| live-canvas | Design UI variations and collect click-to-annotate feedback from the browser (batch mode only on Opencode) | /live-canvas | false |
|
|
38
32
|
| optimize | Analyze and optimize performance issues | /optimize <target-area> | - |
|
|
39
33
|
| refactor | Refactor code while maintaining behavior and tests | /refactor <code-section> | - |
|
|
40
34
|
| remember | Consolidate stashes + friction into project memory | /remember | - |
|
|
41
|
-
| review | Comprehensive code review including quality, tests, and architecture | /review | - |
|
|
42
|
-
|
|
|
35
|
+
| diff-review | Comprehensive code review including quality, tests, and architecture | /diff-review | - |
|
|
36
|
+
| trace-back | Systematically traces bugs backward through call stack to identify source | /trace-back <issue-description> | false |
|
|
43
37
|
| security | Security vulnerability scan and analysis | /security | - |
|
|
44
38
|
| ship | Pre-deployment verification checklist | /ship | - |
|
|
39
|
+
| release | Deliver a feature end-to-end: verify, docs, merge, tag (publish stays manual) | /release [branch] | - |
|
|
45
40
|
| skill-creator | Guide for creating effective skills and extending Claude capabilities | /skill-creator <skill-type> <skill-description> | false |
|
|
46
41
|
| stash | Save session context for compaction recovery or handoffs | /stash ["optional-name"] | - |
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| test-generate | Generate
|
|
50
|
-
|
|
|
51
|
-
|
|
|
42
|
+
| debug-method | Four-phase debugging framework - investigate root cause before any fixes | /debug-method <bug-or-error-description> | false |
|
|
43
|
+
| tdd-flow | Write test first, watch it fail, write minimal code to pass | /tdd-flow <feature-or-behavior-to-test> | true |
|
|
44
|
+
| test-generate | Generate tests, run them, verify each one actually exercises the code | /test-generate <file> | - |
|
|
45
|
+
| test-traps | Prevents testing mock behavior and production pollution with test-only methods | /test-traps <testing-scenario> | true |
|
|
46
|
+
| verify-done | Requires running verification commands before making any success claims | /verify-done <work-to-verify> | true |
|
|
52
47
|
|
|
53
48
|
All resources are auto-discovered from frontmatter in their respective directories:
|
|
54
49
|
- **Agents**: `./agent/*.md`
|
|
@@ -45,7 +45,7 @@ digraph CodeDeveloper {
|
|
|
45
45
|
context_discovery [label="Context Discovery\n(search related code,\ndeps, usages)", fillcolor=lightyellow];
|
|
46
46
|
|
|
47
47
|
// Debug path
|
|
48
|
-
use_debug [label="Use /
|
|
48
|
+
use_debug [label="Use /debug-method\nor /trace-back"];
|
|
49
49
|
|
|
50
50
|
// Refactor path
|
|
51
51
|
use_refactor [label="Use /refactor"];
|
|
@@ -58,12 +58,12 @@ digraph CodeDeveloper {
|
|
|
58
58
|
|
|
59
59
|
// Conditional testing
|
|
60
60
|
tdd_needed [label="TDD specified\nor tests needed?", shape=diamond];
|
|
61
|
-
use_tdd [label="Use /
|
|
61
|
+
use_tdd [label="Use /tdd-flow\nor /test-generate"];
|
|
62
62
|
|
|
63
63
|
// Validation
|
|
64
64
|
run_validations [label="Run validations\n(lint, build, tests)"];
|
|
65
65
|
validations_pass [label="Pass?", shape=diamond];
|
|
66
|
-
fix_issues [label="Fix issues\n(use /debug if needed)"];
|
|
66
|
+
fix_issues [label="Fix issues\n(use /debug-method if needed)"];
|
|
67
67
|
failure_count [label="3+ failures?", shape=diamond];
|
|
68
68
|
|
|
69
69
|
// Security check
|
|
@@ -79,8 +79,8 @@ digraph CodeDeveloper {
|
|
|
79
79
|
regression_fixable [label="Fixable?", shape=diamond];
|
|
80
80
|
|
|
81
81
|
// Review and complete
|
|
82
|
-
code_review [label="Run /
|
|
83
|
-
verification [label="Run /
|
|
82
|
+
code_review [label="Run /diff-review"];
|
|
83
|
+
verification [label="Run /verify-done", fillcolor=orange];
|
|
84
84
|
|
|
85
85
|
// Story-specific
|
|
86
86
|
update_story [label="Update story\n(checkbox, changelog)"];
|
|
@@ -188,15 +188,14 @@ All require `*` prefix. Invocation commands in table above. Additional:
|
|
|
188
188
|
|
|
189
189
|
| Situation | Delegate To |
|
|
190
190
|
|-----------|-------------|
|
|
191
|
-
| Bug encountered | `/
|
|
192
|
-
| Error deep in stack | `/
|
|
191
|
+
| Bug encountered | `/debug-method` (use `/trace-back` when the error is deep in the stack) |
|
|
192
|
+
| Error deep in stack | `/trace-back` |
|
|
193
193
|
| Refactoring code | `/refactor` |
|
|
194
|
-
| Need tests (when required) | `/test-generate` or `/
|
|
195
|
-
| Writing any test | `/
|
|
196
|
-
| Before completion | `/
|
|
194
|
+
| Need tests (when required) | `/test-generate` or `/tdd-flow` |
|
|
195
|
+
| Writing any test | `/test-traps` (avoid mocks, production pollution) |
|
|
196
|
+
| Before completion | `/verify-done` |
|
|
197
197
|
| After code changes | `/security` |
|
|
198
|
-
| Task complete
|
|
199
|
-
| General code review | `/review` (comprehensive quality check) |
|
|
198
|
+
| Task complete / general review | `/diff-review` (diffs branch or staged changes, verifies, fixes confirmed issues, asks on ambiguous ones) |
|
|
200
199
|
| Performance issues | `/optimize` |
|
|
201
200
|
|
|
202
201
|
You are an autonomous implementation specialist. Execute with precision, delegate appropriately, and communicate clearly when you need guidance or encounter blockers.
|
|
@@ -69,7 +69,7 @@ Before any analysis, read (if exists):
|
|
|
69
69
|
|
|
70
70
|
## Slash Commands Available
|
|
71
71
|
|
|
72
|
-
Use these during analysis: `/
|
|
72
|
+
Use these during analysis: `/diff-review`, `/security`, `/verify-done`
|
|
73
73
|
|
|
74
74
|
## Analysis Areas
|
|
75
75
|
|
package/packages/{ampcode/commands/systematic-debugging.md → opencode/command/debug-method.md}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: debug-method
|
|
3
3
|
description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes - four-phase framework (root cause investigation, pattern analysis, hypothesis testing, implementation) that ensures understanding before attempting solutions
|
|
4
|
-
usage: /
|
|
4
|
+
usage: /debug-method <bug-or-error-description>
|
|
5
5
|
auto_trigger: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Debug Method
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
@@ -113,7 +113,7 @@ You MUST complete each phase before proceeding to the next.
|
|
|
113
113
|
|
|
114
114
|
**WHEN error is deep in call stack:**
|
|
115
115
|
|
|
116
|
-
**REQUIRED SUB-SKILL:** Use
|
|
116
|
+
**REQUIRED SUB-SKILL:** Use trace-back for backward tracing technique
|
|
117
117
|
|
|
118
118
|
**Quick version:**
|
|
119
119
|
- Where does bad value originate?
|
|
@@ -178,7 +178,7 @@ You MUST complete each phase before proceeding to the next.
|
|
|
178
178
|
- Automated test if possible
|
|
179
179
|
- One-off test script if no framework
|
|
180
180
|
- MUST have before fixing
|
|
181
|
-
- **REQUIRED SUB-SKILL:** Use
|
|
181
|
+
- **REQUIRED SUB-SKILL:** Use tdd-flow for writing proper failing tests
|
|
182
182
|
|
|
183
183
|
2. **Implement Single Fix**
|
|
184
184
|
- Address the root cause identified
|
|
@@ -280,13 +280,13 @@ If systematic investigation reveals issue is truly environmental, timing-depende
|
|
|
280
280
|
## Integration with Other Skills
|
|
281
281
|
|
|
282
282
|
**This skill requires using:**
|
|
283
|
-
- **
|
|
284
|
-
- **
|
|
283
|
+
- **trace-back** - REQUIRED when error is deep in call stack (see Phase 1, Step 5)
|
|
284
|
+
- **tdd-flow** - REQUIRED for creating failing test case (see Phase 4, Step 1)
|
|
285
285
|
|
|
286
286
|
**Complementary skills:**
|
|
287
287
|
- **defense-in-depth** - Add validation at multiple layers after finding root cause
|
|
288
|
-
- **
|
|
289
|
-
- **
|
|
288
|
+
- **test-traps** (Anti-Pattern 6) - Replace arbitrary timeouts identified in Phase 2
|
|
289
|
+
- **verify-done** - Verify fix worked before claiming success
|
|
290
290
|
|
|
291
291
|
## Real-World Impact
|
|
292
292
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diff-review
|
|
3
|
+
description: Review diff [file, branch, or range]
|
|
4
|
+
usage: /diff-review
|
|
5
|
+
argument-hint: [file, branch (e.g. main), range (main..HEAD), or empty]
|
|
6
|
+
allowed-tools: Read, Edit, Grep, Glob, Bash(git diff *), Bash(git log *), Bash(git show *), Bash(git status *), Bash(git grep *), Bash(git rev-parse *), Bash(git merge-base *), Bash(rg *)
|
|
7
|
+
---
|
|
8
|
+
Review $ARGUMENTS. Interpret in this order:
|
|
9
|
+
1. **Empty** → staged diff (`git diff --staged`); if empty, working-tree diff
|
|
10
|
+
(`git diff`).
|
|
11
|
+
2. **A range** like `main..HEAD` or `origin/main...HEAD` → `git diff <range>`.
|
|
12
|
+
3. **A single ref** (branch / tag / SHA — confirm with `git rev-parse
|
|
13
|
+
--verify`) → diff that ref's merge-base against `HEAD` (i.e. everything on
|
|
14
|
+
the current branch since it diverged: `git diff $(git merge-base <ref>
|
|
15
|
+
HEAD)..HEAD`). This is the common "review my branch before merging" path.
|
|
16
|
+
4. **A file or directory path** → that target.
|
|
17
|
+
5. Otherwise → ask.
|
|
18
|
+
|
|
19
|
+
The diff is the subject; widen to surrounding code only as needed to judge a
|
|
20
|
+
hunk. For multi-commit ranges, also skim `git log <range>` to understand
|
|
21
|
+
intent before judging.
|
|
22
|
+
|
|
23
|
+
## Check For
|
|
24
|
+
- **Bugs needing a fix.** Logic errors, off-by-one, null/undefined paths,
|
|
25
|
+
races, wrong defaults, broken edge cases. Concrete failure modes only — not
|
|
26
|
+
vibes.
|
|
27
|
+
- **Dead code.** Unreferenced functions / vars / imports / params, unreachable
|
|
28
|
+
branches, commented-out blocks, legacy paths the diff just obsoleted.
|
|
29
|
+
`git grep` the symbol before flagging — easy to be wrong.
|
|
30
|
+
- **Loose ends.** TODO / FIXME / XXX added by this diff, half-finished
|
|
31
|
+
branches, silently swallowed errors, stub bodies, mocked-out paths,
|
|
32
|
+
"temporary" names, abandoned feature flags.
|
|
33
|
+
- **Correctness.** Edge cases, error handling, type / contract violations,
|
|
34
|
+
broken invariants.
|
|
35
|
+
- **Security.** OWASP Top 10, auth, data exposure. (`/security` for depth.)
|
|
36
|
+
- **Performance.** N+1, blocking calls in hot paths, unbounded loops, indexes
|
|
37
|
+
the diff actually touches.
|
|
38
|
+
- **Maintainability.** Complexity, naming, duplication — only when material.
|
|
39
|
+
|
|
40
|
+
## Output Format
|
|
41
|
+
### 🚨 Critical (blocks merge)
|
|
42
|
+
### ⚠️ Warnings (should fix)
|
|
43
|
+
### 💡 Suggestions (nice to have)
|
|
44
|
+
|
|
45
|
+
Each finding: **Location** (`file:line`), **What's wrong**, **Why it matters**,
|
|
46
|
+
**Concrete fix** — not "consider improving".
|
|
47
|
+
|
|
48
|
+
## After the review — verify, then fix
|
|
49
|
+
|
|
50
|
+
Findings are claims, not facts. Validate before acting; validate again after.
|
|
51
|
+
|
|
52
|
+
**Verify each claim.** Re-read the cited `file:line` in context. For
|
|
53
|
+
dead-code or unused-symbol claims, `git grep` the name across the repo before
|
|
54
|
+
trusting it. Mark each **confirmed**, **false positive** (with reason), or
|
|
55
|
+
**uncertain**.
|
|
56
|
+
|
|
57
|
+
**Fix what's confirmed and unambiguous** — minimal shape, one obvious way, no
|
|
58
|
+
change to a public API / response / caller contract. Apply directly. After
|
|
59
|
+
each edit, re-read the changed region and confirm it does what you intended
|
|
60
|
+
without breaking nearby logic. A fix isn't done until you've grounded it the
|
|
61
|
+
same way you grounded the claim.
|
|
62
|
+
|
|
63
|
+
**Stop and ask** when any of these hold (HITL gates — not all the time, only
|
|
64
|
+
here):
|
|
65
|
+
- the finding is **uncertain** after grounding,
|
|
66
|
+
- the fix has **multiple reasonable shapes** (e.g. delete-vs-keep-behind-flag,
|
|
67
|
+
extract-vs-inline, patch-vs-rewrite) — present options with tradeoffs, not a
|
|
68
|
+
chosen path,
|
|
69
|
+
- it **affects downstream** (signatures, response shape, schema, any caller
|
|
70
|
+
contract) or removes a public/exported symbol, or
|
|
71
|
+
- the "dead code" looks intentionally kept (stub for upcoming work, framework
|
|
72
|
+
hook, documented extension point) — confirm before deleting.
|
|
73
|
+
|
|
74
|
+
Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why +
|
|
75
|
+
options) · **false-positive** (why) · **uncertain** (what's needed to decide).
|
|
76
|
+
|
|
77
|
+
End with a one-line verdict: **Ready to merge? Yes / No / With fixes** — and
|
|
78
|
+
the reason in a sentence.
|