agent-configs 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 (85) hide show
  1. package/README.md +223 -0
  2. package/agents/architect.md +211 -0
  3. package/agents/code-reviewer.md +104 -0
  4. package/agents/planner.md +119 -0
  5. package/agents/refactor-cleaner.md +306 -0
  6. package/agents/security-reviewer.md +545 -0
  7. package/agents/tdd-guide.md +280 -0
  8. package/bundles/bk-chat-bundle/README.md +48 -0
  9. package/bundles/bk-chat-bundle/manifest.json +10 -0
  10. package/bundles/continuous-learning/.claude/commands/evolve.md +190 -0
  11. package/bundles/continuous-learning/.claude/commands/instinct-status.md +64 -0
  12. package/bundles/continuous-learning/.claude/commands/learn.md +83 -0
  13. package/bundles/continuous-learning/.claude/hooks/learning-end.js +85 -0
  14. package/bundles/continuous-learning/.claude/hooks/observe.js +131 -0
  15. package/bundles/continuous-learning/.claude/lib/learning.js +559 -0
  16. package/bundles/continuous-learning/.claude/lib/utils.js +312 -0
  17. package/bundles/continuous-learning/.claude/skills/continuous-learning/SKILL.md +200 -0
  18. package/bundles/continuous-learning/.cursor/hooks/learning-end.js +102 -0
  19. package/bundles/continuous-learning/.cursor/rules/continuous-learning.mdc +34 -0
  20. package/bundles/continuous-learning/.cursor/skills/continuous-learning/SKILL.md +77 -0
  21. package/bundles/continuous-learning/README.md +159 -0
  22. package/bundles/continuous-learning/manifest.json +51 -0
  23. package/bundles/planning-bundle/README.md +34 -0
  24. package/bundles/planning-bundle/manifest.json +10 -0
  25. package/bundles/review-bundle/README.md +43 -0
  26. package/bundles/review-bundle/manifest.json +11 -0
  27. package/bundles/shared-memory/.claude/commands/list-sessions.md +124 -0
  28. package/bundles/shared-memory/.claude/commands/load-session.md +169 -0
  29. package/bundles/shared-memory/.claude/commands/save-session.md +137 -0
  30. package/bundles/shared-memory/.claude/hooks/memory-compact.js +43 -0
  31. package/bundles/shared-memory/.claude/hooks/memory-end.js +42 -0
  32. package/bundles/shared-memory/.claude/hooks/memory-start.js +59 -0
  33. package/bundles/shared-memory/.claude/lib/memory.js +416 -0
  34. package/bundles/shared-memory/.claude/lib/utils.js +209 -0
  35. package/bundles/shared-memory/.claude/skills/shared-memory/SKILL.md +183 -0
  36. package/bundles/shared-memory/.cursor/hooks/memory-start.js +42 -0
  37. package/bundles/shared-memory/.cursor/rules/shared-memory.mdc +37 -0
  38. package/bundles/shared-memory/.cursor/skills/shared-memory/SKILL.md +183 -0
  39. package/bundles/tdd-bundle/README.md +33 -0
  40. package/bundles/tdd-bundle/manifest.json +10 -0
  41. package/cli.js +978 -0
  42. package/commands/build-fix.md +29 -0
  43. package/commands/code-review.md +40 -0
  44. package/commands/e2e.md +363 -0
  45. package/commands/learn.md +114 -0
  46. package/commands/plan.md +113 -0
  47. package/commands/refactor-clean.md +28 -0
  48. package/commands/tdd.md +326 -0
  49. package/commands/test-coverage.md +27 -0
  50. package/commands/update-codemaps.md +17 -0
  51. package/commands/update-docs.md +31 -0
  52. package/configs.json +158 -0
  53. package/hooks/hooks.json +101 -0
  54. package/package.json +58 -0
  55. package/rules/agents.md +49 -0
  56. package/rules/coding-style.md +70 -0
  57. package/rules/git-workflow.md +45 -0
  58. package/rules/hooks.md +46 -0
  59. package/rules/patterns.md +55 -0
  60. package/rules/performance.md +47 -0
  61. package/rules/security.md +36 -0
  62. package/rules/testing.md +30 -0
  63. package/skills/ai-config-architect/SKILL.md +59 -0
  64. package/skills/ai-config-architect/references/agents.md +77 -0
  65. package/skills/ai-config-architect/references/commands.md +66 -0
  66. package/skills/ai-config-architect/references/hooks.md +70 -0
  67. package/skills/ai-config-architect/references/patterns.md +66 -0
  68. package/skills/ai-config-architect/references/platforms.md +82 -0
  69. package/skills/ai-config-architect/references/rules.md +66 -0
  70. package/skills/ai-config-architect/references/skills.md +67 -0
  71. package/skills/bk-chat-helper/SKILL.md +398 -0
  72. package/skills/bk-chat-helper/references/api-reference.md +606 -0
  73. package/skills/bk-chat-helper/references/examples.md +789 -0
  74. package/skills/bk-chat-helper/references/integration-guide.md +583 -0
  75. package/skills/bk-chat-x/SKILL.md +400 -0
  76. package/skills/bk-chat-x/references/components-api.md +340 -0
  77. package/skills/bk-chat-x/references/examples.md +386 -0
  78. package/skills/bk-chat-x/references/shortcuts-guide.md +375 -0
  79. package/skills/coding-standards/SKILL.md +523 -0
  80. package/skills/security-review/SKILL.md +497 -0
  81. package/skills/security-review/references/cloud-infrastructure-security.md +361 -0
  82. package/skills/strategic-compact/SKILL.md +66 -0
  83. package/skills/strategic-compact/scripts/suggest-compact.sh +52 -0
  84. package/skills/tdd-workflow/SKILL.md +412 -0
  85. package/skills/verification-loop/SKILL.md +128 -0
@@ -0,0 +1,412 @@
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
+ metadata:
5
+ author: everything-claude-code
6
+ version: "1.0"
7
+ ---
8
+
9
+ # Test-Driven Development Workflow
10
+
11
+ This skill ensures all code development follows TDD principles with comprehensive test coverage.
12
+
13
+ ## When to Activate
14
+
15
+ - Writing new features or functionality
16
+ - Fixing bugs or issues
17
+ - Refactoring existing code
18
+ - Adding API endpoints
19
+ - Creating new components
20
+
21
+ ## Core Principles
22
+
23
+ ### 1. Tests BEFORE Code
24
+ ALWAYS write tests first, then implement code to make tests pass.
25
+
26
+ ### 2. Coverage Requirements
27
+ - Minimum 80% coverage (unit + integration + E2E)
28
+ - All edge cases covered
29
+ - Error scenarios tested
30
+ - Boundary conditions verified
31
+
32
+ ### 3. Test Types
33
+
34
+ #### Unit Tests
35
+ - Individual functions and utilities
36
+ - Component logic
37
+ - Pure functions
38
+ - Helpers and utilities
39
+
40
+ #### Integration Tests
41
+ - API endpoints
42
+ - Database operations
43
+ - Service interactions
44
+ - External API calls
45
+
46
+ #### E2E Tests (Playwright)
47
+ - Critical user flows
48
+ - Complete workflows
49
+ - Browser automation
50
+ - UI interactions
51
+
52
+ ## TDD Workflow Steps
53
+
54
+ ### Step 1: Write User Journeys
55
+ ```
56
+ As a [role], I want to [action], so that [benefit]
57
+
58
+ Example:
59
+ As a user, I want to search for markets semantically,
60
+ so that I can find relevant markets even without exact keywords.
61
+ ```
62
+
63
+ ### Step 2: Generate Test Cases
64
+ For each user journey, create comprehensive test cases:
65
+
66
+ ```typescript
67
+ describe('Semantic Search', () => {
68
+ it('returns relevant markets for query', async () => {
69
+ // Test implementation
70
+ })
71
+
72
+ it('handles empty query gracefully', async () => {
73
+ // Test edge case
74
+ })
75
+
76
+ it('falls back to substring search when Redis unavailable', async () => {
77
+ // Test fallback behavior
78
+ })
79
+
80
+ it('sorts results by similarity score', async () => {
81
+ // Test sorting logic
82
+ })
83
+ })
84
+ ```
85
+
86
+ ### Step 3: Run Tests (They Should Fail)
87
+ ```bash
88
+ npm test
89
+ # Tests should fail - we haven't implemented yet
90
+ ```
91
+
92
+ ### Step 4: Implement Code
93
+ Write minimal code to make tests pass:
94
+
95
+ ```typescript
96
+ // Implementation guided by tests
97
+ export async function searchMarkets(query: string) {
98
+ // Implementation here
99
+ }
100
+ ```
101
+
102
+ ### Step 5: Run Tests Again
103
+ ```bash
104
+ npm test
105
+ # Tests should now pass
106
+ ```
107
+
108
+ ### Step 6: Refactor
109
+ Improve code quality while keeping tests green:
110
+ - Remove duplication
111
+ - Improve naming
112
+ - Optimize performance
113
+ - Enhance readability
114
+
115
+ ### Step 7: Verify Coverage
116
+ ```bash
117
+ npm run test:coverage
118
+ # Verify 80%+ coverage achieved
119
+ ```
120
+
121
+ ## Testing Patterns
122
+
123
+ ### Unit Test Pattern (Jest/Vitest)
124
+ ```typescript
125
+ import { render, screen, fireEvent } from '@testing-library/react'
126
+ import { Button } from './Button'
127
+
128
+ describe('Button Component', () => {
129
+ it('renders with correct text', () => {
130
+ render(<Button>Click me</Button>)
131
+ expect(screen.getByText('Click me')).toBeInTheDocument()
132
+ })
133
+
134
+ it('calls onClick when clicked', () => {
135
+ const handleClick = jest.fn()
136
+ render(<Button onClick={handleClick}>Click</Button>)
137
+
138
+ fireEvent.click(screen.getByRole('button'))
139
+
140
+ expect(handleClick).toHaveBeenCalledTimes(1)
141
+ })
142
+
143
+ it('is disabled when disabled prop is true', () => {
144
+ render(<Button disabled>Click</Button>)
145
+ expect(screen.getByRole('button')).toBeDisabled()
146
+ })
147
+ })
148
+ ```
149
+
150
+ ### API Integration Test Pattern
151
+ ```typescript
152
+ import { NextRequest } from 'next/server'
153
+ import { GET } from './route'
154
+
155
+ describe('GET /api/markets', () => {
156
+ it('returns markets successfully', async () => {
157
+ const request = new NextRequest('http://localhost/api/markets')
158
+ const response = await GET(request)
159
+ const data = await response.json()
160
+
161
+ expect(response.status).toBe(200)
162
+ expect(data.success).toBe(true)
163
+ expect(Array.isArray(data.data)).toBe(true)
164
+ })
165
+
166
+ it('validates query parameters', async () => {
167
+ const request = new NextRequest('http://localhost/api/markets?limit=invalid')
168
+ const response = await GET(request)
169
+
170
+ expect(response.status).toBe(400)
171
+ })
172
+
173
+ it('handles database errors gracefully', async () => {
174
+ // Mock database failure
175
+ const request = new NextRequest('http://localhost/api/markets')
176
+ // Test error handling
177
+ })
178
+ })
179
+ ```
180
+
181
+ ### E2E Test Pattern (Playwright)
182
+ ```typescript
183
+ import { test, expect } from '@playwright/test'
184
+
185
+ test('user can search and filter markets', async ({ page }) => {
186
+ // Navigate to markets page
187
+ await page.goto('/')
188
+ await page.click('a[href="/markets"]')
189
+
190
+ // Verify page loaded
191
+ await expect(page.locator('h1')).toContainText('Markets')
192
+
193
+ // Search for markets
194
+ await page.fill('input[placeholder="Search markets"]', 'election')
195
+
196
+ // Wait for debounce and results
197
+ await page.waitForTimeout(600)
198
+
199
+ // Verify search results displayed
200
+ const results = page.locator('[data-testid="market-card"]')
201
+ await expect(results).toHaveCount(5, { timeout: 5000 })
202
+
203
+ // Verify results contain search term
204
+ const firstResult = results.first()
205
+ await expect(firstResult).toContainText('election', { ignoreCase: true })
206
+
207
+ // Filter by status
208
+ await page.click('button:has-text("Active")')
209
+
210
+ // Verify filtered results
211
+ await expect(results).toHaveCount(3)
212
+ })
213
+
214
+ test('user can create a new market', async ({ page }) => {
215
+ // Login first
216
+ await page.goto('/creator-dashboard')
217
+
218
+ // Fill market creation form
219
+ await page.fill('input[name="name"]', 'Test Market')
220
+ await page.fill('textarea[name="description"]', 'Test description')
221
+ await page.fill('input[name="endDate"]', '2025-12-31')
222
+
223
+ // Submit form
224
+ await page.click('button[type="submit"]')
225
+
226
+ // Verify success message
227
+ await expect(page.locator('text=Market created successfully')).toBeVisible()
228
+
229
+ // Verify redirect to market page
230
+ await expect(page).toHaveURL(/\/markets\/test-market/)
231
+ })
232
+ ```
233
+
234
+ ## Test File Organization
235
+
236
+ ```
237
+ src/
238
+ ├── components/
239
+ │ ├── Button/
240
+ │ │ ├── Button.tsx
241
+ │ │ ├── Button.test.tsx # Unit tests
242
+ │ │ └── Button.stories.tsx # Storybook
243
+ │ └── MarketCard/
244
+ │ ├── MarketCard.tsx
245
+ │ └── MarketCard.test.tsx
246
+ ├── app/
247
+ │ └── api/
248
+ │ └── markets/
249
+ │ ├── route.ts
250
+ │ └── route.test.ts # Integration tests
251
+ └── e2e/
252
+ ├── markets.spec.ts # E2E tests
253
+ ├── trading.spec.ts
254
+ └── auth.spec.ts
255
+ ```
256
+
257
+ ## Mocking External Services
258
+
259
+ ### Supabase Mock
260
+ ```typescript
261
+ jest.mock('@/lib/supabase', () => ({
262
+ supabase: {
263
+ from: jest.fn(() => ({
264
+ select: jest.fn(() => ({
265
+ eq: jest.fn(() => Promise.resolve({
266
+ data: [{ id: 1, name: 'Test Market' }],
267
+ error: null
268
+ }))
269
+ }))
270
+ }))
271
+ }
272
+ }))
273
+ ```
274
+
275
+ ### Redis Mock
276
+ ```typescript
277
+ jest.mock('@/lib/redis', () => ({
278
+ searchMarketsByVector: jest.fn(() => Promise.resolve([
279
+ { slug: 'test-market', similarity_score: 0.95 }
280
+ ])),
281
+ checkRedisHealth: jest.fn(() => Promise.resolve({ connected: true }))
282
+ }))
283
+ ```
284
+
285
+ ### OpenAI Mock
286
+ ```typescript
287
+ jest.mock('@/lib/openai', () => ({
288
+ generateEmbedding: jest.fn(() => Promise.resolve(
289
+ new Array(1536).fill(0.1) // Mock 1536-dim embedding
290
+ ))
291
+ }))
292
+ ```
293
+
294
+ ## Test Coverage Verification
295
+
296
+ ### Run Coverage Report
297
+ ```bash
298
+ npm run test:coverage
299
+ ```
300
+
301
+ ### Coverage Thresholds
302
+ ```json
303
+ {
304
+ "jest": {
305
+ "coverageThresholds": {
306
+ "global": {
307
+ "branches": 80,
308
+ "functions": 80,
309
+ "lines": 80,
310
+ "statements": 80
311
+ }
312
+ }
313
+ }
314
+ }
315
+ ```
316
+
317
+ ## Common Testing Mistakes to Avoid
318
+
319
+ ### ❌ WRONG: Testing Implementation Details
320
+ ```typescript
321
+ // Don't test internal state
322
+ expect(component.state.count).toBe(5)
323
+ ```
324
+
325
+ ### ✅ CORRECT: Test User-Visible Behavior
326
+ ```typescript
327
+ // Test what users see
328
+ expect(screen.getByText('Count: 5')).toBeInTheDocument()
329
+ ```
330
+
331
+ ### ❌ WRONG: Brittle Selectors
332
+ ```typescript
333
+ // Breaks easily
334
+ await page.click('.css-class-xyz')
335
+ ```
336
+
337
+ ### ✅ CORRECT: Semantic Selectors
338
+ ```typescript
339
+ // Resilient to changes
340
+ await page.click('button:has-text("Submit")')
341
+ await page.click('[data-testid="submit-button"]')
342
+ ```
343
+
344
+ ### ❌ WRONG: No Test Isolation
345
+ ```typescript
346
+ // Tests depend on each other
347
+ test('creates user', () => { /* ... */ })
348
+ test('updates same user', () => { /* depends on previous test */ })
349
+ ```
350
+
351
+ ### ✅ CORRECT: Independent Tests
352
+ ```typescript
353
+ // Each test sets up its own data
354
+ test('creates user', () => {
355
+ const user = createTestUser()
356
+ // Test logic
357
+ })
358
+
359
+ test('updates user', () => {
360
+ const user = createTestUser()
361
+ // Update logic
362
+ })
363
+ ```
364
+
365
+ ## Continuous Testing
366
+
367
+ ### Watch Mode During Development
368
+ ```bash
369
+ npm test -- --watch
370
+ # Tests run automatically on file changes
371
+ ```
372
+
373
+ ### Pre-Commit Hook
374
+ ```bash
375
+ # Runs before every commit
376
+ npm test && npm run lint
377
+ ```
378
+
379
+ ### CI/CD Integration
380
+ ```yaml
381
+ # GitHub Actions
382
+ - name: Run Tests
383
+ run: npm test -- --coverage
384
+ - name: Upload Coverage
385
+ uses: codecov/codecov-action@v3
386
+ ```
387
+
388
+ ## Best Practices
389
+
390
+ 1. **Write Tests First** - Always TDD
391
+ 2. **One Assert Per Test** - Focus on single behavior
392
+ 3. **Descriptive Test Names** - Explain what's tested
393
+ 4. **Arrange-Act-Assert** - Clear test structure
394
+ 5. **Mock External Dependencies** - Isolate unit tests
395
+ 6. **Test Edge Cases** - Null, undefined, empty, large
396
+ 7. **Test Error Paths** - Not just happy paths
397
+ 8. **Keep Tests Fast** - Unit tests < 50ms each
398
+ 9. **Clean Up After Tests** - No side effects
399
+ 10. **Review Coverage Reports** - Identify gaps
400
+
401
+ ## Success Metrics
402
+
403
+ - 80%+ code coverage achieved
404
+ - All tests passing (green)
405
+ - No skipped or disabled tests
406
+ - Fast test execution (< 30s for unit tests)
407
+ - E2E tests cover critical user flows
408
+ - Tests catch bugs before production
409
+
410
+ ---
411
+
412
+ **Remember**: Tests are not optional. They are the safety net that enables confident refactoring, rapid development, and production reliability.
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: verification-loop
3
+ description: A comprehensive verification system for code changes. Use after completing features, before creating PRs, when ensuring quality gates pass, or after refactoring. Runs build, type check, lint, test, security scan, and diff review phases.
4
+ metadata:
5
+ author: everything-claude-code
6
+ version: "1.0"
7
+ ---
8
+
9
+ # Verification Loop Skill
10
+
11
+ A comprehensive verification system for Claude Code sessions.
12
+
13
+ ## When to Use
14
+
15
+ Invoke this skill:
16
+ - After completing a feature or significant code change
17
+ - Before creating a PR
18
+ - When you want to ensure quality gates pass
19
+ - After refactoring
20
+
21
+ ## Verification Phases
22
+
23
+ ### Phase 1: Build Verification
24
+ ```bash
25
+ # Check if project builds
26
+ npm run build 2>&1 | tail -20
27
+ # OR
28
+ pnpm build 2>&1 | tail -20
29
+ ```
30
+
31
+ If build fails, STOP and fix before continuing.
32
+
33
+ ### Phase 2: Type Check
34
+ ```bash
35
+ # TypeScript projects
36
+ npx tsc --noEmit 2>&1 | head -30
37
+
38
+ # Python projects
39
+ pyright . 2>&1 | head -30
40
+ ```
41
+
42
+ Report all type errors. Fix critical ones before continuing.
43
+
44
+ ### Phase 3: Lint Check
45
+ ```bash
46
+ # JavaScript/TypeScript
47
+ npm run lint 2>&1 | head -30
48
+
49
+ # Python
50
+ ruff check . 2>&1 | head -30
51
+ ```
52
+
53
+ ### Phase 4: Test Suite
54
+ ```bash
55
+ # Run tests with coverage
56
+ npm run test -- --coverage 2>&1 | tail -50
57
+
58
+ # Check coverage threshold
59
+ # Target: 80% minimum
60
+ ```
61
+
62
+ Report:
63
+ - Total tests: X
64
+ - Passed: X
65
+ - Failed: X
66
+ - Coverage: X%
67
+
68
+ ### Phase 5: Security Scan
69
+ ```bash
70
+ # Check for secrets
71
+ grep -rn "sk-" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
72
+ grep -rn "api_key" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
73
+
74
+ # Check for console.log
75
+ grep -rn "console.log" --include="*.ts" --include="*.tsx" src/ 2>/dev/null | head -10
76
+ ```
77
+
78
+ ### Phase 6: Diff Review
79
+ ```bash
80
+ # Show what changed
81
+ git diff --stat
82
+ git diff HEAD~1 --name-only
83
+ ```
84
+
85
+ Review each changed file for:
86
+ - Unintended changes
87
+ - Missing error handling
88
+ - Potential edge cases
89
+
90
+ ## Output Format
91
+
92
+ After running all phases, produce a verification report:
93
+
94
+ ```
95
+ VERIFICATION REPORT
96
+ ==================
97
+
98
+ Build: [PASS/FAIL]
99
+ Types: [PASS/FAIL] (X errors)
100
+ Lint: [PASS/FAIL] (X warnings)
101
+ Tests: [PASS/FAIL] (X/Y passed, Z% coverage)
102
+ Security: [PASS/FAIL] (X issues)
103
+ Diff: [X files changed]
104
+
105
+ Overall: [READY/NOT READY] for PR
106
+
107
+ Issues to Fix:
108
+ 1. ...
109
+ 2. ...
110
+ ```
111
+
112
+ ## Continuous Mode
113
+
114
+ For long sessions, run verification every 15 minutes or after major changes:
115
+
116
+ ```markdown
117
+ Set a mental checkpoint:
118
+ - After completing each function
119
+ - After finishing a component
120
+ - Before moving to next task
121
+
122
+ Run: /verify
123
+ ```
124
+
125
+ ## Integration with Hooks
126
+
127
+ This skill complements PostToolUse hooks but provides deeper verification.
128
+ Hooks catch issues immediately; this skill provides comprehensive review.