antigravity-init 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.agent/agents/architect.md +211 -0
  2. package/.agent/agents/build-error-resolver.md +532 -0
  3. package/.agent/agents/code-reviewer.md +104 -0
  4. package/.agent/agents/doc-updater.md +452 -0
  5. package/.agent/agents/e2e-runner.md +708 -0
  6. package/.agent/agents/planner.md +119 -0
  7. package/.agent/agents/refactor-cleaner.md +306 -0
  8. package/.agent/agents/security-reviewer.md +545 -0
  9. package/.agent/agents/tdd-guide.md +280 -0
  10. package/.agent/rules/agents.md +49 -0
  11. package/.agent/rules/coding-style.md +70 -0
  12. package/.agent/rules/git-workflow.md +45 -0
  13. package/.agent/rules/hooks.md +46 -0
  14. package/.agent/rules/patterns.md +55 -0
  15. package/.agent/rules/performance.md +47 -0
  16. package/.agent/rules/security.md +36 -0
  17. package/.agent/rules/testing.md +30 -0
  18. package/.agent/skills/backend-patterns/SKILL.md +582 -0
  19. package/.agent/skills/brainstorming/SKILL.md +54 -0
  20. package/.agent/skills/coding-standards/SKILL.md +520 -0
  21. package/.agent/skills/dispatching-parallel-agents/SKILL.md +180 -0
  22. package/.agent/skills/executing-plans/SKILL.md +76 -0
  23. package/.agent/skills/finishing-a-development-branch/SKILL.md +200 -0
  24. package/.agent/skills/frontend-patterns/SKILL.md +631 -0
  25. package/.agent/skills/receiving-code-review/SKILL.md +213 -0
  26. package/.agent/skills/requesting-code-review/SKILL.md +105 -0
  27. package/.agent/skills/requesting-code-review/code-reviewer.md +48 -0
  28. package/.agent/skills/security-review/SKILL.md +494 -0
  29. package/.agent/skills/subagent-driven-development/SKILL.md +240 -0
  30. package/.agent/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
  31. package/.agent/skills/subagent-driven-development/implementer-prompt.md +78 -0
  32. package/.agent/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  33. package/.agent/skills/systematic-debugging/CREATION-LOG.md +119 -0
  34. package/.agent/skills/systematic-debugging/SKILL.md +296 -0
  35. package/.agent/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  36. package/.agent/skills/systematic-debugging/condition-based-waiting.md +115 -0
  37. package/.agent/skills/systematic-debugging/defense-in-depth.md +122 -0
  38. package/.agent/skills/systematic-debugging/find-polluter.sh +63 -0
  39. package/.agent/skills/systematic-debugging/root-cause-tracing.md +169 -0
  40. package/.agent/skills/systematic-debugging/test-academic.md +14 -0
  41. package/.agent/skills/systematic-debugging/test-pressure-1.md +58 -0
  42. package/.agent/skills/systematic-debugging/test-pressure-2.md +68 -0
  43. package/.agent/skills/systematic-debugging/test-pressure-3.md +69 -0
  44. package/.agent/skills/test-driven-development/SKILL.md +371 -0
  45. package/.agent/skills/test-driven-development/testing-anti-patterns.md +299 -0
  46. package/.agent/skills/ui-ux-pro-max/SKILL.md +292 -0
  47. package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  48. package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  49. package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
  50. package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  51. package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  52. package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  53. package/.agent/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  54. package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  55. package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  56. package/.agent/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  57. package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  58. package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  59. package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  60. package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  61. package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  62. package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  63. package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  64. package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  65. package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  66. package/.agent/skills/ui-ux-pro-max/data/styles.csv +68 -0
  67. package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  68. package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  69. package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  70. package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  71. package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
  72. package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
  73. package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-314.pyc +0 -0
  74. package/.agent/skills/ui-ux-pro-max/scripts/core.py +253 -0
  75. package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  76. package/.agent/skills/ui-ux-pro-max/scripts/search.py +106 -0
  77. package/.agent/skills/using-git-worktrees/SKILL.md +217 -0
  78. package/.agent/skills/using-superpowers/SKILL.md +87 -0
  79. package/.agent/skills/verification-before-completion/SKILL.md +139 -0
  80. package/.agent/skills/writing-plans/SKILL.md +116 -0
  81. package/.agent/skills/writing-skills/SKILL.md +655 -0
  82. package/.agent/skills/writing-skills/anthropic-best-practices.md +1150 -0
  83. package/.agent/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  84. package/.agent/skills/writing-skills/graphviz-conventions.dot +172 -0
  85. package/.agent/skills/writing-skills/persuasion-principles.md +187 -0
  86. package/.agent/skills/writing-skills/render-graphs.js +168 -0
  87. package/.agent/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  88. package/.agent/workflows/brainstorm.md +5 -0
  89. package/.agent/workflows/build-fix.md +212 -0
  90. package/.agent/workflows/code-review.md +169 -0
  91. package/.agent/workflows/execute-plan.md +5 -0
  92. package/.agent/workflows/tdd-workflow.md +166 -0
  93. package/.agent/workflows/ui-ux-pro-max.md +292 -0
  94. package/.agent/workflows/write-plan.md +5 -0
  95. package/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  96. package/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  97. package/.shared/ui-ux-pro-max/data/icons.csv +101 -0
  98. package/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  99. package/.shared/ui-ux-pro-max/data/products.csv +97 -0
  100. package/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  101. package/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
  102. package/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  103. package/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  104. package/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  105. package/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  106. package/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  107. package/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  108. package/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  109. package/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  110. package/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  111. package/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  112. package/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  113. package/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  114. package/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  115. package/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  116. package/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  117. package/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  118. package/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
  119. package/.shared/ui-ux-pro-max/scripts/core.py +258 -0
  120. package/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
  121. package/.shared/ui-ux-pro-max/scripts/search.py +106 -0
  122. package/bin/cli.js +53 -0
  123. package/package.json +30 -0
@@ -0,0 +1,212 @@
1
+ ---
2
+ description: Incrementally fix TypeScript and build errors one at a time
3
+ ---
4
+
5
+ # Build and Fix Workflow
6
+
7
+ Systematically fix TypeScript and build errors incrementally.
8
+
9
+ ## When to Use
10
+
11
+ - Build is failing
12
+ - TypeScript errors present
13
+ - After major refactoring
14
+ - After dependency updates
15
+ - When errors are overwhelming
16
+
17
+ ## Strategy
18
+
19
+ **Fix one error at a time for safety!**
20
+
21
+ Avoid cascading failures by:
22
+ - Fixing errors incrementally
23
+ - Verifying each fix before moving to next
24
+ - Stopping if fix introduces new errors
25
+
26
+ ## Steps
27
+
28
+ ### 1. Run Build
29
+ ```bash
30
+ npm run build
31
+ # or
32
+ pnpm build
33
+ # or
34
+ yarn build
35
+ ```
36
+
37
+ ### 2. Parse Error Output
38
+
39
+ Group errors by:
40
+ - File location
41
+ - Error type
42
+ - Severity
43
+
44
+ Sort by:
45
+ - CRITICAL (blocking) first
46
+ - HIGH (important) second
47
+ - MEDIUM/LOW last
48
+
49
+ ### 3. Fix Each Error Incrementally
50
+
51
+ For each error:
52
+
53
+ #### a) Show Error Context
54
+ ```bash
55
+ # View 5 lines before/after error location
56
+ ```
57
+
58
+ #### b) Explain the Issue
59
+ Understand what's causing the error:
60
+ - Type mismatch?
61
+ - Missing import?
62
+ - Syntax error?
63
+ - Configuration issue?
64
+
65
+ #### c) Propose Fix
66
+ Suggest the appropriate fix:
67
+ ```typescript
68
+ // ❌ Current (broken)
69
+ const value: string = 123
70
+
71
+ // ✅ Fixed
72
+ const value: string = "123"
73
+ ```
74
+
75
+ #### d) Apply Fix
76
+ Make the change to the file
77
+
78
+ #### e) Re-run Build
79
+ ```bash
80
+ npm run build
81
+ ```
82
+
83
+ #### f) Verify Error Resolved
84
+ - ✅ Error is gone
85
+ - ✅ No new errors introduced
86
+ - ✅ Build progresses further
87
+
88
+ ### 4. Stop Conditions
89
+
90
+ Stop fixing if:
91
+ - ❌ Fix introduces new errors
92
+ - ❌ Same error persists after 3 attempts
93
+ - ❌ User requests pause
94
+ - ❌ Errors seem to be cascading
95
+ - ❌ Root cause is unclear
96
+
97
+ **Ask for help** if stuck!
98
+
99
+ ### 5. Show Summary
100
+
101
+ After fixing session:
102
+
103
+ ```
104
+ ╔══════════════════════════════════════╗
105
+ ║ Build Fix Summary ║
106
+ ╠══════════════════════════════════════╣
107
+ ║ Errors Fixed: X ║
108
+ ║ Errors Remaining: Y ║
109
+ ║ New Errors: Z ║
110
+ ║ Status: [PASS/FAIL] ║
111
+ ╚══════════════════════════════════════╝
112
+ ```
113
+
114
+ ## Common Error Types
115
+
116
+ ### TypeScript Errors
117
+
118
+ **Type Mismatch:**
119
+ ```typescript
120
+ // ❌ Error: Type 'number' is not assignable to type 'string'
121
+ const name: string = 123
122
+
123
+ // ✅ Fix
124
+ const name: string = "123"
125
+ ```
126
+
127
+ **Missing Property:**
128
+ ```typescript
129
+ // ❌ Error: Property 'id' is missing
130
+ const user: User = { name: "John" }
131
+
132
+ // ✅ Fix
133
+ const user: User = { id: 1, name: "John" }
134
+ ```
135
+
136
+ **Null/Undefined:**
137
+ ```typescript
138
+ // ❌ Error: Object is possibly 'undefined'
139
+ const value = data.value
140
+
141
+ // ✅ Fix
142
+ const value = data?.value ?? defaultValue
143
+ ```
144
+
145
+ ### Build Errors
146
+
147
+ **Missing Dependency:**
148
+ ```bash
149
+ # ❌ Error: Cannot find module 'lodash'
150
+ npm install lodash
151
+ npm install --save-dev @types/lodash
152
+ ```
153
+
154
+ **Configuration Issue:**
155
+ ```json
156
+ // tsconfig.json
157
+ {
158
+ "compilerOptions": {
159
+ "strict": true,
160
+ "skipLibCheck": true // Add if type errors in node_modules
161
+ }
162
+ }
163
+ ```
164
+
165
+ ## Best Practices
166
+
167
+ **DO:**
168
+ - ✅ Fix one error at a time
169
+ - ✅ Verify each fix before moving on
170
+ - ✅ Understand the root cause
171
+ - ✅ Run build after each fix
172
+ - ✅ Commit working fixes incrementally
173
+
174
+ **DON'T:**
175
+ - ❌ Try to fix all errors at once
176
+ - ❌ Skip verification steps
177
+ - ❌ Use `@ts-ignore` without understanding
178
+ - ❌ Disable strict mode to hide errors
179
+ - ❌ Continue if errors are cascading
180
+
181
+ ## Safety Checks
182
+
183
+ Before applying a fix:
184
+ - [ ] Understand why the error occurred
185
+ - [ ] Know what the fix will change
186
+ - [ ] Have a plan if fix fails
187
+ - [ ] Can revert if needed
188
+
189
+ After applying a fix:
190
+ - [ ] Build runs further than before
191
+ - [ ] No new errors introduced
192
+ - [ ] Error is actually resolved
193
+ - [ ] Code still makes sense
194
+
195
+ ## Important Notes
196
+
197
+ **CRITICAL:**
198
+ - One error at a time
199
+ - Verify after each fix
200
+ - Stop if cascading failures
201
+ - Ask for help if stuck
202
+
203
+ **Never:**
204
+ - Blindly apply fixes
205
+ - Use `any` type everywhere
206
+ - Disable TypeScript checks
207
+ - Skip understanding the error
208
+
209
+ ## Related
210
+
211
+ - Agent: `build-error-resolver` in `.agent/agents/build-error-resolver.md`
212
+ - Skill: `systematic-debugging` in `.agent/skills/systematic-debugging/`
@@ -0,0 +1,169 @@
1
+ ---
2
+ description: Comprehensive security and quality review of code changes
3
+ ---
4
+
5
+ # Code Review Workflow
6
+
7
+ Perform comprehensive security and quality review of uncommitted changes.
8
+
9
+ ## When to Use
10
+
11
+ - Before committing code
12
+ - Before creating pull requests
13
+ - After implementing features
14
+ - When security is critical
15
+ - Before production deployment
16
+
17
+ ## Steps
18
+
19
+ ### 1. Get Changed Files
20
+ ```bash
21
+ git diff --name-only HEAD
22
+ ```
23
+
24
+ ### 2. Review Each File for Issues
25
+
26
+ #### Security Issues (CRITICAL) 🔴
27
+
28
+ Check for:
29
+ - [ ] Hardcoded credentials, API keys, tokens
30
+ - [ ] SQL injection vulnerabilities
31
+ - [ ] XSS vulnerabilities
32
+ - [ ] Missing input validation
33
+ - [ ] Insecure dependencies
34
+ - [ ] Path traversal risks
35
+ - [ ] Command injection
36
+ - [ ] Insufficient authorization
37
+ - [ ] Race conditions in financial operations
38
+ - [ ] Logging sensitive data
39
+
40
+ #### Code Quality (HIGH) 🟡
41
+
42
+ Check for:
43
+ - [ ] Functions > 50 lines
44
+ - [ ] Files > 800 lines
45
+ - [ ] Nesting depth > 4 levels
46
+ - [ ] Missing error handling
47
+ - [ ] console.log statements
48
+ - [ ] TODO/FIXME comments
49
+ - [ ] Missing JSDoc for public APIs
50
+ - [ ] Duplicate code
51
+ - [ ] Complex conditionals
52
+
53
+ #### Best Practices (MEDIUM) 🟢
54
+
55
+ Check for:
56
+ - [ ] Mutation patterns (use immutable instead)
57
+ - [ ] Emoji usage in code/comments
58
+ - [ ] Missing tests for new code
59
+ - [ ] Accessibility issues (a11y)
60
+ - [ ] Performance concerns
61
+ - [ ] Inconsistent naming
62
+ - [ ] Missing type annotations
63
+
64
+ ### 3. Generate Report
65
+
66
+ For each issue found, document:
67
+
68
+ **Severity:** CRITICAL | HIGH | MEDIUM | LOW
69
+
70
+ **Location:** `file.ts:line`
71
+
72
+ **Issue:** Description of the problem
73
+
74
+ **Suggested Fix:**
75
+ ```typescript
76
+ // ✅ Correct implementation
77
+ ```
78
+
79
+ ### 4. Decision
80
+
81
+ - **BLOCK** if CRITICAL or HIGH security issues found
82
+ - **REQUEST CHANGES** if HIGH quality issues found
83
+ - **APPROVE WITH SUGGESTIONS** if only MEDIUM/LOW issues
84
+ - **APPROVE** if no issues found
85
+
86
+ ## Security Checklist
87
+
88
+ Before approving any code:
89
+
90
+ - [ ] No hardcoded secrets
91
+ - [ ] All inputs validated
92
+ - [ ] SQL injection prevention (parameterized queries)
93
+ - [ ] XSS prevention (sanitized HTML)
94
+ - [ ] CSRF protection enabled
95
+ - [ ] Authentication/authorization verified
96
+ - [ ] Rate limiting on endpoints
97
+ - [ ] Error messages don't leak sensitive data
98
+ - [ ] Dependencies up to date
99
+ - [ ] No vulnerable packages
100
+
101
+ ## Quality Checklist
102
+
103
+ - [ ] Code follows project style guide
104
+ - [ ] Functions are small and focused
105
+ - [ ] Files are reasonably sized
106
+ - [ ] Error handling is comprehensive
107
+ - [ ] Tests cover new code (80%+ coverage)
108
+ - [ ] Documentation is updated
109
+ - [ ] No debug code (console.log, debugger)
110
+ - [ ] Performance is acceptable
111
+
112
+ ## Report Template
113
+
114
+ ```markdown
115
+ # Code Review Report
116
+
117
+ **Reviewer:** [Your Name]
118
+ **Date:** [Date]
119
+ **Files Reviewed:** [Count]
120
+
121
+ ## Summary
122
+
123
+ - **Critical Issues:** X
124
+ - **High Issues:** Y
125
+ - **Medium Issues:** Z
126
+ - **Low Issues:** W
127
+ - **Risk Level:** 🔴 HIGH / 🟡 MEDIUM / 🟢 LOW
128
+
129
+ ## Critical Issues (Fix Immediately)
130
+
131
+ ### 1. [Issue Title]
132
+ **File:** `path/to/file.ts:123`
133
+ **Severity:** CRITICAL
134
+ **Category:** SQL Injection
135
+
136
+ **Issue:**
137
+ [Description]
138
+
139
+ **Fix:**
140
+ ```typescript
141
+ // ✅ Correct implementation
142
+ ```
143
+
144
+ ## Decision
145
+
146
+ **BLOCK** / **REQUEST CHANGES** / **APPROVE WITH SUGGESTIONS** / **APPROVE**
147
+
148
+ ---
149
+
150
+ Never approve code with security vulnerabilities!
151
+ ```
152
+
153
+ ## Important Notes
154
+
155
+ **CRITICAL:** Never approve code with:
156
+ - Hardcoded secrets
157
+ - SQL injection vulnerabilities
158
+ - Missing authentication/authorization
159
+ - Unvalidated user input
160
+ - Known security vulnerabilities
161
+
162
+ **Block the commit/PR** until these are fixed.
163
+
164
+ ## Related
165
+
166
+ - Agent: `code-reviewer` in `.agent/agents/code-reviewer.md`
167
+ - Agent: `security-reviewer` in `.agent/agents/security-reviewer.md`
168
+ - Skill: `security-review` in `.agent/skills/security-review/`
169
+ - Rules: `.agent/rules/security.md`
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: Execute plan in batches
3
+ ---
4
+
5
+ Invoke the executing-plans skill and follow it exactly as presented to you.
@@ -0,0 +1,166 @@
1
+ ---
2
+ description: Test-Driven Development workflow - write tests first, implement minimal code, refactor
3
+ ---
4
+
5
+ # TDD Workflow
6
+
7
+ Enforce test-driven development methodology with RED → GREEN → REFACTOR cycle.
8
+
9
+ ## When to Use
10
+
11
+ - Implementing new features
12
+ - Adding new functions/components
13
+ - Fixing bugs (write test that reproduces bug first)
14
+ - Refactoring existing code
15
+ - Building critical business logic
16
+
17
+ ## TDD Cycle
18
+
19
+ ```
20
+ RED → GREEN → REFACTOR → REPEAT
21
+
22
+ RED: Write a failing test
23
+ GREEN: Write minimal code to pass
24
+ REFACTOR: Improve code, keep tests passing
25
+ REPEAT: Next feature/scenario
26
+ ```
27
+
28
+ ## Steps
29
+
30
+ ### 1. Define Interface (SCAFFOLD)
31
+ Define types/interfaces first before any implementation.
32
+
33
+ ```typescript
34
+ export interface MyData {
35
+ // Define your data structure
36
+ }
37
+
38
+ export function myFunction(data: MyData): ReturnType {
39
+ throw new Error('Not implemented')
40
+ }
41
+ ```
42
+
43
+ ### 2. Write Failing Test (RED)
44
+ Write tests that will FAIL because code doesn't exist yet.
45
+
46
+ ```typescript
47
+ import { myFunction } from './myModule'
48
+
49
+ describe('myFunction', () => {
50
+ it('should handle happy path', () => {
51
+ const result = myFunction(testData)
52
+ expect(result).toBe(expectedValue)
53
+ })
54
+
55
+ it('should handle edge cases', () => {
56
+ // Test edge cases
57
+ })
58
+
59
+ it('should handle errors', () => {
60
+ // Test error conditions
61
+ })
62
+ })
63
+ ```
64
+
65
+ ### 3. Run Tests - Verify FAIL
66
+ ```bash
67
+ npm test
68
+ # Verify tests fail for the RIGHT reason
69
+ ```
70
+
71
+ ✅ Tests should fail with "Not implemented" or similar
72
+
73
+ ### 4. Implement Minimal Code (GREEN)
74
+ Write just enough code to make tests pass.
75
+
76
+ ```typescript
77
+ export function myFunction(data: MyData): ReturnType {
78
+ // Minimal implementation to pass tests
79
+ return result
80
+ }
81
+ ```
82
+
83
+ ### 5. Run Tests - Verify PASS
84
+ ```bash
85
+ npm test
86
+ # All tests should pass
87
+ ```
88
+
89
+ ✅ All tests passing!
90
+
91
+ ### 6. Refactor (IMPROVE)
92
+ Improve code quality while keeping tests green.
93
+
94
+ - Extract constants
95
+ - Improve readability
96
+ - Add helper functions
97
+ - Optimize performance
98
+
99
+ ### 7. Verify Tests Still Pass
100
+ ```bash
101
+ npm test
102
+ # Tests should still pass after refactoring
103
+ ```
104
+
105
+ ### 8. Check Coverage
106
+ ```bash
107
+ npm test -- --coverage
108
+ # Ensure 80%+ coverage (100% for critical code)
109
+ ```
110
+
111
+ ## Coverage Requirements
112
+
113
+ - **80% minimum** for all code
114
+ - **100% required** for:
115
+ - Financial calculations
116
+ - Authentication logic
117
+ - Security-critical code
118
+ - Core business logic
119
+
120
+ ## Best Practices
121
+
122
+ **DO:**
123
+ - ✅ Write the test FIRST, before any implementation
124
+ - ✅ Run tests and verify they FAIL before implementing
125
+ - ✅ Write minimal code to make tests pass
126
+ - ✅ Refactor only after tests are green
127
+ - ✅ Add edge cases and error scenarios
128
+ - ✅ Aim for 80%+ coverage
129
+
130
+ **DON'T:**
131
+ - ❌ Write implementation before tests
132
+ - ❌ Skip running tests after each change
133
+ - ❌ Write too much code at once
134
+ - ❌ Ignore failing tests
135
+ - ❌ Test implementation details (test behavior)
136
+ - ❌ Mock everything (prefer integration tests)
137
+
138
+ ## Test Types
139
+
140
+ **Unit Tests** (Function-level):
141
+ - Happy path scenarios
142
+ - Edge cases (empty, null, max values)
143
+ - Error conditions
144
+ - Boundary values
145
+
146
+ **Integration Tests** (Component-level):
147
+ - API endpoints
148
+ - Database operations
149
+ - External service calls
150
+ - React components with hooks
151
+
152
+ **E2E Tests** (use `/e2e` workflow):
153
+ - Critical user flows
154
+ - Multi-step processes
155
+ - Full stack integration
156
+
157
+ ## Important Notes
158
+
159
+ **MANDATORY**: Tests must be written BEFORE implementation.
160
+
161
+ Never skip the RED phase. Never write code before tests.
162
+
163
+ ## Related
164
+
165
+ - Agent: `tdd-guide` in `.agent/agents/tdd-guide.md`
166
+ - Skill: `test-driven-development` in `.agent/skills/test-driven-development/`