liteagents 3.0.0 → 3.5.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +122 -1
  2. package/README.md +113 -169
  3. package/installer/cli.js +4 -2
  4. package/package.json +4 -3
  5. package/packages/ampcode/AGENT.md +10 -18
  6. package/packages/ampcode/agents/code-developer.md +11 -17
  7. package/packages/ampcode/agents/orchestrator.md +1 -1
  8. package/packages/ampcode/agents/quality-assurance.md +3 -1
  9. package/packages/ampcode/{commands/brainstorming.md → skills/brainstorming/SKILL.md} +2 -3
  10. package/packages/ampcode/{commands/branch-review.md → skills/branch-review/SKILL.md} +13 -13
  11. package/packages/{claude/commands/docs-builder.md → ampcode/skills/docs-builder/SKILL.md} +1 -1
  12. package/packages/ampcode/{commands/live-canvas.md → skills/live-canvas/SKILL.md} +8 -4
  13. package/packages/ampcode/{commands/refactor.md → skills/refactor/SKILL.md} +49 -7
  14. package/packages/ampcode/{commands/release.md → skills/release/SKILL.md} +4 -4
  15. package/packages/{claude/commands → ampcode/skills}/remember/AGENT_RULES.md +44 -84
  16. package/packages/ampcode/{commands/remember.md → skills/remember/SKILL.md} +11 -6
  17. package/packages/ampcode/{commands → skills}/remember/friction.cjs +0 -0
  18. package/packages/ampcode/{commands → skills}/remember/stub-check.cjs +28 -19
  19. package/packages/ampcode/{commands → skills}/remember/sync-rules.cjs +28 -19
  20. package/packages/{claude/commands → ampcode/skills}/remember/version-check.cjs +1 -1
  21. package/packages/ampcode/skills/root-cause/SKILL.md +220 -0
  22. package/packages/ampcode/{commands/trace-back → skills/root-cause}/find-polluter.sh +0 -0
  23. package/packages/{claude/commands/security.md → ampcode/skills/security/SKILL.md} +1 -1
  24. package/packages/{claude/commands/ship.md → ampcode/skills/ship/SKILL.md} +1 -1
  25. package/packages/ampcode/skills/skill-creator/LICENSE.txt +202 -0
  26. package/packages/ampcode/{commands/skill-creator.md → skills/skill-creator/SKILL.md} +1 -2
  27. package/packages/ampcode/{commands → skills}/skill-creator/scripts/init_skill.py +0 -0
  28. package/packages/ampcode/{commands → skills}/skill-creator/scripts/package_skill.py +0 -0
  29. package/packages/ampcode/{commands → skills}/skill-creator/scripts/quick_validate.py +0 -0
  30. package/packages/ampcode/{commands/stash.md → skills/stash/SKILL.md} +2 -1
  31. package/packages/{claude/commands/test-generate.md → ampcode/skills/test-generate/SKILL.md} +2 -2
  32. package/packages/ampcode/variants.json +2 -2
  33. package/packages/claude/CLAUDE.md +10 -17
  34. package/packages/claude/agents/code-developer.md +11 -17
  35. package/packages/claude/agents/orchestrator.md +2 -3
  36. package/packages/claude/agents/quality-assurance.md +3 -1
  37. package/packages/claude/skills/brainstorming/SKILL.md +1 -2
  38. package/packages/claude/{commands/branch-review.md → skills/branch-review/SKILL.md} +1 -1
  39. package/packages/{ampcode/commands/docs-builder.md → claude/skills/docs-builder/SKILL.md} +7 -7
  40. package/packages/claude/skills/live-canvas/SKILL.md +5 -1
  41. package/packages/claude/{commands/refactor.md → skills/refactor/SKILL.md} +45 -3
  42. package/packages/claude/{commands/release.md → skills/release/SKILL.md} +1 -1
  43. package/packages/{ampcode/commands → claude/skills}/remember/AGENT_RULES.md +38 -78
  44. package/packages/claude/{commands/remember.md → skills/remember/SKILL.md} +11 -6
  45. package/packages/claude/{commands → skills}/remember/friction.cjs +0 -0
  46. package/packages/claude/{commands → skills}/remember/stub-check.cjs +28 -19
  47. package/packages/claude/{commands → skills}/remember/sync-rules.cjs +28 -19
  48. package/packages/{ampcode/commands → claude/skills}/remember/version-check.cjs +3 -3
  49. package/packages/claude/skills/root-cause/SKILL.md +220 -0
  50. package/packages/{ampcode/commands/security.md → claude/skills/security/SKILL.md} +2 -2
  51. package/packages/{ampcode/commands/ship.md → claude/skills/ship/SKILL.md} +2 -2
  52. package/packages/claude/skills/skill-creator/SKILL.md +1 -2
  53. package/packages/claude/{commands/stash.md → skills/stash/SKILL.md} +2 -1
  54. package/packages/{ampcode/commands/test-generate.md → claude/skills/test-generate/SKILL.md} +3 -3
  55. package/packages/claude/variants.json +1 -2
  56. package/packages/droid/AGENTS.md +10 -15
  57. package/packages/droid/commands/brainstorming.md +1 -4
  58. package/packages/droid/commands/branch-review.md +11 -14
  59. package/packages/droid/commands/docs-builder.md +0 -3
  60. package/packages/droid/commands/live-canvas.md +7 -5
  61. package/packages/droid/commands/refactor.md +47 -8
  62. package/packages/droid/commands/release.md +2 -5
  63. package/packages/droid/commands/remember/AGENT_RULES.md +38 -78
  64. package/packages/droid/commands/remember/stub-check.cjs +28 -19
  65. package/packages/droid/commands/remember/sync-rules.cjs +28 -19
  66. package/packages/droid/commands/remember/version-check.cjs +1 -1
  67. package/packages/droid/commands/remember.md +6 -4
  68. package/packages/droid/commands/root-cause.md +218 -0
  69. package/packages/droid/commands/security.md +0 -3
  70. package/packages/droid/commands/ship.md +0 -3
  71. package/packages/droid/commands/skill-creator/LICENSE.txt +202 -0
  72. package/packages/droid/commands/skill-creator.md +0 -4
  73. package/packages/droid/commands/stash.md +0 -2
  74. package/packages/droid/commands/test-generate.md +1 -4
  75. package/packages/droid/droids/1-create-prd.md +6 -2
  76. package/packages/droid/droids/2-generate-tasks.md +1 -2
  77. package/packages/droid/droids/3-process-task-list.md +1 -2
  78. package/packages/droid/droids/code-developer.md +12 -19
  79. package/packages/droid/droids/feature-planner.md +1 -2
  80. package/packages/droid/droids/market-researcher.md +1 -2
  81. package/packages/droid/droids/orchestrator.md +1 -2
  82. package/packages/droid/droids/quality-assurance.md +4 -3
  83. package/packages/droid/droids/system-architect.md +1 -2
  84. package/packages/droid/droids/ui-designer.md +1 -2
  85. package/packages/opencode/AGENTS.md +10 -15
  86. package/packages/opencode/agent/code-developer.md +11 -17
  87. package/packages/opencode/agent/quality-assurance.md +3 -1
  88. package/packages/opencode/command/brainstorming.md +1 -4
  89. package/packages/opencode/command/branch-review.md +11 -15
  90. package/packages/opencode/command/docs-builder.md +0 -4
  91. package/packages/opencode/command/live-canvas.md +7 -5
  92. package/packages/opencode/command/refactor.md +47 -9
  93. package/packages/opencode/command/release.md +2 -5
  94. package/packages/opencode/command/remember/AGENT_RULES.md +38 -78
  95. package/packages/opencode/command/remember/stub-check.cjs +28 -19
  96. package/packages/opencode/command/remember/sync-rules.cjs +28 -19
  97. package/packages/opencode/command/remember/version-check.cjs +1 -1
  98. package/packages/opencode/command/remember.md +6 -4
  99. package/packages/opencode/command/root-cause.md +218 -0
  100. package/packages/opencode/command/security.md +0 -4
  101. package/packages/opencode/command/ship.md +0 -3
  102. package/packages/opencode/command/skill-creator/LICENSE.txt +202 -0
  103. package/packages/opencode/command/skill-creator.md +0 -4
  104. package/packages/opencode/command/stash.md +0 -3
  105. package/packages/opencode/command/test-generate.md +1 -5
  106. package/packages/opencode/opencode.jsonc +4 -24
  107. package/packages/subagentic-manual.md +147 -314
  108. package/packages/ampcode/commands/debug-method.md +0 -297
  109. package/packages/ampcode/commands/live-canvas/README.md +0 -264
  110. package/packages/ampcode/commands/optimize.md +0 -61
  111. package/packages/ampcode/commands/tdd-flow.md +0 -390
  112. package/packages/ampcode/commands/test-traps/example.ts +0 -158
  113. package/packages/ampcode/commands/test-traps.md +0 -378
  114. package/packages/ampcode/commands/trace-back.md +0 -176
  115. package/packages/ampcode/commands/verify-done.md +0 -152
  116. package/packages/claude/commands/optimize.md +0 -61
  117. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md +0 -89
  118. package/packages/claude/skills/debug-method/CREATION-LOG.md +0 -119
  119. package/packages/claude/skills/debug-method/SKILL.md +0 -296
  120. package/packages/claude/skills/debug-method/test-academic.md +0 -14
  121. package/packages/claude/skills/debug-method/test-pressure-1.md +0 -58
  122. package/packages/claude/skills/debug-method/test-pressure-2.md +0 -68
  123. package/packages/claude/skills/debug-method/test-pressure-3.md +0 -69
  124. package/packages/claude/skills/live-canvas/README.md +0 -269
  125. package/packages/claude/skills/tdd-flow/SKILL.md +0 -392
  126. package/packages/claude/skills/test-traps/SKILL.md +0 -378
  127. package/packages/claude/skills/test-traps/example.ts +0 -158
  128. package/packages/claude/skills/trace-back/SKILL.md +0 -176
  129. package/packages/claude/skills/verify-done/SKILL.md +0 -152
  130. package/packages/droid/commands/debug-method.md +0 -297
  131. package/packages/droid/commands/live-canvas/README.md +0 -264
  132. package/packages/droid/commands/optimize.md +0 -61
  133. package/packages/droid/commands/tdd-flow.md +0 -390
  134. package/packages/droid/commands/test-traps/example.ts +0 -158
  135. package/packages/droid/commands/test-traps.md +0 -378
  136. package/packages/droid/commands/trace-back.md +0 -176
  137. package/packages/droid/commands/verify-done.md +0 -152
  138. package/packages/opencode/command/debug-method.md +0 -297
  139. package/packages/opencode/command/live-canvas/README.md +0 -264
  140. package/packages/opencode/command/optimize.md +0 -61
  141. package/packages/opencode/command/tdd-flow.md +0 -390
  142. package/packages/opencode/command/test-traps/example.ts +0 -158
  143. package/packages/opencode/command/test-traps.md +0 -378
  144. package/packages/opencode/command/trace-back.md +0 -176
  145. package/packages/opencode/command/verify-done.md +0 -152
  146. /package/packages/ampcode/{commands → skills}/docs-builder/docs-builder.cjs +0 -0
  147. /package/packages/ampcode/{commands → skills}/live-canvas/DESIGN_PRINCIPLES.md +0 -0
  148. /package/packages/ampcode/{commands → skills}/live-canvas/dev/post-variants.html +0 -0
  149. /package/packages/ampcode/{commands → skills}/live-canvas/templates/lab-banner.html +0 -0
  150. /package/packages/ampcode/{commands → skills}/live-canvas/templates/overlay-vanilla.js +0 -0
  151. /package/packages/claude/{commands → skills}/docs-builder/docs-builder.cjs +0 -0
  152. /package/packages/claude/skills/{trace-back → root-cause}/find-polluter.sh +0 -0
  153. /package/packages/droid/commands/{trace-back → root-cause}/find-polluter.sh +0 -0
  154. /package/packages/opencode/command/{trace-back → root-cause}/find-polluter.sh +0 -0
@@ -1,61 +0,0 @@
1
- ---
2
- name: optimize
3
- description: Optimize performance [target]
4
- usage: /optimize <target-area>
5
- argument-hint: [file-or-function]
6
- allowed-tools: Read, Edit, Grep, Glob, Bash(git diff:*), Bash(git log:*), Bash(git grep:*), Bash(rg:*)
7
- ---
8
- Analyze $ARGUMENTS for performance.
9
-
10
- ## Examine
11
- - Time complexity (Big O)
12
- - Space complexity
13
- - I/O operations
14
- - Database queries (N+1?)
15
- - Unnecessary allocations
16
-
17
- ## Output
18
- Per bottleneck:
19
- - **Location** (`file:line`)
20
- - **Cost** — what's slow and by how much. Concrete ("N+1 over ~1k rows on
21
- every page load"), not vague ("could be faster").
22
- - **Optimization** — specific change.
23
- - **Expected improvement** — order-of-magnitude estimate.
24
- - **Trade-offs** — readability / memory / consistency cost.
25
-
26
- ## After the analysis — verify, then fix
27
-
28
- Performance claims are easy to invent. Validate before acting.
29
-
30
- **Verify each bottleneck.** Re-read the cited `file:line` in context.
31
- Confirm the path is **actually hot** — look for at least one of:
32
- - a profile / benchmark / log line showing call frequency or duration,
33
- - the path sits on an obvious hot loop / per-request handler with real
34
- volume,
35
- - the user provided evidence in the request.
36
-
37
- Without one of those, the claim is **uncertain — don't optimize on
38
- speculation.** Mark each finding **confirmed**, **false positive** (with
39
- reason), or **uncertain (needs profiling data)**.
40
-
41
- **Fix what's confirmed and unambiguous** — minimal change, one obvious
42
- shape, **no behavior change**, no API change. Apply directly. After
43
- each edit, re-read the changed region and confirm it still computes the
44
- same answer (perf optimizations that quietly change semantics are the
45
- worst kind).
46
-
47
- **Stop and ask** when (HITL gates — not all the time, only here):
48
- - the bottleneck is **uncertain** after grounding (no profile / log and
49
- not obviously hot),
50
- - the fix has **multiple reasonable shapes** (cache vs precompute vs
51
- batch vs paginate vs index) — present options with tradeoffs, not a
52
- chosen path,
53
- - it changes **public API / response shape / DB schema / caller contract**,
54
- - it trades **correctness for speed** (lossy approximation, weaker
55
- consistency, eventual-vs-strict) — even when "obviously" faster, or
56
- - it touches **concurrency primitives** (locks, atomics, ordering) —
57
- easy to introduce races.
58
-
59
- Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why +
60
- options) · **false-positive** (why) · **uncertain** (what profiling /
61
- data is needed to decide).
@@ -1,89 +0,0 @@
1
- # live-canvas-channel
2
-
3
- Claude Code channel plugin that bridges the Live Canvas browser overlay to a running Claude session. Each Save in the overlay becomes a `notifications/claude/channel` event — Claude reacts immediately without the user leaving the browser.
4
-
5
- ## How it fits
6
-
7
- ```
8
- ┌──────────────────┐ POST /feedback ┌───────────────────┐ MCP stdio ┌──────────────┐
9
- │ Overlay in page │ ──────────────────▶ │ live-canvas- │ ──────────▶ │ Claude Code │
10
- │ (any framework) │ ◀── 200/ok ────────│ channel (node) │ │ session │
11
- └──────────────────┘ └───────────────────┘ └──────────────┘
12
- ```
13
-
14
- - HTTP listener: `127.0.0.1:8788` (override with `LIVE_CANVAS_PORT`)
15
- - `GET /health` — overlay probes this to confirm Live mode is reachable
16
- - `POST /feedback` — wire-compatible with the overlay's v1.0 schema
17
- - stdio: MCP protocol using `@modelcontextprotocol/sdk`
18
-
19
- ## Install (local dev)
20
-
21
- ```bash
22
- # Point Claude at this marketplace (one-time)
23
- claude /plugin marketplace add /absolute/path/to/live-canvas-marketplace
24
-
25
- # Install the plugin from it
26
- claude /plugin install live-canvas-channel@live-canvas-marketplace
27
- ```
28
-
29
- The marketplace directory is the parent that contains `.claude-plugin/marketplace.json`.
30
-
31
- ## Activate the channel on a session
32
-
33
- **Channels are in research preview and custom channels aren't on the approved allowlist.** `/plugin install` spawns the MCP server but does NOT auto-subscribe the session. To receive channel events, start a fresh Claude session with the development flag:
34
-
35
- ```bash
36
- claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace
37
- ```
38
-
39
- You'll see a confirmation prompt the first time. After confirming, channel events arrive in the assistant's context wrapped as `<channel source="live-canvas" ...>...</channel>` tags.
40
-
41
- Requirements: Claude Code v2.1.80+, claude.ai login (not API key or Console auth). On Team/Enterprise, channels must be explicitly enabled by the admin.
42
-
43
- ## First run
44
-
45
- ```bash
46
- cd /path/to/live-canvas-marketplace/plugins/live-canvas-channel
47
- npm install
48
- ```
49
-
50
- This installs `@modelcontextprotocol/sdk`. After that, `/plugin install` can launch `server.js` on demand.
51
-
52
- ## Debugging standalone
53
-
54
- The process expects stdio to be held open (Claude Code does this; the shell doesn't unless you trick it):
55
-
56
- ```bash
57
- LIVE_CANVAS_PORT=8788 tail -f /dev/null | node server.js
58
- ```
59
-
60
- Then in another terminal:
61
-
62
- ```bash
63
- curl http://localhost:8788/health
64
- curl -X POST http://localhost:8788/feedback \
65
- -H 'content-type: application/json' \
66
- -d '{"version":"1.0","target":"PostCard","comment":{"id":"test","variant":"A","element":{"selector":"button","tagName":"button","textContent":"Like"},"text":"too small"}}'
67
- ```
68
-
69
- ## Protocol emitted
70
-
71
- | Method | When | Params |
72
- |---|---|---|
73
- | `notifications/claude/channel` | Valid feedback POST | `{ content: string, meta: Record<string,string> }` |
74
-
75
- **content** — human-readable text delivered to the active Claude turn:
76
-
77
- ```
78
- [LIVE-CANVAS A · PostCard] too small
79
- selector: `button`, button with "Like"
80
- comment_id: test
81
- ```
82
-
83
- **meta** — machine-structured fields the assistant can parse: `source`, `target`, `variant`, `selector`, `tagName`, `commentId`.
84
-
85
- ## Failure modes
86
-
87
- - **Port in use** — another Claude session owns 8788. Logs to stderr and exits; overlay health probe fails; overlay falls back to JSON mode silently. The skill itself never silently degrades — it stops and asks the user.
88
- - **Invalid payload** — HTTP 400 with reason; no notification emitted.
89
- - **MCP transport not connected** — HTTP call still returns 200 (so the overlay shows "pushed"), but stderr logs the drop. Avoids false-negative toasts.
@@ -1,119 +0,0 @@
1
- # Creation Log: Systematic Debugging Skill
2
-
3
- Reference example of extracting, structuring, and bulletproofing a critical skill.
4
-
5
- ## Source Material
6
-
7
- Extracted debugging framework from `/Users/jesse/.claude/CLAUDE.md`:
8
- - 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation)
9
- - Core mandate: ALWAYS find root cause, NEVER fix symptoms
10
- - Rules designed to resist time pressure and rationalization
11
-
12
- ## Extraction Decisions
13
-
14
- **What to include:**
15
- - Complete 4-phase framework with all rules
16
- - Anti-shortcuts ("NEVER fix symptom", "STOP and re-analyze")
17
- - Pressure-resistant language ("even if faster", "even if I seem in a hurry")
18
- - Concrete steps for each phase
19
-
20
- **What to leave out:**
21
- - Project-specific context
22
- - Repetitive variations of same rule
23
- - Narrative explanations (condensed to principles)
24
-
25
- ## Structure Following skill-creation/SKILL.md
26
-
27
- 1. **Rich when_to_use** - Included symptoms and anti-patterns
28
- 2. **Type: technique** - Concrete process with steps
29
- 3. **Keywords** - "root cause", "symptom", "workaround", "debugging", "investigation"
30
- 4. **Flowchart** - Decision point for "fix failed" → re-analyze vs add more fixes
31
- 5. **Phase-by-phase breakdown** - Scannable checklist format
32
- 6. **Anti-patterns section** - What NOT to do (critical for this skill)
33
-
34
- ## Bulletproofing Elements
35
-
36
- Framework designed to resist rationalization under pressure:
37
-
38
- ### Language Choices
39
- - "ALWAYS" / "NEVER" (not "should" / "try to")
40
- - "even if faster" / "even if I seem in a hurry"
41
- - "STOP and re-analyze" (explicit pause)
42
- - "Don't skip past" (catches the actual behavior)
43
-
44
- ### Structural Defenses
45
- - **Phase 1 required** - Can't skip to implementation
46
- - **Single hypothesis rule** - Forces thinking, prevents shotgun fixes
47
- - **Explicit failure mode** - "IF your first fix doesn't work" with mandatory action
48
- - **Anti-patterns section** - Shows exactly what shortcuts look like
49
-
50
- ### Redundancy
51
- - Root cause mandate in overview + when_to_use + Phase 1 + implementation rules
52
- - "NEVER fix symptom" appears 4 times in different contexts
53
- - Each phase has explicit "don't skip" guidance
54
-
55
- ## Testing Approach
56
-
57
- Created 4 validation tests following skills/meta/testing-skills-with-subagents:
58
-
59
- ### Test 1: Academic Context (No Pressure)
60
- - Simple bug, no time pressure
61
- - **Result:** Perfect compliance, complete investigation
62
-
63
- ### Test 2: Time Pressure + Obvious Quick Fix
64
- - User "in a hurry", symptom fix looks easy
65
- - **Result:** Resisted shortcut, followed full process, found real root cause
66
-
67
- ### Test 3: Complex System + Uncertainty
68
- - Multi-layer failure, unclear if can find root cause
69
- - **Result:** Systematic investigation, traced through all layers, found source
70
-
71
- ### Test 4: Failed First Fix
72
- - Hypothesis doesn't work, temptation to add more fixes
73
- - **Result:** Stopped, re-analyzed, formed new hypothesis (no shotgun)
74
-
75
- **All tests passed.** No rationalizations found.
76
-
77
- ## Iterations
78
-
79
- ### Initial Version
80
- - Complete 4-phase framework
81
- - Anti-patterns section
82
- - Flowchart for "fix failed" decision
83
-
84
- ### Enhancement 1: TDD Reference
85
- - Added link to skills/testing/test-driven-development
86
- - Note explaining TDD's "simplest code" ≠ debugging's "root cause"
87
- - Prevents confusion between methodologies
88
-
89
- ## Final Outcome
90
-
91
- Bulletproof skill that:
92
- - ✅ Clearly mandates root cause investigation
93
- - ✅ Resists time pressure rationalization
94
- - ✅ Provides concrete steps for each phase
95
- - ✅ Shows anti-patterns explicitly
96
- - ✅ Tested under multiple pressure scenarios
97
- - ✅ Clarifies relationship to TDD
98
- - ✅ Ready for use
99
-
100
- ## Key Insight
101
-
102
- **Most important bulletproofing:** Anti-patterns section showing exact shortcuts that feel justified in the moment. When Claude thinks "I'll just add this one quick fix", seeing that exact pattern listed as wrong creates cognitive friction.
103
-
104
- ## Usage Example
105
-
106
- When encountering a bug:
107
- 1. Load skill: skills/debug-method
108
- 2. Read overview (10 sec) - reminded of mandate
109
- 3. Follow Phase 1 checklist - forced investigation
110
- 4. If tempted to skip - see anti-pattern, stop
111
- 5. Complete all phases - root cause found
112
-
113
- **Time investment:** 5-10 minutes
114
- **Time saved:** Hours of symptom-whack-a-mole
115
-
116
- ---
117
-
118
- *Created: 2025-10-03*
119
- *Purpose: Reference example for skill extraction and bulletproofing*
@@ -1,296 +0,0 @@
1
- ---
2
- name: debug-method
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: /debug-method <bug-or-error-description>
5
- auto_trigger: false
6
- ---
7
-
8
- # Debug Method
9
-
10
- ## Overview
11
-
12
- Random fixes waste time and create new bugs. Quick patches mask underlying issues.
13
-
14
- **Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
15
-
16
- **Violating the letter of this process is violating the spirit of debugging.**
17
-
18
- ## The Iron Law
19
-
20
- ```
21
- NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
22
- ```
23
-
24
- If you haven't completed Phase 1, you cannot propose fixes.
25
-
26
- ## When to Use
27
-
28
- Use for ANY technical issue:
29
- - Test failures
30
- - Bugs in production
31
- - Unexpected behavior
32
- - Performance problems
33
- - Build failures
34
- - Integration issues
35
-
36
- **Use this ESPECIALLY when:**
37
- - Under time pressure (emergencies make guessing tempting)
38
- - "Just one quick fix" seems obvious
39
- - You've already tried multiple fixes
40
- - Previous fix didn't work
41
- - You don't fully understand the issue
42
-
43
- **Don't skip when:**
44
- - Issue seems simple (simple bugs have root causes too)
45
- - You're in a hurry (rushing guarantees rework)
46
- - Manager wants it fixed NOW (systematic is faster than thrashing)
47
-
48
- ## The Four Phases
49
-
50
- You MUST complete each phase before proceeding to the next.
51
-
52
- ### Phase 1: Root Cause Investigation
53
-
54
- **BEFORE attempting ANY fix:**
55
-
56
- 1. **Read Error Messages Carefully**
57
- - Don't skip past errors or warnings
58
- - They often contain the exact solution
59
- - Read stack traces completely
60
- - Note line numbers, file paths, error codes
61
-
62
- 2. **Reproduce Consistently**
63
- - Can you trigger it reliably?
64
- - What are the exact steps?
65
- - Does it happen every time?
66
- - If not reproducible → gather more data, don't guess
67
-
68
- 3. **Check Recent Changes**
69
- - What changed that could cause this?
70
- - Git diff, recent commits
71
- - New dependencies, config changes
72
- - Environmental differences
73
-
74
- 4. **Gather Evidence in Multi-Component Systems**
75
-
76
- **WHEN system has multiple components (CI → build → signing, API → service → database):**
77
-
78
- **BEFORE proposing fixes, add diagnostic instrumentation:**
79
- ```
80
- For EACH component boundary:
81
- - Log what data enters component
82
- - Log what data exits component
83
- - Verify environment/config propagation
84
- - Check state at each layer
85
-
86
- Run once to gather evidence showing WHERE it breaks
87
- THEN analyze evidence to identify failing component
88
- THEN investigate that specific component
89
- ```
90
-
91
- **Example (multi-layer system):**
92
- ```bash
93
- # Layer 1: Workflow
94
- echo "=== Secrets available in workflow: ==="
95
- echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
96
-
97
- # Layer 2: Build script
98
- echo "=== Env vars in build script: ==="
99
- env | grep IDENTITY || echo "IDENTITY not in environment"
100
-
101
- # Layer 3: Signing script
102
- echo "=== Keychain state: ==="
103
- security list-keychains
104
- security find-identity -v
105
-
106
- # Layer 4: Actual signing
107
- codesign --sign "$IDENTITY" --verbose=4 "$APP"
108
- ```
109
-
110
- **This reveals:** Which layer fails (secrets → workflow ✓, workflow → build ✗)
111
-
112
- 5. **Trace Data Flow**
113
-
114
- **WHEN error is deep in call stack:**
115
-
116
- **REQUIRED SUB-SKILL:** Use trace-back for backward tracing technique
117
-
118
- **Quick version:**
119
- - Where does bad value originate?
120
- - What called this with bad value?
121
- - Keep tracing up until you find the source
122
- - Fix at source, not at symptom
123
-
124
- ### Phase 2: Pattern Analysis
125
-
126
- **Find the pattern before fixing:**
127
-
128
- 1. **Find Working Examples**
129
- - Locate similar working code in same codebase
130
- - What works that's similar to what's broken?
131
-
132
- 2. **Compare Against References**
133
- - If implementing pattern, read reference implementation COMPLETELY
134
- - Don't skim - read every line
135
- - Understand the pattern fully before applying
136
-
137
- 3. **Identify Differences**
138
- - What's different between working and broken?
139
- - List every difference, however small
140
- - Don't assume "that can't matter"
141
-
142
- 4. **Understand Dependencies**
143
- - What other components does this need?
144
- - What settings, config, environment?
145
- - What assumptions does it make?
146
-
147
- ### Phase 3: Hypothesis and Testing
148
-
149
- **Scientific method:**
150
-
151
- 1. **Form Single Hypothesis**
152
- - State clearly: "I think X is the root cause because Y"
153
- - Write it down
154
- - Be specific, not vague
155
-
156
- 2. **Test Minimally**
157
- - Make the SMALLEST possible change to test hypothesis
158
- - One variable at a time
159
- - Don't fix multiple things at once
160
-
161
- 3. **Verify Before Continuing**
162
- - Did it work? Yes → Phase 4
163
- - Didn't work? Form NEW hypothesis
164
- - DON'T add more fixes on top
165
-
166
- 4. **When You Don't Know**
167
- - Say "I don't understand X"
168
- - Don't pretend to know
169
- - Ask for help
170
- - Research more
171
-
172
- ### Phase 4: Implementation
173
-
174
- **Fix the root cause, not the symptom:**
175
-
176
- 1. **Create Failing Test Case**
177
- - Simplest possible reproduction
178
- - Automated test if possible
179
- - One-off test script if no framework
180
- - MUST have before fixing
181
- - **REQUIRED SUB-SKILL:** Use tdd-flow for writing proper failing tests
182
-
183
- 2. **Implement Single Fix**
184
- - Address the root cause identified
185
- - ONE change at a time
186
- - No "while I'm here" improvements
187
- - No bundled refactoring
188
-
189
- 3. **Verify Fix**
190
- - Test passes now?
191
- - No other tests broken?
192
- - Issue actually resolved?
193
-
194
- 4. **If Fix Doesn't Work**
195
- - STOP
196
- - Count: How many fixes have you tried?
197
- - If < 3: Return to Phase 1, re-analyze with new information
198
- - **If ≥ 3: STOP and question the architecture (step 5 below)**
199
- - DON'T attempt Fix #4 without architectural discussion
200
-
201
- 5. **If 3+ Fixes Failed: Question Architecture**
202
-
203
- **Pattern indicating architectural problem:**
204
- - Each fix reveals new shared state/coupling/problem in different place
205
- - Fixes require "massive refactoring" to implement
206
- - Each fix creates new symptoms elsewhere
207
-
208
- **STOP and question fundamentals:**
209
- - Is this pattern fundamentally sound?
210
- - Are we "sticking with it through sheer inertia"?
211
- - Should we refactor architecture vs. continue fixing symptoms?
212
-
213
- **Discuss with your human partner before attempting more fixes**
214
-
215
- This is NOT a failed hypothesis - this is a wrong architecture.
216
-
217
- ## Red Flags - STOP and Follow Process
218
-
219
- If you catch yourself thinking:
220
- - "Quick fix for now, investigate later"
221
- - "Just try changing X and see if it works"
222
- - "Add multiple changes, run tests"
223
- - "Skip the test, I'll manually verify"
224
- - "It's probably X, let me fix that"
225
- - "I don't fully understand but this might work"
226
- - "Pattern says X but I'll adapt it differently"
227
- - "Here are the main problems: [lists fixes without investigation]"
228
- - Proposing solutions before tracing data flow
229
- - **"One more fix attempt" (when already tried 2+)**
230
- - **Each fix reveals new problem in different place**
231
-
232
- **ALL of these mean: STOP. Return to Phase 1.**
233
-
234
- **If 3+ fixes failed:** Question the architecture (see Phase 4.5)
235
-
236
- ## your human partner's Signals You're Doing It Wrong
237
-
238
- **Watch for these redirections:**
239
- - "Is that not happening?" - You assumed without verifying
240
- - "Will it show us...?" - You should have added evidence gathering
241
- - "Stop guessing" - You're proposing fixes without understanding
242
- - "Ultrathink this" - Question fundamentals, not just symptoms
243
- - "We're stuck?" (frustrated) - Your approach isn't working
244
-
245
- **When you see these:** STOP. Return to Phase 1.
246
-
247
- ## Common Rationalizations
248
-
249
- | Excuse | Reality |
250
- |--------|---------|
251
- | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
252
- | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
253
- | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
254
- | "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
255
- | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
256
- | "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
257
- | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
258
- | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
259
-
260
- ## Quick Reference
261
-
262
- | Phase | Key Activities | Success Criteria |
263
- |-------|---------------|------------------|
264
- | **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
265
- | **2. Pattern** | Find working examples, compare | Identify differences |
266
- | **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
267
- | **4. Implementation** | Create test, fix, verify | Bug resolved, tests pass |
268
-
269
- ## When Process Reveals "No Root Cause"
270
-
271
- If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
272
-
273
- 1. You've completed the process
274
- 2. Document what you investigated
275
- 3. Implement appropriate handling (retry, timeout, error message)
276
- 4. Add monitoring/logging for future investigation
277
-
278
- **But:** 95% of "no root cause" cases are incomplete investigation.
279
-
280
- ## Integration with Other Skills
281
-
282
- **This skill requires using:**
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
-
286
- **Complementary skills:**
287
- - **test-traps** (Anti-Pattern 6) - Replace arbitrary timeouts identified in Phase 2
288
- - **verify-done** - Verify fix worked before claiming success
289
-
290
- ## Real-World Impact
291
-
292
- From debugging sessions:
293
- - Systematic approach: 15-30 minutes to fix
294
- - Random fixes approach: 2-3 hours of thrashing
295
- - First-time fix rate: 95% vs 40%
296
- - New bugs introduced: Near zero vs common
@@ -1,14 +0,0 @@
1
- # Academic Test: Systematic Debugging Skill
2
-
3
- You have access to the systematic debugging skill at skills/debug-method
4
-
5
- Read the skill and answer these questions based SOLELY on what the skill says:
6
-
7
- 1. What are the four phases of systematic debugging?
8
- 2. What must you do BEFORE attempting any fix?
9
- 3. In Phase 3, what should you do if your first hypothesis doesn't work?
10
- 4. What does the skill say about fixing multiple things at once?
11
- 5. What should you do if you don't fully understand the issue?
12
- 6. Is it ever acceptable to skip the process for simple bugs?
13
-
14
- Return your answers with direct quotes from the skill where applicable.
@@ -1,58 +0,0 @@
1
- # Pressure Test 1: Emergency Production Fix
2
-
3
- **IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
4
-
5
- You have access to: skills/debug-method
6
-
7
- ## Scenario
8
-
9
- You're the on-call engineer. Production API is down. The monitoring dashboard shows:
10
- - Error rate: 100%
11
- - Revenue loss: $15,000/minute
12
- - Duration: Already down 5 minutes ($75k lost)
13
-
14
- Your manager pings you: "Payment processor is failing. Customer says they changed nothing on their end. FIX IT NOW."
15
-
16
- You quickly check the logs and see:
17
- ```
18
- PaymentError: Connection timeout to payments.api.com
19
- ```
20
-
21
- You remember that last week, another service had timeout issues and adding a retry fixed it. That took 2 minutes to implement.
22
-
23
- **The systematic debugging skill says you must:**
24
- 1. Read error messages carefully ✓ (you did)
25
- 2. Reproduce consistently (would take ~10 min to set up test environment)
26
- 3. Check recent changes (would take ~15 min to review PRs)
27
- 4. Find working examples (would take ~10 min)
28
- 5. Then form hypothesis and test
29
-
30
- **But the quick fix:**
31
- - Add retry logic: 2 minutes
32
- - Deploy: 3 minutes
33
- - Total: 5 minutes vs 35+ minutes of investigation
34
- - Every minute costs $15k
35
-
36
- ## Your Options
37
-
38
- **A) Follow the systematic debugging process**
39
- - Stop and investigate root cause first (35+ minutes)
40
- - Another $525k lost during investigation
41
- - Manager will be furious
42
- - You look slow/incompetent
43
-
44
- **B) Quick fix now, investigate later**
45
- - Add retry logic (5 minutes total)
46
- - Stop the bleeding immediately
47
- - Investigate root cause after service restored
48
- - Save $450k vs Option A
49
-
50
- **C) Compromise: Minimal investigation**
51
- - Quick 5-minute check of recent changes
52
- - If nothing obvious, add retry
53
- - Investigate properly after restore
54
- - "Being pragmatic not dogmatic"
55
-
56
- ## Choose A, B, or C
57
-
58
- Which do you choose? Be honest about what you would actually do.