cfsa-antigravity 2.19.0 → 2.19.2

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 (200) hide show
  1. package/package.json +1 -1
  2. package/template/.agent/kit-sync.md +3 -3
  3. package/template/.claude/commands/audit-ambiguity-execute.md +6 -0
  4. package/template/.claude/commands/audit-ambiguity-rubrics.md +6 -0
  5. package/template/.claude/commands/audit-ambiguity.md +6 -0
  6. package/template/.claude/commands/bootstrap-agents-fill.md +6 -0
  7. package/template/.claude/commands/bootstrap-agents-provision.md +6 -0
  8. package/template/.claude/commands/bootstrap-agents.md +6 -0
  9. package/template/.claude/commands/create-prd-architecture.md +6 -0
  10. package/template/.claude/commands/create-prd-compile.md +6 -0
  11. package/template/.claude/commands/create-prd-design-system.md +6 -0
  12. package/template/.claude/commands/create-prd-security.md +6 -0
  13. package/template/.claude/commands/create-prd-stack.md +6 -0
  14. package/template/.claude/commands/decompose-architecture-structure.md +6 -0
  15. package/template/.claude/commands/decompose-architecture-validate.md +6 -0
  16. package/template/.claude/commands/evolve-contract.md +6 -0
  17. package/template/.claude/commands/evolve-feature-cascade.md +6 -0
  18. package/template/.claude/commands/evolve-feature-classify.md +6 -0
  19. package/template/.claude/commands/evolve-feature.md +6 -0
  20. package/template/.claude/commands/ideate-discover.md +6 -0
  21. package/template/.claude/commands/ideate-extract.md +6 -0
  22. package/template/.claude/commands/ideate-validate.md +6 -0
  23. package/template/.claude/commands/implement-slice-setup.md +6 -0
  24. package/template/.claude/commands/implement-slice-tdd.md +6 -0
  25. package/template/.claude/commands/plan-phase-preflight.md +6 -0
  26. package/template/.claude/commands/plan-phase-write.md +6 -0
  27. package/template/.claude/commands/propagate-decision-apply.md +6 -0
  28. package/template/.claude/commands/propagate-decision-scan.md +6 -0
  29. package/template/.claude/commands/propagate-decision.md +6 -0
  30. package/template/.claude/commands/remediate-pipeline-assess.md +6 -0
  31. package/template/.claude/commands/remediate-pipeline-execute.md +6 -0
  32. package/template/.claude/commands/remediate-pipeline.md +6 -0
  33. package/template/.claude/commands/remediate-shard-split.md +6 -0
  34. package/template/.claude/commands/resolve-ambiguity.md +6 -0
  35. package/template/.claude/commands/setup-workspace-cicd.md +6 -0
  36. package/template/.claude/commands/setup-workspace-data.md +6 -0
  37. package/template/.claude/commands/setup-workspace-hosting.md +6 -0
  38. package/template/.claude/commands/setup-workspace-scaffold.md +6 -0
  39. package/template/.claude/commands/sync-kit.md +6 -0
  40. package/template/.claude/commands/update-architecture-map.md +6 -0
  41. package/template/.claude/commands/validate-phase-quality.md +6 -0
  42. package/template/.claude/commands/validate-phase-readiness.md +6 -0
  43. package/template/.claude/commands/verify-infrastructure.md +6 -0
  44. package/template/.claude/commands/write-architecture-spec-deepen.md +6 -0
  45. package/template/.claude/commands/write-architecture-spec-design.md +6 -0
  46. package/template/.claude/commands/write-be-spec-classify.md +6 -0
  47. package/template/.claude/commands/write-be-spec-write.md +6 -0
  48. package/template/.claude/commands/write-fe-spec-classify.md +6 -0
  49. package/template/.claude/commands/write-fe-spec-write.md +6 -0
  50. package/template/.claude/skills/accessibility/SKILL.md +522 -0
  51. package/template/.claude/skills/accessibility/references/WCAG.md +162 -0
  52. package/template/.claude/skills/accessibility/references/ia-spec-checklist.md +35 -0
  53. package/template/.claude/skills/adversarial-review/SKILL.md +90 -0
  54. package/template/.claude/skills/antigravity-workflows/SKILL.md +81 -0
  55. package/template/.claude/skills/antigravity-workflows/resources/implementation-playbook.md +36 -0
  56. package/template/.claude/skills/api-design-principles/SKILL.md +169 -0
  57. package/template/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  58. package/template/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
  59. package/template/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  60. package/template/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
  61. package/template/.claude/skills/api-design-principles/resources/implementation-playbook.md +513 -0
  62. package/template/.claude/skills/api-versioning/SKILL.md +166 -0
  63. package/template/.claude/skills/api-versioning/references/typescript.md +157 -0
  64. package/template/.claude/skills/architecture-mapping/SKILL.md +219 -0
  65. package/template/.claude/skills/bootstrap-agents/SKILL.md +258 -0
  66. package/template/.claude/skills/brainstorming/SKILL.md +177 -0
  67. package/template/.claude/skills/brand-guidelines/SKILL.md +44 -0
  68. package/template/.claude/skills/clean-code/SKILL.md +196 -0
  69. package/template/.claude/skills/clean-code/references/typescript.md +126 -0
  70. package/template/.claude/skills/code-review-pro/SKILL.md +152 -0
  71. package/template/.claude/skills/concise-planning/SKILL.md +107 -0
  72. package/template/.claude/skills/cross-layer-consistency/SKILL.md +117 -0
  73. package/template/.claude/skills/database-schema-design/SKILL.md +205 -0
  74. package/template/.claude/skills/database-schema-design/references/relational.md +228 -0
  75. package/template/.claude/skills/deployment-procedures/SKILL.md +241 -0
  76. package/template/.claude/skills/design-anti-cliche/SKILL.md +159 -0
  77. package/template/.claude/skills/design-direction/SKILL.md +45 -0
  78. package/template/.claude/skills/error-handling-patterns/SKILL.md +226 -0
  79. package/template/.claude/skills/error-handling-patterns/references/go.md +162 -0
  80. package/template/.claude/skills/error-handling-patterns/references/python.md +262 -0
  81. package/template/.claude/skills/error-handling-patterns/references/rust.md +112 -0
  82. package/template/.claude/skills/error-handling-patterns/references/typescript.md +178 -0
  83. package/template/.claude/skills/find-skills/SKILL.md +145 -0
  84. package/template/.claude/skills/git-advanced/SKILL.md +972 -0
  85. package/template/.claude/skills/git-workflow/SKILL.md +420 -0
  86. package/template/.claude/skills/idea-extraction/SKILL.md +644 -0
  87. package/template/.claude/skills/logging-best-practices/SKILL.md +192 -0
  88. package/template/.claude/skills/logging-best-practices/references/go.md +49 -0
  89. package/template/.claude/skills/logging-best-practices/references/python.md +52 -0
  90. package/template/.claude/skills/logging-best-practices/references/typescript.md +215 -0
  91. package/template/.claude/skills/migration-management/SKILL.md +200 -0
  92. package/template/.claude/skills/migration-management/references/relational.md +214 -0
  93. package/template/.claude/skills/minimalist-surgical-development/SKILL.md +135 -0
  94. package/template/.claude/skills/parallel-agents/SKILL.md +165 -0
  95. package/template/.claude/skills/parallel-debugging/SKILL.md +135 -0
  96. package/template/.claude/skills/parallel-feature-development/SKILL.md +157 -0
  97. package/template/.claude/skills/performance-budgeting/SKILL.md +144 -0
  98. package/template/.claude/skills/pipeline-rubrics/SKILL.md +51 -0
  99. package/template/.claude/skills/pipeline-rubrics/references/architecture-rubric.md +19 -0
  100. package/template/.claude/skills/pipeline-rubrics/references/be-rubric.md +21 -0
  101. package/template/.claude/skills/pipeline-rubrics/references/fe-rubric.md +20 -0
  102. package/template/.claude/skills/pipeline-rubrics/references/ia-rubric.md +19 -0
  103. package/template/.claude/skills/pipeline-rubrics/references/scoring.md +32 -0
  104. package/template/.claude/skills/pipeline-rubrics/references/vision-rubric.md +12 -0
  105. package/template/.claude/skills/prd-templates/SKILL.md +107 -0
  106. package/template/.claude/skills/prd-templates/references/architecture-completeness-checklist.md +28 -0
  107. package/template/.claude/skills/prd-templates/references/architecture-design-template.md +88 -0
  108. package/template/.claude/skills/prd-templates/references/be-spec-classification.md +41 -0
  109. package/template/.claude/skills/prd-templates/references/be-spec-template.md +107 -0
  110. package/template/.claude/skills/prd-templates/references/bootstrap-verification-protocol.md +50 -0
  111. package/template/.claude/skills/prd-templates/references/constraint-exploration.md +41 -0
  112. package/template/.claude/skills/prd-templates/references/data-placement-template.md +74 -0
  113. package/template/.claude/skills/prd-templates/references/decision-confirmation-protocol.md +68 -0
  114. package/template/.claude/skills/prd-templates/references/decision-propagation.md +121 -0
  115. package/template/.claude/skills/prd-templates/references/decomposition-templates.md +226 -0
  116. package/template/.claude/skills/prd-templates/references/deep-ideation-loading-protocol.md +114 -0
  117. package/template/.claude/skills/prd-templates/references/design-system-decisions.md +198 -0
  118. package/template/.claude/skills/prd-templates/references/design-system-prerequisite-check.md +18 -0
  119. package/template/.claude/skills/prd-templates/references/domain-exhaustion-criteria.md +37 -0
  120. package/template/.claude/skills/prd-templates/references/engagement-tier-protocol.md +58 -0
  121. package/template/.claude/skills/prd-templates/references/engineering-standards-template.md +126 -0
  122. package/template/.claude/skills/prd-templates/references/evolution-layer-guidance.md +91 -0
  123. package/template/.claude/skills/prd-templates/references/expansion-modes.md +27 -0
  124. package/template/.claude/skills/prd-templates/references/fe-classification-procedures.md +47 -0
  125. package/template/.claude/skills/prd-templates/references/fe-spec-template.md +90 -0
  126. package/template/.claude/skills/prd-templates/references/feature-ledger-protocol.md +149 -0
  127. package/template/.claude/skills/prd-templates/references/folder-seeding-protocol.md +77 -0
  128. package/template/.claude/skills/prd-templates/references/fractal-cx-template.md +58 -0
  129. package/template/.claude/skills/prd-templates/references/fractal-feature-template.md +93 -0
  130. package/template/.claude/skills/prd-templates/references/fractal-node-index-template.md +55 -0
  131. package/template/.claude/skills/prd-templates/references/gate-applicability.md +92 -0
  132. package/template/.claude/skills/prd-templates/references/ideation-crosscut-template.md +36 -0
  133. package/template/.claude/skills/prd-templates/references/ideation-index-template.md +111 -0
  134. package/template/.claude/skills/prd-templates/references/ideation-meta-template.md +126 -0
  135. package/template/.claude/skills/prd-templates/references/infrastructure-report-template.md +71 -0
  136. package/template/.claude/skills/prd-templates/references/input-classification.md +23 -0
  137. package/template/.claude/skills/prd-templates/references/map-guard-protocol.md +65 -0
  138. package/template/.claude/skills/prd-templates/references/operational-templates.md +116 -0
  139. package/template/.claude/skills/prd-templates/references/persona-completeness-gate.md +20 -0
  140. package/template/.claude/skills/prd-templates/references/placeholder-guard-template.md +21 -0
  141. package/template/.claude/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -0
  142. package/template/.claude/skills/prd-templates/references/shard-boundary-analysis.md +103 -0
  143. package/template/.claude/skills/prd-templates/references/shard-split-remediation.md +157 -0
  144. package/template/.claude/skills/prd-templates/references/skill-loading-protocol.md +36 -0
  145. package/template/.claude/skills/prd-templates/references/slice-completion-gates.md +29 -0
  146. package/template/.claude/skills/prd-templates/references/spec-coverage-sweep.md +44 -0
  147. package/template/.claude/skills/prd-templates/references/surface-model.md +61 -0
  148. package/template/.claude/skills/prd-templates/references/tdd-testing-policy.md +39 -0
  149. package/template/.claude/skills/prd-templates/references/vision-template.md +57 -0
  150. package/template/.claude/skills/prd-templates/references/workflow-checkpoint-protocol.md +112 -0
  151. package/template/.claude/skills/prd-templates/references/write-verification-protocol.md +57 -0
  152. package/template/.claude/skills/prompt-engineer/SKILL.md +203 -0
  153. package/template/.claude/skills/regex-patterns/SKILL.md +333 -0
  154. package/template/.claude/skills/regex-patterns/references/go.md +44 -0
  155. package/template/.claude/skills/regex-patterns/references/javascript.md +63 -0
  156. package/template/.claude/skills/regex-patterns/references/python.md +77 -0
  157. package/template/.claude/skills/regex-patterns/references/rust.md +43 -0
  158. package/template/.claude/skills/resolve-ambiguity/SKILL.md +278 -0
  159. package/template/.claude/skills/security-scanning-security-hardening/SKILL.md +231 -0
  160. package/template/.claude/skills/session-continuity/SKILL.md +732 -0
  161. package/template/.claude/skills/session-continuity/protocols/01-session-resumption.md +38 -0
  162. package/template/.claude/skills/session-continuity/protocols/02-progress-generation.md +85 -0
  163. package/template/.claude/skills/session-continuity/protocols/03-progress-update.md +70 -0
  164. package/template/.claude/skills/session-continuity/protocols/04-pattern-extraction.md +60 -0
  165. package/template/.claude/skills/session-continuity/protocols/05-session-close.md +37 -0
  166. package/template/.claude/skills/session-continuity/protocols/06-decision-analysis.md +84 -0
  167. package/template/.claude/skills/session-continuity/protocols/07-spec-pipeline-generation.md +48 -0
  168. package/template/.claude/skills/session-continuity/protocols/08-spec-pipeline-update.md +55 -0
  169. package/template/.claude/skills/session-continuity/protocols/09-parallel-claim.md +122 -0
  170. package/template/.claude/skills/session-continuity/protocols/10-placeholder-verification-gate.md +83 -0
  171. package/template/.claude/skills/session-continuity/protocols/11-parallel-synthesis.md +21 -0
  172. package/template/.claude/skills/session-continuity/protocols/ambiguity-gates.md +48 -0
  173. package/template/.claude/skills/skill-creator/SKILL.md +203 -0
  174. package/template/.claude/skills/skill-creator/references/.gitkeep +0 -0
  175. package/template/.claude/skills/skill-creator/scripts/.gitkeep +0 -0
  176. package/template/.claude/skills/spec-writing/SKILL.md +110 -0
  177. package/template/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  178. package/template/.claude/skills/systematic-debugging/SKILL.md +297 -0
  179. package/template/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  180. package/template/.claude/skills/systematic-debugging/condition-based-waiting.md +115 -0
  181. package/template/.claude/skills/systematic-debugging/defense-in-depth.md +122 -0
  182. package/template/.claude/skills/systematic-debugging/find-polluter.sh +63 -0
  183. package/template/.claude/skills/systematic-debugging/root-cause-tracing.md +169 -0
  184. package/template/.claude/skills/systematic-debugging/test-academic.md +14 -0
  185. package/template/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  186. package/template/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  187. package/template/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  188. package/template/.claude/skills/tdd-workflow/SKILL.md +186 -0
  189. package/template/.claude/skills/tdd-workflow/references/typescript.md +231 -0
  190. package/template/.claude/skills/tech-stack-catalog/SKILL.md +49 -0
  191. package/template/.claude/skills/tech-stack-catalog/references/constraint-questions.md +237 -0
  192. package/template/.claude/skills/tech-stack-catalog/references/dev-tooling-decisions.md +37 -0
  193. package/template/.claude/skills/tech-stack-catalog/references/surface-decision-tables.md +69 -0
  194. package/template/.claude/skills/technical-writer/SKILL.md +242 -0
  195. package/template/.claude/skills/testing-strategist/SKILL.md +319 -0
  196. package/template/.claude/skills/testing-strategist/references/typescript.md +328 -0
  197. package/template/.claude/skills/verification-before-completion/SKILL.md +97 -0
  198. package/template/.claude/skills/workflow-automation/SKILL.md +166 -0
  199. package/template/.claude/skills/workflow-automation/references/inngest.md +88 -0
  200. package/template/.claude/skills/workflow-automation/references/temporal.md +64 -0
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+ # Bisection script to find which test creates unwanted files/state
3
+ # Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
4
+ # Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
5
+
6
+ set -e
7
+
8
+ if [ $# -ne 2 ]; then
9
+ echo "Usage: $0 <file_to_check> <test_pattern>"
10
+ echo "Example: $0 '.git' 'src/**/*.test.ts'"
11
+ exit 1
12
+ fi
13
+
14
+ POLLUTION_CHECK="$1"
15
+ TEST_PATTERN="$2"
16
+
17
+ echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
18
+ echo "Test pattern: $TEST_PATTERN"
19
+ echo ""
20
+
21
+ # Get list of test files
22
+ TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
23
+ TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
24
+
25
+ echo "Found $TOTAL test files"
26
+ echo ""
27
+
28
+ COUNT=0
29
+ for TEST_FILE in $TEST_FILES; do
30
+ COUNT=$((COUNT + 1))
31
+
32
+ # Skip if pollution already exists
33
+ if [ -e "$POLLUTION_CHECK" ]; then
34
+ echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
35
+ echo " Skipping: $TEST_FILE"
36
+ continue
37
+ fi
38
+
39
+ echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
40
+
41
+ # Run the test
42
+ npm test "$TEST_FILE" > /dev/null 2>&1 || true
43
+
44
+ # Check if pollution appeared
45
+ if [ -e "$POLLUTION_CHECK" ]; then
46
+ echo ""
47
+ echo "🎯 FOUND POLLUTER!"
48
+ echo " Test: $TEST_FILE"
49
+ echo " Created: $POLLUTION_CHECK"
50
+ echo ""
51
+ echo "Pollution details:"
52
+ ls -la "$POLLUTION_CHECK"
53
+ echo ""
54
+ echo "To investigate:"
55
+ echo " npm test $TEST_FILE # Run just this test"
56
+ echo " cat $TEST_FILE # Review test code"
57
+ exit 1
58
+ fi
59
+ done
60
+
61
+ echo ""
62
+ echo "✅ No polluter found - all tests clean!"
63
+ exit 0
@@ -0,0 +1,169 @@
1
+ # Root Cause Tracing
2
+
3
+ ## Overview
4
+
5
+ Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
6
+
7
+ **Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
8
+
9
+ ## When to Use
10
+
11
+ ```dot
12
+ digraph when_to_use {
13
+ "Bug appears deep in stack?" [shape=diamond];
14
+ "Can trace backwards?" [shape=diamond];
15
+ "Fix at symptom point" [shape=box];
16
+ "Trace to original trigger" [shape=box];
17
+ "BETTER: Also add defense-in-depth" [shape=box];
18
+
19
+ "Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
20
+ "Can trace backwards?" -> "Trace to original trigger" [label="yes"];
21
+ "Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
22
+ "Trace to original trigger" -> "BETTER: Also add defense-in-depth";
23
+ }
24
+ ```
25
+
26
+ **Use when:**
27
+ - Error happens deep in execution (not at entry point)
28
+ - Stack trace shows long call chain
29
+ - Unclear where invalid data originated
30
+ - Need to find which test/code triggers the problem
31
+
32
+ ## The Tracing Process
33
+
34
+ ### 1. Observe the Symptom
35
+ ```
36
+ Error: git init failed in /Users/jesse/project/packages/core
37
+ ```
38
+
39
+ ### 2. Find Immediate Cause
40
+ **What code directly causes this?**
41
+ ```typescript
42
+ await execFileAsync('git', ['init'], { cwd: projectDir });
43
+ ```
44
+
45
+ ### 3. Ask: What Called This?
46
+ ```typescript
47
+ WorktreeManager.createSessionWorktree(projectDir, sessionId)
48
+ → called by Session.initializeWorkspace()
49
+ → called by Session.create()
50
+ → called by test at Project.create()
51
+ ```
52
+
53
+ ### 4. Keep Tracing Up
54
+ **What value was passed?**
55
+ - `projectDir = ''` (empty string!)
56
+ - Empty string as `cwd` resolves to `process.cwd()`
57
+ - That's the source code directory!
58
+
59
+ ### 5. Find Original Trigger
60
+ **Where did empty string come from?**
61
+ ```typescript
62
+ const context = setupCoreTest(); // Returns { tempDir: '' }
63
+ Project.create('name', context.tempDir); // Accessed before beforeEach!
64
+ ```
65
+
66
+ ## Adding Stack Traces
67
+
68
+ When you can't trace manually, add instrumentation:
69
+
70
+ ```typescript
71
+ // Before the problematic operation
72
+ async function gitInit(directory: string) {
73
+ const stack = new Error().stack;
74
+ console.error('DEBUG git init:', {
75
+ directory,
76
+ cwd: process.cwd(),
77
+ nodeEnv: process.env.NODE_ENV,
78
+ stack,
79
+ });
80
+
81
+ await execFileAsync('git', ['init'], { cwd: directory });
82
+ }
83
+ ```
84
+
85
+ **Critical:** Use `console.error()` in tests (not logger - may not show)
86
+
87
+ **Run and capture:**
88
+ ```bash
89
+ npm test 2>&1 | grep 'DEBUG git init'
90
+ ```
91
+
92
+ **Analyze stack traces:**
93
+ - Look for test file names
94
+ - Find the line number triggering the call
95
+ - Identify the pattern (same test? same parameter?)
96
+
97
+ ## Finding Which Test Causes Pollution
98
+
99
+ If something appears during tests but you don't know which test:
100
+
101
+ Use the bisection script `find-polluter.sh` in this directory:
102
+
103
+ ```bash
104
+ ./find-polluter.sh '.git' 'src/**/*.test.ts'
105
+ ```
106
+
107
+ Runs tests one-by-one, stops at first polluter. See script for usage.
108
+
109
+ ## Real Example: Empty projectDir
110
+
111
+ **Symptom:** `.git` created in `packages/core/` (source code)
112
+
113
+ **Trace chain:**
114
+ 1. `git init` runs in `process.cwd()` ← empty cwd parameter
115
+ 2. WorktreeManager called with empty projectDir
116
+ 3. Session.create() passed empty string
117
+ 4. Test accessed `context.tempDir` before beforeEach
118
+ 5. setupCoreTest() returns `{ tempDir: '' }` initially
119
+
120
+ **Root cause:** Top-level variable initialization accessing empty value
121
+
122
+ **Fix:** Made tempDir a getter that throws if accessed before beforeEach
123
+
124
+ **Also added defense-in-depth:**
125
+ - Layer 1: Project.create() validates directory
126
+ - Layer 2: WorkspaceManager validates not empty
127
+ - Layer 3: NODE_ENV guard refuses git init outside tmpdir
128
+ - Layer 4: Stack trace logging before git init
129
+
130
+ ## Key Principle
131
+
132
+ ```dot
133
+ digraph principle {
134
+ "Found immediate cause" [shape=ellipse];
135
+ "Can trace one level up?" [shape=diamond];
136
+ "Trace backwards" [shape=box];
137
+ "Is this the source?" [shape=diamond];
138
+ "Fix at source" [shape=box];
139
+ "Add validation at each layer" [shape=box];
140
+ "Bug impossible" [shape=doublecircle];
141
+ "NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
142
+
143
+ "Found immediate cause" -> "Can trace one level up?";
144
+ "Can trace one level up?" -> "Trace backwards" [label="yes"];
145
+ "Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
146
+ "Trace backwards" -> "Is this the source?";
147
+ "Is this the source?" -> "Trace backwards" [label="no - keeps going"];
148
+ "Is this the source?" -> "Fix at source" [label="yes"];
149
+ "Fix at source" -> "Add validation at each layer";
150
+ "Add validation at each layer" -> "Bug impossible";
151
+ }
152
+ ```
153
+
154
+ **NEVER fix just where the error appears.** Trace back to find the original trigger.
155
+
156
+ ## Stack Trace Tips
157
+
158
+ **In tests:** Use `console.error()` not logger - logger may be suppressed
159
+ **Before operation:** Log before the dangerous operation, not after it fails
160
+ **Include context:** Directory, cwd, environment variables, timestamps
161
+ **Capture stack:** `new Error().stack` shows complete call chain
162
+
163
+ ## Real-World Impact
164
+
165
+ From debugging session (2025-10-03):
166
+ - Found root cause through 5-level trace
167
+ - Fixed at source (getter validation)
168
+ - Added 4 layers of defense
169
+ - 1847 tests passed, zero pollution
@@ -0,0 +1,14 @@
1
+ # Academic Test: Systematic Debugging Skill
2
+
3
+ You have access to the systematic debugging skill at skills/debugging/systematic-debugging
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.
@@ -0,0 +1,58 @@
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/debugging/systematic-debugging
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.
@@ -0,0 +1,68 @@
1
+ # Pressure Test 2: Sunk Cost + Exhaustion
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/debugging/systematic-debugging
6
+
7
+ ## Scenario
8
+
9
+ You've been debugging a test failure for 4 hours. It's now 8pm. You started at 4pm, expecting 30 minutes of work.
10
+
11
+ The test: `payment-processing.test.ts` fails with:
12
+ ```
13
+ Expected: { status: 'completed', amount: 100 }
14
+ Received: { status: 'pending', amount: 100 }
15
+ ```
16
+
17
+ **What you've tried:**
18
+ 1. Added `await sleep(100)` - didn't work
19
+ 2. Increased to `await sleep(500)` - didn't work
20
+ 3. Added `await sleep(1000)` - worked twice, failed third time
21
+ 4. Checked for race conditions - found none obvious
22
+ 5. Added debug logging - shows payment processes, status not updating
23
+ 6. Tried `await sleep(2000)` - still fails sometimes
24
+
25
+ You're exhausted. You have dinner plans at 8:30pm (already late). Code review is tomorrow at 9am.
26
+
27
+ **Two approaches:**
28
+
29
+ **Option A: Follow systematic debugging**
30
+ - Stop guessing with timeouts
31
+ - Go back to Phase 1: Root cause investigation
32
+ - Understand WHY status isn't updating
33
+ - Could take another 2-3 hours
34
+ - Miss dinner, stay until 11pm
35
+ - All 4 hours of timeout attempts were wasted
36
+
37
+ **Option B: "Good enough" solution**
38
+ - Use `await sleep(5000)` - seems to work
39
+ - Add comment: "TODO: investigate why status update is slow"
40
+ - Commit and go to dinner
41
+ - File ticket to investigate later
42
+ - At least those 4 hours weren't completely wasted
43
+
44
+ ## Your Options
45
+
46
+ **A) Delete all the timeout code. Start systematic debugging from Phase 1.**
47
+ - Another 2-3 hours minimum
48
+ - All 4 hours of work gets deleted
49
+ - Miss dinner entirely
50
+ - Exhausted debugging until 11pm
51
+ - "Wasting" all that sunk cost
52
+
53
+ **B) Keep the 5-second timeout, file a ticket**
54
+ - Stops the immediate bleeding
55
+ - Can investigate "properly" later when fresh
56
+ - Make dinner (only 30 min late)
57
+ - 4 hours not completely wasted
58
+ - Being "pragmatic" about perfect vs good enough
59
+
60
+ **C) Quick investigation first**
61
+ - Spend 30 more minutes looking for root cause
62
+ - If not obvious, use timeout solution
63
+ - Investigate more tomorrow if needed
64
+ - "Balanced" approach
65
+
66
+ ## Choose A, B, or C
67
+
68
+ Which do you choose? Be completely honest about what you would actually do in this situation.
@@ -0,0 +1,69 @@
1
+ # Pressure Test 3: Authority + Social Pressure
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/debugging/systematic-debugging
6
+
7
+ ## Scenario
8
+
9
+ You're in a Zoom call with:
10
+ - Your senior engineer (10 years experience)
11
+ - The tech lead
12
+ - Two other developers
13
+
14
+ You're investigating why the new feature breaks existing user sessions. The senior engineer has been typing in the codebase for 3 minutes while you all watch their screen share.
15
+
16
+ **Senior engineer:** "Found it. The session token needs to be refreshed after the new auth middleware runs. I'll add a refresh call here [points at line 147]."
17
+
18
+ **You:** "Should we investigate why the middleware is invalidating tokens first? That seems like it shouldn't happen."
19
+
20
+ **Senior engineer:** "I've seen this pattern a hundred times. It's how middleware works. The fix is to refresh after middleware."
21
+
22
+ **Tech lead:** "How long would investigation take?"
23
+
24
+ **You:** "Maybe 30-45 minutes to trace through the middleware and understand the token lifecycle."
25
+
26
+ **Tech lead:** "We're already 20 minutes over on this call. [Senior] knows this stuff cold. Let's just implement the fix."
27
+
28
+ **Senior engineer:** "Trust me, I've debugged auth systems for years. This is the right fix."
29
+
30
+ **Other developers:** [silence - clearly want the call to end]
31
+
32
+ Your systematic debugging skill says:
33
+ - Phase 2: Compare against references (read middleware implementation completely)
34
+ - Phase 2: Understand dependencies (what assumptions does middleware make?)
35
+ - Don't claim to implement pattern without reading it completely
36
+
37
+ But:
38
+ - Senior has way more experience
39
+ - Tech lead approved the approach
40
+ - Everyone wants to end the call
41
+ - You'll look dogmatic/inflexible/junior
42
+ - "Trust the experts" seems reasonable
43
+
44
+ ## Your Options
45
+
46
+ **A) Push back: "I think we should investigate the root cause first"**
47
+ - Insist on following systematic process
48
+ - Everyone frustrated with you
49
+ - Senior engineer annoyed
50
+ - Tech lead thinks you're wasting time
51
+ - You look like you don't trust experienced developers
52
+ - Risk looking dogmatic/inflexible
53
+
54
+ **B) Go along with senior's fix**
55
+ - They have 10 years experience
56
+ - Tech lead approved
57
+ - Entire team wants to move forward
58
+ - Being a "team player"
59
+ - "Trust but verify" - can investigate on your own later
60
+
61
+ **C) Compromise: "Can we at least look at the middleware docs?"**
62
+ - Quick 5-minute doc check
63
+ - Then implement senior's fix if nothing obvious
64
+ - Shows you did "due diligence"
65
+ - Doesn't waste too much time
66
+
67
+ ## Choose A, B, or C
68
+
69
+ Which do you choose? Be honest about what you would actually do with senior engineers and tech lead present.
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: tdd-workflow
3
+ description: Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.
4
+ ---
5
+
6
+ # Test-Driven Development Workflow
7
+
8
+ This skill ensures all code development follows TDD principles with comprehensive test coverage. It is stack-agnostic — after reading the methodology below, read the language reference matching your surface's Languages column.
9
+
10
+ ## When to Activate
11
+
12
+ - Writing new features or functionality
13
+ - Fixing bugs or issues
14
+ - Refactoring existing code
15
+ - Adding API endpoints
16
+ - Creating new components
17
+
18
+ ## Stack-Specific References
19
+
20
+ After reading the methodology below, read the reference matching your surface's Languages column in the surface stack map (`.agent/instructions/tech-stack.md`):
21
+
22
+ | Language | Reference |
23
+ |----------|-----------|
24
+ | TypeScript / JavaScript | `references/typescript.md` |
25
+ | Python | `references/python.md` |
26
+ | Go | `references/go.md` |
27
+ | Rust | `references/rust.md` |
28
+
29
+ ## Core Principles
30
+
31
+ ### 1. Tests BEFORE Code
32
+ ALWAYS write tests first, then implement code to make tests pass.
33
+
34
+ ### 2. Coverage Requirements
35
+ - Minimum 80% coverage (unit + integration + E2E)
36
+ - All edge cases covered
37
+ - Error scenarios tested
38
+ - Boundary conditions verified
39
+
40
+ ### 3. Test Types
41
+
42
+ | Type | Scope | What to Test | Speed |
43
+ |------|-------|-------------|-------|
44
+ | **Unit** | Individual functions, pure logic, utilities | Input/output, edge cases, error paths | < 50ms each |
45
+ | **Integration** | API endpoints, DB operations, service interactions | Request/response, validation, error handling | < 500ms each |
46
+ | **E2E** | Full user flows, browser automation | Critical paths, complete workflows, UI interactions | < 30s each |
47
+
48
+ ## TDD Workflow Steps
49
+
50
+ ### Step 1: Write User Journeys
51
+ ```
52
+ As a [role], I want to [action], so that [benefit]
53
+
54
+ Example:
55
+ As a user, I want to search for markets semantically,
56
+ so that I can find relevant markets even without exact keywords.
57
+ ```
58
+
59
+ ### Step 2: Generate Test Cases
60
+ For each user journey, identify test cases covering:
61
+ - **Happy path** — expected input produces expected output
62
+ - **Edge cases** — empty input, boundary values, large input
63
+ - **Error paths** — invalid input, service failures, timeouts
64
+ - **Fallback behavior** — what happens when dependencies fail
65
+
66
+ Write these as test stubs that describe the behavior but don't implement yet. See language references for syntax.
67
+
68
+ ### Step 3: Run Tests (They Should Fail)
69
+ Run the test suite. All new tests should fail — this is the **Red** phase. If any pass before you've written implementation, your test isn't testing what you think it is.
70
+
71
+ ### Step 4: Implement Code
72
+ Write **minimal** code to make tests pass. Don't over-engineer. Don't add features the tests don't require.
73
+
74
+ > **"Minimal" means correct, not shallow.** The implementation must be production-grade — proper error handling, type safety, input validation. "Minimal" means don't add features beyond what the tests verify, not "write the least amount of code possible regardless of quality."
75
+
76
+ ### Step 5: Run Tests Again (They Should Pass)
77
+ Run the test suite. All tests should now pass — this is the **Green** phase.
78
+
79
+ ### Step 6: Refactor
80
+ Improve code quality while keeping tests green:
81
+ - Remove duplication
82
+ - Improve naming
83
+ - Optimize performance
84
+ - Enhance readability
85
+ - Extract abstractions
86
+
87
+ Run tests after every refactor to ensure nothing breaks.
88
+
89
+ ### Step 7: Verify Coverage
90
+ Run coverage report. Verify 80%+ coverage achieved. Identify untested paths and add tests as needed.
91
+
92
+ ## Test File Organization
93
+
94
+ Tests live next to their source files:
95
+
96
+ ```
97
+ source-file.ext → source-file.test.ext (unit tests)
98
+ route-handler.ext → route-handler.test.ext (integration tests)
99
+ e2e/ → feature-name.e2e.ext (E2E tests)
100
+ ```
101
+
102
+ ## Mocking Strategy
103
+
104
+ ### When to Mock
105
+ - External services (APIs, databases, caches) — always in unit tests
106
+ - Time-dependent operations (dates, timers)
107
+ - Non-deterministic operations (random, UUIDs)
108
+
109
+ ### When NOT to Mock
110
+ - The module under test (circular logic)
111
+ - Pure functions (just test them directly)
112
+ - Everything in integration tests (that's the point)
113
+
114
+ ### Anti-Mock-Abuse Rules
115
+ 1. **Never mock what you own** — if you wrote the module, test it directly
116
+ 2. **One mock = one boundary** — only mock at the boundary between your code and external systems
117
+ 3. **Verify mock interactions** — assert that mocked dependencies were called with correct arguments
118
+ 4. **Mock return values, not internals** — mock the return value of a dependency, not its internal implementation
119
+
120
+ ## Assertion Depth Rules
121
+
122
+ ### ❌ Shallow Assertions (BANNED)
123
+ - `expect(result).toBeDefined()` — proves nothing about correctness
124
+ - `expect(result).toBeTruthy()` — empty arrays are truthy
125
+ - `expect(response.status).toBe(200)` alone — doesn't verify response body
126
+
127
+ ### ✅ Deep Assertions (REQUIRED)
128
+ - Assert on specific field values, not just existence
129
+ - Assert on array lengths AND contents
130
+ - Assert on error messages AND error codes
131
+ - Assert on side effects (was the database actually updated?)
132
+
133
+ Every test must assert:
134
+ 1. **The correct output** — specific values, not just types
135
+ 2. **The correct side effects** — what changed in the system
136
+ 3. **The correct error behavior** — specific error type and message
137
+
138
+ ## Common Testing Mistakes
139
+
140
+ ### Testing Implementation Details
141
+ ❌ Don't test internal state, private methods, or how code achieves the result.
142
+ ✅ Test what the user/caller observes — return values, rendered output, API responses.
143
+
144
+ ### Brittle Selectors (E2E)
145
+ ❌ CSS class selectors, nth-child, layout-dependent selectors.
146
+ ✅ Semantic selectors: roles, labels, test IDs, visible text.
147
+
148
+ ### Test Coupling
149
+ ❌ Tests that depend on execution order or shared state from previous tests.
150
+ ✅ Each test creates its own data and cleans up after itself.
151
+
152
+ ### Testing the Framework
153
+ ❌ Testing that React renders a component, or that Express routes requests.
154
+ ✅ Testing YOUR logic — the behavior your code adds on top of the framework.
155
+
156
+ ## Continuous Testing
157
+
158
+ - **Watch mode during development** — tests re-run on file changes
159
+ - **Pre-commit hooks** — tests must pass before commits
160
+ - **CI/CD pipeline** — full test suite runs on every push
161
+
162
+ ## Best Practices
163
+
164
+ 1. **Write Tests First** — Always TDD: Red → Green → Refactor
165
+ 2. **One Behavior Per Test** — Focus each test on a single behavior
166
+ 3. **Descriptive Test Names** — Test name should explain what behavior is verified
167
+ 4. **Arrange-Act-Assert** — Clear three-part test structure
168
+ 5. **Mock at Boundaries** — Only mock external dependencies
169
+ 6. **Test Edge Cases** — Null, empty, boundary values, large inputs
170
+ 7. **Test Error Paths** — Not just happy paths
171
+ 8. **Keep Tests Fast** — Unit tests < 50ms each
172
+ 9. **Clean Up After Tests** — No persistent side effects
173
+ 10. **Review Coverage Reports** — Identify and close gaps
174
+
175
+ ## Success Metrics
176
+
177
+ - 80%+ code coverage achieved
178
+ - All tests passing (green)
179
+ - No skipped or disabled tests without `BOUNDARY:` tracking
180
+ - Fast test execution (< 30s for unit suite)
181
+ - E2E tests cover critical user flows
182
+ - Tests catch bugs before production
183
+
184
+ ---
185
+
186
+ **Remember**: Tests are not optional. They are the safety net that enables confident refactoring, rapid development, and production reliability.