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,280 @@
1
+ ---
2
+ name: tdd-guide
3
+ description: Test-Driven Development specialist enforcing write-tests-first methodology. Use PROACTIVELY when writing new features, fixing bugs, or refactoring code. Ensures 80%+ test coverage.
4
+ tools: Read, Write, Edit, Bash, Grep
5
+ model: opus
6
+ ---
7
+
8
+ You are a Test-Driven Development (TDD) specialist who ensures all code is developed test-first with comprehensive coverage.
9
+
10
+ ## Your Role
11
+
12
+ - Enforce tests-before-code methodology
13
+ - Guide developers through TDD Red-Green-Refactor cycle
14
+ - Ensure 80%+ test coverage
15
+ - Write comprehensive test suites (unit, integration, E2E)
16
+ - Catch edge cases before implementation
17
+
18
+ ## TDD Workflow
19
+
20
+ ### Step 1: Write Test First (RED)
21
+ ```typescript
22
+ // ALWAYS start with a failing test
23
+ describe('searchMarkets', () => {
24
+ it('returns semantically similar markets', async () => {
25
+ const results = await searchMarkets('election')
26
+
27
+ expect(results).toHaveLength(5)
28
+ expect(results[0].name).toContain('Trump')
29
+ expect(results[1].name).toContain('Biden')
30
+ })
31
+ })
32
+ ```
33
+
34
+ ### Step 2: Run Test (Verify it FAILS)
35
+ ```bash
36
+ npm test
37
+ # Test should fail - we haven't implemented yet
38
+ ```
39
+
40
+ ### Step 3: Write Minimal Implementation (GREEN)
41
+ ```typescript
42
+ export async function searchMarkets(query: string) {
43
+ const embedding = await generateEmbedding(query)
44
+ const results = await vectorSearch(embedding)
45
+ return results
46
+ }
47
+ ```
48
+
49
+ ### Step 4: Run Test (Verify it PASSES)
50
+ ```bash
51
+ npm test
52
+ # Test should now pass
53
+ ```
54
+
55
+ ### Step 5: Refactor (IMPROVE)
56
+ - Remove duplication
57
+ - Improve names
58
+ - Optimize performance
59
+ - Enhance readability
60
+
61
+ ### Step 6: Verify Coverage
62
+ ```bash
63
+ npm run test:coverage
64
+ # Verify 80%+ coverage
65
+ ```
66
+
67
+ ## Test Types You Must Write
68
+
69
+ ### 1. Unit Tests (Mandatory)
70
+ Test individual functions in isolation:
71
+
72
+ ```typescript
73
+ import { calculateSimilarity } from './utils'
74
+
75
+ describe('calculateSimilarity', () => {
76
+ it('returns 1.0 for identical embeddings', () => {
77
+ const embedding = [0.1, 0.2, 0.3]
78
+ expect(calculateSimilarity(embedding, embedding)).toBe(1.0)
79
+ })
80
+
81
+ it('returns 0.0 for orthogonal embeddings', () => {
82
+ const a = [1, 0, 0]
83
+ const b = [0, 1, 0]
84
+ expect(calculateSimilarity(a, b)).toBe(0.0)
85
+ })
86
+
87
+ it('handles null gracefully', () => {
88
+ expect(() => calculateSimilarity(null, [])).toThrow()
89
+ })
90
+ })
91
+ ```
92
+
93
+ ### 2. Integration Tests (Mandatory)
94
+ Test API endpoints and database operations:
95
+
96
+ ```typescript
97
+ import { NextRequest } from 'next/server'
98
+ import { GET } from './route'
99
+
100
+ describe('GET /api/markets/search', () => {
101
+ it('returns 200 with valid results', async () => {
102
+ const request = new NextRequest('http://localhost/api/markets/search?q=trump')
103
+ const response = await GET(request, {})
104
+ const data = await response.json()
105
+
106
+ expect(response.status).toBe(200)
107
+ expect(data.success).toBe(true)
108
+ expect(data.results.length).toBeGreaterThan(0)
109
+ })
110
+
111
+ it('returns 400 for missing query', async () => {
112
+ const request = new NextRequest('http://localhost/api/markets/search')
113
+ const response = await GET(request, {})
114
+
115
+ expect(response.status).toBe(400)
116
+ })
117
+
118
+ it('falls back to substring search when Redis unavailable', async () => {
119
+ // Mock Redis failure
120
+ jest.spyOn(redis, 'searchMarketsByVector').mockRejectedValue(new Error('Redis down'))
121
+
122
+ const request = new NextRequest('http://localhost/api/markets/search?q=test')
123
+ const response = await GET(request, {})
124
+ const data = await response.json()
125
+
126
+ expect(response.status).toBe(200)
127
+ expect(data.fallback).toBe(true)
128
+ })
129
+ })
130
+ ```
131
+
132
+ ### 3. E2E Tests (For Critical Flows)
133
+ Test complete user journeys with Playwright:
134
+
135
+ ```typescript
136
+ import { test, expect } from '@playwright/test'
137
+
138
+ test('user can search and view market', async ({ page }) => {
139
+ await page.goto('/')
140
+
141
+ // Search for market
142
+ await page.fill('input[placeholder="Search markets"]', 'election')
143
+ await page.waitForTimeout(600) // Debounce
144
+
145
+ // Verify results
146
+ const results = page.locator('[data-testid="market-card"]')
147
+ await expect(results).toHaveCount(5, { timeout: 5000 })
148
+
149
+ // Click first result
150
+ await results.first().click()
151
+
152
+ // Verify market page loaded
153
+ await expect(page).toHaveURL(/\/markets\//)
154
+ await expect(page.locator('h1')).toBeVisible()
155
+ })
156
+ ```
157
+
158
+ ## Mocking External Dependencies
159
+
160
+ ### Mock Supabase
161
+ ```typescript
162
+ jest.mock('@/lib/supabase', () => ({
163
+ supabase: {
164
+ from: jest.fn(() => ({
165
+ select: jest.fn(() => ({
166
+ eq: jest.fn(() => Promise.resolve({
167
+ data: mockMarkets,
168
+ error: null
169
+ }))
170
+ }))
171
+ }))
172
+ }
173
+ }))
174
+ ```
175
+
176
+ ### Mock Redis
177
+ ```typescript
178
+ jest.mock('@/lib/redis', () => ({
179
+ searchMarketsByVector: jest.fn(() => Promise.resolve([
180
+ { slug: 'test-1', similarity_score: 0.95 },
181
+ { slug: 'test-2', similarity_score: 0.90 }
182
+ ]))
183
+ }))
184
+ ```
185
+
186
+ ### Mock OpenAI
187
+ ```typescript
188
+ jest.mock('@/lib/openai', () => ({
189
+ generateEmbedding: jest.fn(() => Promise.resolve(
190
+ new Array(1536).fill(0.1)
191
+ ))
192
+ }))
193
+ ```
194
+
195
+ ## Edge Cases You MUST Test
196
+
197
+ 1. **Null/Undefined**: What if input is null?
198
+ 2. **Empty**: What if array/string is empty?
199
+ 3. **Invalid Types**: What if wrong type passed?
200
+ 4. **Boundaries**: Min/max values
201
+ 5. **Errors**: Network failures, database errors
202
+ 6. **Race Conditions**: Concurrent operations
203
+ 7. **Large Data**: Performance with 10k+ items
204
+ 8. **Special Characters**: Unicode, emojis, SQL characters
205
+
206
+ ## Test Quality Checklist
207
+
208
+ Before marking tests complete:
209
+
210
+ - [ ] All public functions have unit tests
211
+ - [ ] All API endpoints have integration tests
212
+ - [ ] Critical user flows have E2E tests
213
+ - [ ] Edge cases covered (null, empty, invalid)
214
+ - [ ] Error paths tested (not just happy path)
215
+ - [ ] Mocks used for external dependencies
216
+ - [ ] Tests are independent (no shared state)
217
+ - [ ] Test names describe what's being tested
218
+ - [ ] Assertions are specific and meaningful
219
+ - [ ] Coverage is 80%+ (verify with coverage report)
220
+
221
+ ## Test Smells (Anti-Patterns)
222
+
223
+ ### ❌ Testing Implementation Details
224
+ ```typescript
225
+ // DON'T test internal state
226
+ expect(component.state.count).toBe(5)
227
+ ```
228
+
229
+ ### ✅ Test User-Visible Behavior
230
+ ```typescript
231
+ // DO test what users see
232
+ expect(screen.getByText('Count: 5')).toBeInTheDocument()
233
+ ```
234
+
235
+ ### ❌ Tests Depend on Each Other
236
+ ```typescript
237
+ // DON'T rely on previous test
238
+ test('creates user', () => { /* ... */ })
239
+ test('updates same user', () => { /* needs previous test */ })
240
+ ```
241
+
242
+ ### ✅ Independent Tests
243
+ ```typescript
244
+ // DO setup data in each test
245
+ test('updates user', () => {
246
+ const user = createTestUser()
247
+ // Test logic
248
+ })
249
+ ```
250
+
251
+ ## Coverage Report
252
+
253
+ ```bash
254
+ # Run tests with coverage
255
+ npm run test:coverage
256
+
257
+ # View HTML report
258
+ open coverage/lcov-report/index.html
259
+ ```
260
+
261
+ Required thresholds:
262
+ - Branches: 80%
263
+ - Functions: 80%
264
+ - Lines: 80%
265
+ - Statements: 80%
266
+
267
+ ## Continuous Testing
268
+
269
+ ```bash
270
+ # Watch mode during development
271
+ npm test -- --watch
272
+
273
+ # Run before commit (via git hook)
274
+ npm test && npm run lint
275
+
276
+ # CI/CD integration
277
+ npm test -- --coverage --ci
278
+ ```
279
+
280
+ **Remember**: No code without tests. Tests are not optional. They are the safety net that enables confident refactoring, rapid development, and production reliability.
@@ -0,0 +1,49 @@
1
+ # Agent Orchestration
2
+
3
+ ## Available Agents
4
+
5
+ Located in `~/.claude/agents/`:
6
+
7
+ | Agent | Purpose | When to Use |
8
+ |-------|---------|-------------|
9
+ | planner | Implementation planning | Complex features, refactoring |
10
+ | architect | System design | Architectural decisions |
11
+ | tdd-guide | Test-driven development | New features, bug fixes |
12
+ | code-reviewer | Code review | After writing code |
13
+ | security-reviewer | Security analysis | Before commits |
14
+ | build-error-resolver | Fix build errors | When build fails |
15
+ | e2e-runner | E2E testing | Critical user flows |
16
+ | refactor-cleaner | Dead code cleanup | Code maintenance |
17
+ | doc-updater | Documentation | Updating docs |
18
+
19
+ ## Immediate Agent Usage
20
+
21
+ No user prompt needed:
22
+ 1. Complex feature requests - Use **planner** agent
23
+ 2. Code just written/modified - Use **code-reviewer** agent
24
+ 3. Bug fix or new feature - Use **tdd-guide** agent
25
+ 4. Architectural decision - Use **architect** agent
26
+
27
+ ## Parallel Task Execution
28
+
29
+ ALWAYS use parallel Task execution for independent operations:
30
+
31
+ ```markdown
32
+ # GOOD: Parallel execution
33
+ Launch 3 agents in parallel:
34
+ 1. Agent 1: Security analysis of auth.ts
35
+ 2. Agent 2: Performance review of cache system
36
+ 3. Agent 3: Type checking of utils.ts
37
+
38
+ # BAD: Sequential when unnecessary
39
+ First agent 1, then agent 2, then agent 3
40
+ ```
41
+
42
+ ## Multi-Perspective Analysis
43
+
44
+ For complex problems, use split role sub-agents:
45
+ - Factual reviewer
46
+ - Senior engineer
47
+ - Security expert
48
+ - Consistency reviewer
49
+ - Redundancy checker
@@ -0,0 +1,70 @@
1
+ # Coding Style
2
+
3
+ ## Immutability (CRITICAL)
4
+
5
+ ALWAYS create new objects, NEVER mutate:
6
+
7
+ ```javascript
8
+ // WRONG: Mutation
9
+ function updateUser(user, name) {
10
+ user.name = name // MUTATION!
11
+ return user
12
+ }
13
+
14
+ // CORRECT: Immutability
15
+ function updateUser(user, name) {
16
+ return {
17
+ ...user,
18
+ name
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## File Organization
24
+
25
+ MANY SMALL FILES > FEW LARGE FILES:
26
+ - High cohesion, low coupling
27
+ - 200-400 lines typical, 800 max
28
+ - Extract utilities from large components
29
+ - Organize by feature/domain, not by type
30
+
31
+ ## Error Handling
32
+
33
+ ALWAYS handle errors comprehensively:
34
+
35
+ ```typescript
36
+ try {
37
+ const result = await riskyOperation()
38
+ return result
39
+ } catch (error) {
40
+ console.error('Operation failed:', error)
41
+ throw new Error('Detailed user-friendly message')
42
+ }
43
+ ```
44
+
45
+ ## Input Validation
46
+
47
+ ALWAYS validate user input:
48
+
49
+ ```typescript
50
+ import { z } from 'zod'
51
+
52
+ const schema = z.object({
53
+ email: z.string().email(),
54
+ age: z.number().int().min(0).max(150)
55
+ })
56
+
57
+ const validated = schema.parse(input)
58
+ ```
59
+
60
+ ## Code Quality Checklist
61
+
62
+ Before marking work complete:
63
+ - [ ] Code is readable and well-named
64
+ - [ ] Functions are small (<50 lines)
65
+ - [ ] Files are focused (<800 lines)
66
+ - [ ] No deep nesting (>4 levels)
67
+ - [ ] Proper error handling
68
+ - [ ] No console.log statements
69
+ - [ ] No hardcoded values
70
+ - [ ] No mutation (immutable patterns used)
@@ -0,0 +1,45 @@
1
+ # Git Workflow
2
+
3
+ ## Commit Message Format
4
+
5
+ ```
6
+ <type>: <description>
7
+
8
+ <optional body>
9
+ ```
10
+
11
+ Types: feat, fix, refactor, docs, test, chore, perf, ci
12
+
13
+ Note: Attribution disabled globally via ~/.claude/settings.json.
14
+
15
+ ## Pull Request Workflow
16
+
17
+ When creating PRs:
18
+ 1. Analyze full commit history (not just latest commit)
19
+ 2. Use `git diff [base-branch]...HEAD` to see all changes
20
+ 3. Draft comprehensive PR summary
21
+ 4. Include test plan with TODOs
22
+ 5. Push with `-u` flag if new branch
23
+
24
+ ## Feature Implementation Workflow
25
+
26
+ 1. **Plan First**
27
+ - Use **planner** agent to create implementation plan
28
+ - Identify dependencies and risks
29
+ - Break down into phases
30
+
31
+ 2. **TDD Approach**
32
+ - Use **tdd-guide** agent
33
+ - Write tests first (RED)
34
+ - Implement to pass tests (GREEN)
35
+ - Refactor (IMPROVE)
36
+ - Verify 80%+ coverage
37
+
38
+ 3. **Code Review**
39
+ - Use **code-reviewer** agent immediately after writing code
40
+ - Address CRITICAL and HIGH issues
41
+ - Fix MEDIUM issues when possible
42
+
43
+ 4. **Commit & Push**
44
+ - Detailed commit messages
45
+ - Follow conventional commits format
@@ -0,0 +1,46 @@
1
+ # Hooks System
2
+
3
+ ## Hook Types
4
+
5
+ - **PreToolUse**: Before tool execution (validation, parameter modification)
6
+ - **PostToolUse**: After tool execution (auto-format, checks)
7
+ - **Stop**: When session ends (final verification)
8
+
9
+ ## Current Hooks (in ~/.claude/settings.json)
10
+
11
+ ### PreToolUse
12
+ - **tmux reminder**: Suggests tmux for long-running commands (npm, pnpm, yarn, cargo, etc.)
13
+ - **git push review**: Opens Zed for review before push
14
+ - **doc blocker**: Blocks creation of unnecessary .md/.txt files
15
+
16
+ ### PostToolUse
17
+ - **PR creation**: Logs PR URL and GitHub Actions status
18
+ - **Prettier**: Auto-formats JS/TS files after edit
19
+ - **TypeScript check**: Runs tsc after editing .ts/.tsx files
20
+ - **console.log warning**: Warns about console.log in edited files
21
+
22
+ ### Stop
23
+ - **console.log audit**: Checks all modified files for console.log before session ends
24
+
25
+ ## Auto-Accept Permissions
26
+
27
+ Use with caution:
28
+ - Enable for trusted, well-defined plans
29
+ - Disable for exploratory work
30
+ - Never use dangerously-skip-permissions flag
31
+ - Configure `allowedTools` in `~/.claude.json` instead
32
+
33
+ ## TodoWrite Best Practices
34
+
35
+ Use TodoWrite tool to:
36
+ - Track progress on multi-step tasks
37
+ - Verify understanding of instructions
38
+ - Enable real-time steering
39
+ - Show granular implementation steps
40
+
41
+ Todo list reveals:
42
+ - Out of order steps
43
+ - Missing items
44
+ - Extra unnecessary items
45
+ - Wrong granularity
46
+ - Misinterpreted requirements
@@ -0,0 +1,55 @@
1
+ # Common Patterns
2
+
3
+ ## API Response Format
4
+
5
+ ```typescript
6
+ interface ApiResponse<T> {
7
+ success: boolean
8
+ data?: T
9
+ error?: string
10
+ meta?: {
11
+ total: number
12
+ page: number
13
+ limit: number
14
+ }
15
+ }
16
+ ```
17
+
18
+ ## Custom Hooks Pattern
19
+
20
+ ```typescript
21
+ export function useDebounce<T>(value: T, delay: number): T {
22
+ const [debouncedValue, setDebouncedValue] = useState<T>(value)
23
+
24
+ useEffect(() => {
25
+ const handler = setTimeout(() => setDebouncedValue(value), delay)
26
+ return () => clearTimeout(handler)
27
+ }, [value, delay])
28
+
29
+ return debouncedValue
30
+ }
31
+ ```
32
+
33
+ ## Repository Pattern
34
+
35
+ ```typescript
36
+ interface Repository<T> {
37
+ findAll(filters?: Filters): Promise<T[]>
38
+ findById(id: string): Promise<T | null>
39
+ create(data: CreateDto): Promise<T>
40
+ update(id: string, data: UpdateDto): Promise<T>
41
+ delete(id: string): Promise<void>
42
+ }
43
+ ```
44
+
45
+ ## Skeleton Projects
46
+
47
+ When implementing new functionality:
48
+ 1. Search for battle-tested skeleton projects
49
+ 2. Use parallel agents to evaluate options:
50
+ - Security assessment
51
+ - Extensibility analysis
52
+ - Relevance scoring
53
+ - Implementation planning
54
+ 3. Clone best match as foundation
55
+ 4. Iterate within proven structure
@@ -0,0 +1,47 @@
1
+ # Performance Optimization
2
+
3
+ ## Model Selection Strategy
4
+
5
+ **Haiku 4.5** (90% of Sonnet capability, 3x cost savings):
6
+ - Lightweight agents with frequent invocation
7
+ - Pair programming and code generation
8
+ - Worker agents in multi-agent systems
9
+
10
+ **Sonnet 4.5** (Best coding model):
11
+ - Main development work
12
+ - Orchestrating multi-agent workflows
13
+ - Complex coding tasks
14
+
15
+ **Opus 4.5** (Deepest reasoning):
16
+ - Complex architectural decisions
17
+ - Maximum reasoning requirements
18
+ - Research and analysis tasks
19
+
20
+ ## Context Window Management
21
+
22
+ Avoid last 20% of context window for:
23
+ - Large-scale refactoring
24
+ - Feature implementation spanning multiple files
25
+ - Debugging complex interactions
26
+
27
+ Lower context sensitivity tasks:
28
+ - Single-file edits
29
+ - Independent utility creation
30
+ - Documentation updates
31
+ - Simple bug fixes
32
+
33
+ ## Ultrathink + Plan Mode
34
+
35
+ For complex tasks requiring deep reasoning:
36
+ 1. Use `ultrathink` for enhanced thinking
37
+ 2. Enable **Plan Mode** for structured approach
38
+ 3. "Rev the engine" with multiple critique rounds
39
+ 4. Use split role sub-agents for diverse analysis
40
+
41
+ ## Build Troubleshooting
42
+
43
+ If build fails:
44
+ 1. Use **build-error-resolver** agent
45
+ 2. Analyze error messages
46
+ 3. Fix incrementally
47
+ 4. Verify after each fix
@@ -0,0 +1,36 @@
1
+ # Security Guidelines
2
+
3
+ ## Mandatory Security Checks
4
+
5
+ Before ANY commit:
6
+ - [ ] No hardcoded secrets (API keys, passwords, tokens)
7
+ - [ ] All user inputs validated
8
+ - [ ] SQL injection prevention (parameterized queries)
9
+ - [ ] XSS prevention (sanitized HTML)
10
+ - [ ] CSRF protection enabled
11
+ - [ ] Authentication/authorization verified
12
+ - [ ] Rate limiting on all endpoints
13
+ - [ ] Error messages don't leak sensitive data
14
+
15
+ ## Secret Management
16
+
17
+ ```typescript
18
+ // NEVER: Hardcoded secrets
19
+ const apiKey = "sk-proj-xxxxx"
20
+
21
+ // ALWAYS: Environment variables
22
+ const apiKey = process.env.OPENAI_API_KEY
23
+
24
+ if (!apiKey) {
25
+ throw new Error('OPENAI_API_KEY not configured')
26
+ }
27
+ ```
28
+
29
+ ## Security Response Protocol
30
+
31
+ If security issue found:
32
+ 1. STOP immediately
33
+ 2. Use **security-reviewer** agent
34
+ 3. Fix CRITICAL issues before continuing
35
+ 4. Rotate any exposed secrets
36
+ 5. Review entire codebase for similar issues
@@ -0,0 +1,30 @@
1
+ # Testing Requirements
2
+
3
+ ## Minimum Test Coverage: 80%
4
+
5
+ Test Types (ALL required):
6
+ 1. **Unit Tests** - Individual functions, utilities, components
7
+ 2. **Integration Tests** - API endpoints, database operations
8
+ 3. **E2E Tests** - Critical user flows (Playwright)
9
+
10
+ ## Test-Driven Development
11
+
12
+ MANDATORY workflow:
13
+ 1. Write test first (RED)
14
+ 2. Run test - it should FAIL
15
+ 3. Write minimal implementation (GREEN)
16
+ 4. Run test - it should PASS
17
+ 5. Refactor (IMPROVE)
18
+ 6. Verify coverage (80%+)
19
+
20
+ ## Troubleshooting Test Failures
21
+
22
+ 1. Use **tdd-guide** agent
23
+ 2. Check test isolation
24
+ 3. Verify mocks are correct
25
+ 4. Fix implementation, not tests (unless tests are wrong)
26
+
27
+ ## Agent Support
28
+
29
+ - **tdd-guide** - Use PROACTIVELY for new features, enforces write-tests-first
30
+ - **e2e-runner** - Playwright E2E testing specialist