@juho0719/cckit 0.1.1

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 (111) hide show
  1. package/assets/agents/architect.md +211 -0
  2. package/assets/agents/build-error-resolver.md +114 -0
  3. package/assets/agents/ccwin-code-reviewer.md +224 -0
  4. package/assets/agents/database-reviewer.md +91 -0
  5. package/assets/agents/doc-updater.md +107 -0
  6. package/assets/agents/e2e-runner.md +107 -0
  7. package/assets/agents/planner.md +212 -0
  8. package/assets/agents/python-reviewer.md +98 -0
  9. package/assets/agents/refactor-cleaner.md +85 -0
  10. package/assets/agents/security-reviewer.md +108 -0
  11. package/assets/agents/superpower-code-reviewer.md +48 -0
  12. package/assets/agents/tdd-guide.md +80 -0
  13. package/assets/commands/build-fix.md +62 -0
  14. package/assets/commands/checkpoint.md +74 -0
  15. package/assets/commands/code-review.md +40 -0
  16. package/assets/commands/e2e.md +362 -0
  17. package/assets/commands/eval.md +120 -0
  18. package/assets/commands/orchestrate.md +172 -0
  19. package/assets/commands/plan.md +113 -0
  20. package/assets/commands/python-review.md +297 -0
  21. package/assets/commands/refactor-clean.md +80 -0
  22. package/assets/commands/sessions.md +305 -0
  23. package/assets/commands/tdd.md +326 -0
  24. package/assets/commands/test-coverage.md +69 -0
  25. package/assets/commands/update-codemaps.md +72 -0
  26. package/assets/commands/update-docs.md +84 -0
  27. package/assets/commands/verify.md +59 -0
  28. package/assets/hooks/post-edit-format.js +49 -0
  29. package/assets/hooks/post-edit-typecheck.js +96 -0
  30. package/assets/mcps/mcp-servers.json +92 -0
  31. package/assets/rules/common/agents.md +49 -0
  32. package/assets/rules/common/coding-style.md +48 -0
  33. package/assets/rules/common/git-workflow.md +45 -0
  34. package/assets/rules/common/hooks.md +30 -0
  35. package/assets/rules/common/patterns.md +31 -0
  36. package/assets/rules/common/performance.md +55 -0
  37. package/assets/rules/common/security.md +29 -0
  38. package/assets/rules/common/testing.md +29 -0
  39. package/assets/rules/python/coding-style.md +42 -0
  40. package/assets/rules/python/hooks.md +19 -0
  41. package/assets/rules/python/patterns.md +39 -0
  42. package/assets/rules/python/security.md +30 -0
  43. package/assets/rules/python/testing.md +38 -0
  44. package/assets/rules/typescript/coding-style.md +18 -0
  45. package/assets/rules/typescript/hooks.md +19 -0
  46. package/assets/rules/typescript/patterns.md +39 -0
  47. package/assets/rules/typescript/security.md +30 -0
  48. package/assets/rules/typescript/testing.md +38 -0
  49. package/assets/skills/api-design/SKILL.md +522 -0
  50. package/assets/skills/backend-patterns/SKILL.md +597 -0
  51. package/assets/skills/brainstorming/SKILL.md +96 -0
  52. package/assets/skills/coding-standards/SKILL.md +529 -0
  53. package/assets/skills/database-migrations/SKILL.md +334 -0
  54. package/assets/skills/deployment-patterns/SKILL.md +426 -0
  55. package/assets/skills/dispatching-parallel-agents/SKILL.md +180 -0
  56. package/assets/skills/docker-patterns/SKILL.md +363 -0
  57. package/assets/skills/e2e-testing/SKILL.md +325 -0
  58. package/assets/skills/eval-harness/SKILL.md +235 -0
  59. package/assets/skills/executing-plans/SKILL.md +84 -0
  60. package/assets/skills/finishing-a-development-branch/SKILL.md +200 -0
  61. package/assets/skills/frontend-patterns/SKILL.md +641 -0
  62. package/assets/skills/iterative-retrieval/SKILL.md +210 -0
  63. package/assets/skills/postgres-patterns/SKILL.md +145 -0
  64. package/assets/skills/python-patterns/SKILL.md +749 -0
  65. package/assets/skills/python-testing/SKILL.md +815 -0
  66. package/assets/skills/receiving-code-review/SKILL.md +213 -0
  67. package/assets/skills/requesting-code-review/SKILL.md +105 -0
  68. package/assets/skills/requesting-code-review/code-reviewer-template.md +146 -0
  69. package/assets/skills/subagent-driven-development/SKILL.md +242 -0
  70. package/assets/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
  71. package/assets/skills/subagent-driven-development/implementer-prompt.md +78 -0
  72. package/assets/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  73. package/assets/skills/systematic-debugging/CREATION-LOG.md +114 -0
  74. package/assets/skills/systematic-debugging/SKILL.md +296 -0
  75. package/assets/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  76. package/assets/skills/systematic-debugging/condition-based-waiting.md +115 -0
  77. package/assets/skills/systematic-debugging/defense-in-depth.md +122 -0
  78. package/assets/skills/systematic-debugging/root-cause-tracing.md +169 -0
  79. package/assets/skills/systematic-debugging/scripts/find-polluter.sh +63 -0
  80. package/assets/skills/systematic-debugging/test-academic.md +14 -0
  81. package/assets/skills/systematic-debugging/test-pressure-1.md +58 -0
  82. package/assets/skills/systematic-debugging/test-pressure-2.md +68 -0
  83. package/assets/skills/systematic-debugging/test-pressure-3.md +69 -0
  84. package/assets/skills/tdd-workflow/SKILL.md +409 -0
  85. package/assets/skills/test-driven-development/SKILL.md +371 -0
  86. package/assets/skills/test-driven-development/testing-anti-patterns.md +299 -0
  87. package/assets/skills/using-git-worktrees/SKILL.md +218 -0
  88. package/assets/skills/verification-before-completion/SKILL.md +139 -0
  89. package/assets/skills/verification-loop/SKILL.md +125 -0
  90. package/assets/skills/writing-plans/SKILL.md +116 -0
  91. package/dist/agents-AEKT67A6.js +9 -0
  92. package/dist/chunk-3GUKEMND.js +28 -0
  93. package/dist/chunk-3UNN3IBE.js +54 -0
  94. package/dist/chunk-3Y26YU4R.js +27 -0
  95. package/dist/chunk-5XOKKPAA.js +21 -0
  96. package/dist/chunk-6B46AIFM.js +136 -0
  97. package/dist/chunk-EYY2IZ7N.js +27 -0
  98. package/dist/chunk-K25UZZVG.js +17 -0
  99. package/dist/chunk-KEENFBLL.js +24 -0
  100. package/dist/chunk-RMUKD7CW.js +44 -0
  101. package/dist/chunk-W63UKEIT.js +50 -0
  102. package/dist/cli-VZRGF733.js +238 -0
  103. package/dist/commands-P5LILVZ5.js +9 -0
  104. package/dist/hooks-IIG2XK4I.js +9 -0
  105. package/dist/index.js +131 -0
  106. package/dist/mcps-67Q7TBGW.js +6 -0
  107. package/dist/paths-FT6KBIRD.js +10 -0
  108. package/dist/registry-EGXWYWWK.js +17 -0
  109. package/dist/rules-2CPBVNNJ.js +7 -0
  110. package/dist/skills-ULMW3UCM.js +8 -0
  111. package/package.json +36 -0
@@ -0,0 +1,529 @@
1
+ ---
2
+ name: coding-standards
3
+ description: Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
4
+ ---
5
+
6
+ # Coding Standards & Best Practices
7
+
8
+ Universal coding standards applicable across all projects.
9
+
10
+ ## When to Activate
11
+
12
+ - Starting a new project or module
13
+ - Reviewing code for quality and maintainability
14
+ - Refactoring existing code to follow conventions
15
+ - Enforcing naming, formatting, or structural consistency
16
+ - Setting up linting, formatting, or type-checking rules
17
+ - Onboarding new contributors to coding conventions
18
+
19
+ ## Code Quality Principles
20
+
21
+ ### 1. Readability First
22
+ - Code is read more than written
23
+ - Clear variable and function names
24
+ - Self-documenting code preferred over comments
25
+ - Consistent formatting
26
+
27
+ ### 2. KISS (Keep It Simple, Stupid)
28
+ - Simplest solution that works
29
+ - Avoid over-engineering
30
+ - No premature optimization
31
+ - Easy to understand > clever code
32
+
33
+ ### 3. DRY (Don't Repeat Yourself)
34
+ - Extract common logic into functions
35
+ - Create reusable components
36
+ - Share utilities across modules
37
+ - Avoid copy-paste programming
38
+
39
+ ### 4. YAGNI (You Aren't Gonna Need It)
40
+ - Don't build features before they're needed
41
+ - Avoid speculative generality
42
+ - Add complexity only when required
43
+ - Start simple, refactor when needed
44
+
45
+ ## TypeScript/JavaScript Standards
46
+
47
+ ### Variable Naming
48
+
49
+ ```typescript
50
+ // ✅ GOOD: Descriptive names
51
+ const marketSearchQuery = 'election'
52
+ const isUserAuthenticated = true
53
+ const totalRevenue = 1000
54
+
55
+ // ❌ BAD: Unclear names
56
+ const q = 'election'
57
+ const flag = true
58
+ const x = 1000
59
+ ```
60
+
61
+ ### Function Naming
62
+
63
+ ```typescript
64
+ // ✅ GOOD: Verb-noun pattern
65
+ async function fetchMarketData(marketId: string) { }
66
+ function calculateSimilarity(a: number[], b: number[]) { }
67
+ function isValidEmail(email: string): boolean { }
68
+
69
+ // ❌ BAD: Unclear or noun-only
70
+ async function market(id: string) { }
71
+ function similarity(a, b) { }
72
+ function email(e) { }
73
+ ```
74
+
75
+ ### Immutability Pattern (CRITICAL)
76
+
77
+ ```typescript
78
+ // ✅ ALWAYS use spread operator
79
+ const updatedUser = {
80
+ ...user,
81
+ name: 'New Name'
82
+ }
83
+
84
+ const updatedArray = [...items, newItem]
85
+
86
+ // ❌ NEVER mutate directly
87
+ user.name = 'New Name' // BAD
88
+ items.push(newItem) // BAD
89
+ ```
90
+
91
+ ### Error Handling
92
+
93
+ ```typescript
94
+ // ✅ GOOD: Comprehensive error handling
95
+ async function fetchData(url: string) {
96
+ try {
97
+ const response = await fetch(url)
98
+
99
+ if (!response.ok) {
100
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`)
101
+ }
102
+
103
+ return await response.json()
104
+ } catch (error) {
105
+ console.error('Fetch failed:', error)
106
+ throw new Error('Failed to fetch data')
107
+ }
108
+ }
109
+
110
+ // ❌ BAD: No error handling
111
+ async function fetchData(url) {
112
+ const response = await fetch(url)
113
+ return response.json()
114
+ }
115
+ ```
116
+
117
+ ### Async/Await Best Practices
118
+
119
+ ```typescript
120
+ // ✅ GOOD: Parallel execution when possible
121
+ const [users, markets, stats] = await Promise.all([
122
+ fetchUsers(),
123
+ fetchMarkets(),
124
+ fetchStats()
125
+ ])
126
+
127
+ // ❌ BAD: Sequential when unnecessary
128
+ const users = await fetchUsers()
129
+ const markets = await fetchMarkets()
130
+ const stats = await fetchStats()
131
+ ```
132
+
133
+ ### Type Safety
134
+
135
+ ```typescript
136
+ // ✅ GOOD: Proper types
137
+ interface Market {
138
+ id: string
139
+ name: string
140
+ status: 'active' | 'resolved' | 'closed'
141
+ created_at: Date
142
+ }
143
+
144
+ function getMarket(id: string): Promise<Market> {
145
+ // Implementation
146
+ }
147
+
148
+ // ❌ BAD: Using 'any'
149
+ function getMarket(id: any): Promise<any> {
150
+ // Implementation
151
+ }
152
+ ```
153
+
154
+ ## React Best Practices
155
+
156
+ ### Component Structure
157
+
158
+ ```typescript
159
+ // ✅ GOOD: Functional component with types
160
+ interface ButtonProps {
161
+ children: React.ReactNode
162
+ onClick: () => void
163
+ disabled?: boolean
164
+ variant?: 'primary' | 'secondary'
165
+ }
166
+
167
+ export function Button({
168
+ children,
169
+ onClick,
170
+ disabled = false,
171
+ variant = 'primary'
172
+ }: ButtonProps) {
173
+ return (
174
+ <button
175
+ onClick={onClick}
176
+ disabled={disabled}
177
+ className={`btn btn-${variant}`}
178
+ >
179
+ {children}
180
+ </button>
181
+ )
182
+ }
183
+
184
+ // ❌ BAD: No types, unclear structure
185
+ export function Button(props) {
186
+ return <button onClick={props.onClick}>{props.children}</button>
187
+ }
188
+ ```
189
+
190
+ ### Custom Hooks
191
+
192
+ ```typescript
193
+ // ✅ GOOD: Reusable custom hook
194
+ export function useDebounce<T>(value: T, delay: number): T {
195
+ const [debouncedValue, setDebouncedValue] = useState<T>(value)
196
+
197
+ useEffect(() => {
198
+ const handler = setTimeout(() => {
199
+ setDebouncedValue(value)
200
+ }, delay)
201
+
202
+ return () => clearTimeout(handler)
203
+ }, [value, delay])
204
+
205
+ return debouncedValue
206
+ }
207
+
208
+ // Usage
209
+ const debouncedQuery = useDebounce(searchQuery, 500)
210
+ ```
211
+
212
+ ### State Management
213
+
214
+ ```typescript
215
+ // ✅ GOOD: Proper state updates
216
+ const [count, setCount] = useState(0)
217
+
218
+ // Functional update for state based on previous state
219
+ setCount(prev => prev + 1)
220
+
221
+ // ❌ BAD: Direct state reference
222
+ setCount(count + 1) // Can be stale in async scenarios
223
+ ```
224
+
225
+ ### Conditional Rendering
226
+
227
+ ```typescript
228
+ // ✅ GOOD: Clear conditional rendering
229
+ {isLoading && <Spinner />}
230
+ {error && <ErrorMessage error={error} />}
231
+ {data && <DataDisplay data={data} />}
232
+
233
+ // ❌ BAD: Ternary hell
234
+ {isLoading ? <Spinner /> : error ? <ErrorMessage error={error} /> : data ? <DataDisplay data={data} /> : null}
235
+ ```
236
+
237
+ ## API Design Standards
238
+
239
+ ### REST API Conventions
240
+
241
+ ```
242
+ GET /api/markets # List all markets
243
+ GET /api/markets/:id # Get specific market
244
+ POST /api/markets # Create new market
245
+ PUT /api/markets/:id # Update market (full)
246
+ PATCH /api/markets/:id # Update market (partial)
247
+ DELETE /api/markets/:id # Delete market
248
+
249
+ # Query parameters for filtering
250
+ GET /api/markets?status=active&limit=10&offset=0
251
+ ```
252
+
253
+ ### Response Format
254
+
255
+ ```typescript
256
+ // ✅ GOOD: Consistent response structure
257
+ interface ApiResponse<T> {
258
+ success: boolean
259
+ data?: T
260
+ error?: string
261
+ meta?: {
262
+ total: number
263
+ page: number
264
+ limit: number
265
+ }
266
+ }
267
+
268
+ // Success response
269
+ return NextResponse.json({
270
+ success: true,
271
+ data: markets,
272
+ meta: { total: 100, page: 1, limit: 10 }
273
+ })
274
+
275
+ // Error response
276
+ return NextResponse.json({
277
+ success: false,
278
+ error: 'Invalid request'
279
+ }, { status: 400 })
280
+ ```
281
+
282
+ ### Input Validation
283
+
284
+ ```typescript
285
+ import { z } from 'zod'
286
+
287
+ // ✅ GOOD: Schema validation
288
+ const CreateMarketSchema = z.object({
289
+ name: z.string().min(1).max(200),
290
+ description: z.string().min(1).max(2000),
291
+ endDate: z.string().datetime(),
292
+ categories: z.array(z.string()).min(1)
293
+ })
294
+
295
+ export async function POST(request: Request) {
296
+ const body = await request.json()
297
+
298
+ try {
299
+ const validated = CreateMarketSchema.parse(body)
300
+ // Proceed with validated data
301
+ } catch (error) {
302
+ if (error instanceof z.ZodError) {
303
+ return NextResponse.json({
304
+ success: false,
305
+ error: 'Validation failed',
306
+ details: error.errors
307
+ }, { status: 400 })
308
+ }
309
+ }
310
+ }
311
+ ```
312
+
313
+ ## File Organization
314
+
315
+ ### Project Structure
316
+
317
+ ```
318
+ src/
319
+ ├── app/ # Next.js App Router
320
+ │ ├── api/ # API routes
321
+ │ ├── markets/ # Market pages
322
+ │ └── (auth)/ # Auth pages (route groups)
323
+ ├── components/ # React components
324
+ │ ├── ui/ # Generic UI components
325
+ │ ├── forms/ # Form components
326
+ │ └── layouts/ # Layout components
327
+ ├── hooks/ # Custom React hooks
328
+ ├── lib/ # Utilities and configs
329
+ │ ├── api/ # API clients
330
+ │ ├── utils/ # Helper functions
331
+ │ └── constants/ # Constants
332
+ ├── types/ # TypeScript types
333
+ └── styles/ # Global styles
334
+ ```
335
+
336
+ ### File Naming
337
+
338
+ ```
339
+ components/Button.tsx # PascalCase for components
340
+ hooks/useAuth.ts # camelCase with 'use' prefix
341
+ lib/formatDate.ts # camelCase for utilities
342
+ types/market.types.ts # camelCase with .types suffix
343
+ ```
344
+
345
+ ## Comments & Documentation
346
+
347
+ ### When to Comment
348
+
349
+ ```typescript
350
+ // ✅ GOOD: Explain WHY, not WHAT
351
+ // Use exponential backoff to avoid overwhelming the API during outages
352
+ const delay = Math.min(1000 * Math.pow(2, retryCount), 30000)
353
+
354
+ // Deliberately using mutation here for performance with large arrays
355
+ items.push(newItem)
356
+
357
+ // ❌ BAD: Stating the obvious
358
+ // Increment counter by 1
359
+ count++
360
+
361
+ // Set name to user's name
362
+ name = user.name
363
+ ```
364
+
365
+ ### JSDoc for Public APIs
366
+
367
+ ```typescript
368
+ /**
369
+ * Searches markets using semantic similarity.
370
+ *
371
+ * @param query - Natural language search query
372
+ * @param limit - Maximum number of results (default: 10)
373
+ * @returns Array of markets sorted by similarity score
374
+ * @throws {Error} If OpenAI API fails or Redis unavailable
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * const results = await searchMarkets('election', 5)
379
+ * console.log(results[0].name) // "Trump vs Biden"
380
+ * ```
381
+ */
382
+ export async function searchMarkets(
383
+ query: string,
384
+ limit: number = 10
385
+ ): Promise<Market[]> {
386
+ // Implementation
387
+ }
388
+ ```
389
+
390
+ ## Performance Best Practices
391
+
392
+ ### Memoization
393
+
394
+ ```typescript
395
+ import { useMemo, useCallback } from 'react'
396
+
397
+ // ✅ GOOD: Memoize expensive computations
398
+ const sortedMarkets = useMemo(() => {
399
+ return markets.sort((a, b) => b.volume - a.volume)
400
+ }, [markets])
401
+
402
+ // ✅ GOOD: Memoize callbacks
403
+ const handleSearch = useCallback((query: string) => {
404
+ setSearchQuery(query)
405
+ }, [])
406
+ ```
407
+
408
+ ### Lazy Loading
409
+
410
+ ```typescript
411
+ import { lazy, Suspense } from 'react'
412
+
413
+ // ✅ GOOD: Lazy load heavy components
414
+ const HeavyChart = lazy(() => import('./HeavyChart'))
415
+
416
+ export function Dashboard() {
417
+ return (
418
+ <Suspense fallback={<Spinner />}>
419
+ <HeavyChart />
420
+ </Suspense>
421
+ )
422
+ }
423
+ ```
424
+
425
+ ### Database Queries
426
+
427
+ ```typescript
428
+ // ✅ GOOD: Select only needed columns
429
+ const { data } = await supabase
430
+ .from('markets')
431
+ .select('id, name, status')
432
+ .limit(10)
433
+
434
+ // ❌ BAD: Select everything
435
+ const { data } = await supabase
436
+ .from('markets')
437
+ .select('*')
438
+ ```
439
+
440
+ ## Testing Standards
441
+
442
+ ### Test Structure (AAA Pattern)
443
+
444
+ ```typescript
445
+ test('calculates similarity correctly', () => {
446
+ // Arrange
447
+ const vector1 = [1, 0, 0]
448
+ const vector2 = [0, 1, 0]
449
+
450
+ // Act
451
+ const similarity = calculateCosineSimilarity(vector1, vector2)
452
+
453
+ // Assert
454
+ expect(similarity).toBe(0)
455
+ })
456
+ ```
457
+
458
+ ### Test Naming
459
+
460
+ ```typescript
461
+ // ✅ GOOD: Descriptive test names
462
+ test('returns empty array when no markets match query', () => { })
463
+ test('throws error when OpenAI API key is missing', () => { })
464
+ test('falls back to substring search when Redis unavailable', () => { })
465
+
466
+ // ❌ BAD: Vague test names
467
+ test('works', () => { })
468
+ test('test search', () => { })
469
+ ```
470
+
471
+ ## Code Smell Detection
472
+
473
+ Watch for these anti-patterns:
474
+
475
+ ### 1. Long Functions
476
+ ```typescript
477
+ // ❌ BAD: Function > 50 lines
478
+ function processMarketData() {
479
+ // 100 lines of code
480
+ }
481
+
482
+ // ✅ GOOD: Split into smaller functions
483
+ function processMarketData() {
484
+ const validated = validateData()
485
+ const transformed = transformData(validated)
486
+ return saveData(transformed)
487
+ }
488
+ ```
489
+
490
+ ### 2. Deep Nesting
491
+ ```typescript
492
+ // ❌ BAD: 5+ levels of nesting
493
+ if (user) {
494
+ if (user.isAdmin) {
495
+ if (market) {
496
+ if (market.isActive) {
497
+ if (hasPermission) {
498
+ // Do something
499
+ }
500
+ }
501
+ }
502
+ }
503
+ }
504
+
505
+ // ✅ GOOD: Early returns
506
+ if (!user) return
507
+ if (!user.isAdmin) return
508
+ if (!market) return
509
+ if (!market.isActive) return
510
+ if (!hasPermission) return
511
+
512
+ // Do something
513
+ ```
514
+
515
+ ### 3. Magic Numbers
516
+ ```typescript
517
+ // ❌ BAD: Unexplained numbers
518
+ if (retryCount > 3) { }
519
+ setTimeout(callback, 500)
520
+
521
+ // ✅ GOOD: Named constants
522
+ const MAX_RETRIES = 3
523
+ const DEBOUNCE_DELAY_MS = 500
524
+
525
+ if (retryCount > MAX_RETRIES) { }
526
+ setTimeout(callback, DEBOUNCE_DELAY_MS)
527
+ ```
528
+
529
+ **Remember**: Code quality is not negotiable. Clear, maintainable code enables rapid development and confident refactoring.