@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,210 @@
1
+ ---
2
+ name: iterative-retrieval
3
+ description: Pattern for progressively refining context retrieval to solve the subagent context problem
4
+ ---
5
+
6
+ # Iterative Retrieval Pattern
7
+
8
+ Solves the "context problem" in multi-agent workflows where subagents don't know what context they need until they start working.
9
+
10
+ ## When to Activate
11
+
12
+ - Spawning subagents that need codebase context they cannot predict upfront
13
+ - Building multi-agent workflows where context is progressively refined
14
+ - Encountering "context too large" or "missing context" failures in agent tasks
15
+ - Designing RAG-like retrieval pipelines for code exploration
16
+ - Optimizing token usage in agent orchestration
17
+
18
+ ## The Problem
19
+
20
+ Subagents are spawned with limited context. They don't know:
21
+ - Which files contain relevant code
22
+ - What patterns exist in the codebase
23
+ - What terminology the project uses
24
+
25
+ Standard approaches fail:
26
+ - **Send everything**: Exceeds context limits
27
+ - **Send nothing**: Agent lacks critical information
28
+ - **Guess what's needed**: Often wrong
29
+
30
+ ## The Solution: Iterative Retrieval
31
+
32
+ A 4-phase loop that progressively refines context:
33
+
34
+ ```
35
+ ┌─────────────────────────────────────────────┐
36
+ │ │
37
+ │ ┌──────────┐ ┌──────────┐ │
38
+ │ │ DISPATCH │─────▶│ EVALUATE │ │
39
+ │ └──────────┘ └──────────┘ │
40
+ │ ▲ │ │
41
+ │ │ ▼ │
42
+ │ ┌──────────┐ ┌──────────┐ │
43
+ │ │ LOOP │◀─────│ REFINE │ │
44
+ │ └──────────┘ └──────────┘ │
45
+ │ │
46
+ │ Max 3 cycles, then proceed │
47
+ └─────────────────────────────────────────────┘
48
+ ```
49
+
50
+ ### Phase 1: DISPATCH
51
+
52
+ Initial broad query to gather candidate files:
53
+
54
+ ```javascript
55
+ // Start with high-level intent
56
+ const initialQuery = {
57
+ patterns: ['src/**/*.ts', 'lib/**/*.ts'],
58
+ keywords: ['authentication', 'user', 'session'],
59
+ excludes: ['*.test.ts', '*.spec.ts']
60
+ };
61
+
62
+ // Dispatch to retrieval agent
63
+ const candidates = await retrieveFiles(initialQuery);
64
+ ```
65
+
66
+ ### Phase 2: EVALUATE
67
+
68
+ Assess retrieved content for relevance:
69
+
70
+ ```javascript
71
+ function evaluateRelevance(files, task) {
72
+ return files.map(file => ({
73
+ path: file.path,
74
+ relevance: scoreRelevance(file.content, task),
75
+ reason: explainRelevance(file.content, task),
76
+ missingContext: identifyGaps(file.content, task)
77
+ }));
78
+ }
79
+ ```
80
+
81
+ Scoring criteria:
82
+ - **High (0.8-1.0)**: Directly implements target functionality
83
+ - **Medium (0.5-0.7)**: Contains related patterns or types
84
+ - **Low (0.2-0.4)**: Tangentially related
85
+ - **None (0-0.2)**: Not relevant, exclude
86
+
87
+ ### Phase 3: REFINE
88
+
89
+ Update search criteria based on evaluation:
90
+
91
+ ```javascript
92
+ function refineQuery(evaluation, previousQuery) {
93
+ return {
94
+ // Add new patterns discovered in high-relevance files
95
+ patterns: [...previousQuery.patterns, ...extractPatterns(evaluation)],
96
+
97
+ // Add terminology found in codebase
98
+ keywords: [...previousQuery.keywords, ...extractKeywords(evaluation)],
99
+
100
+ // Exclude confirmed irrelevant paths
101
+ excludes: [...previousQuery.excludes, ...evaluation
102
+ .filter(e => e.relevance < 0.2)
103
+ .map(e => e.path)
104
+ ],
105
+
106
+ // Target specific gaps
107
+ focusAreas: evaluation
108
+ .flatMap(e => e.missingContext)
109
+ .filter(unique)
110
+ };
111
+ }
112
+ ```
113
+
114
+ ### Phase 4: LOOP
115
+
116
+ Repeat with refined criteria (max 3 cycles):
117
+
118
+ ```javascript
119
+ async function iterativeRetrieve(task, maxCycles = 3) {
120
+ let query = createInitialQuery(task);
121
+ let bestContext = [];
122
+
123
+ for (let cycle = 0; cycle < maxCycles; cycle++) {
124
+ const candidates = await retrieveFiles(query);
125
+ const evaluation = evaluateRelevance(candidates, task);
126
+
127
+ // Check if we have sufficient context
128
+ const highRelevance = evaluation.filter(e => e.relevance >= 0.7);
129
+ if (highRelevance.length >= 3 && !hasCriticalGaps(evaluation)) {
130
+ return highRelevance;
131
+ }
132
+
133
+ // Refine and continue
134
+ query = refineQuery(evaluation, query);
135
+ bestContext = mergeContext(bestContext, highRelevance);
136
+ }
137
+
138
+ return bestContext;
139
+ }
140
+ ```
141
+
142
+ ## Practical Examples
143
+
144
+ ### Example 1: Bug Fix Context
145
+
146
+ ```
147
+ Task: "Fix the authentication token expiry bug"
148
+
149
+ Cycle 1:
150
+ DISPATCH: Search for "token", "auth", "expiry" in src/**
151
+ EVALUATE: Found auth.ts (0.9), tokens.ts (0.8), user.ts (0.3)
152
+ REFINE: Add "refresh", "jwt" keywords; exclude user.ts
153
+
154
+ Cycle 2:
155
+ DISPATCH: Search refined terms
156
+ EVALUATE: Found session-manager.ts (0.95), jwt-utils.ts (0.85)
157
+ REFINE: Sufficient context (2 high-relevance files)
158
+
159
+ Result: auth.ts, tokens.ts, session-manager.ts, jwt-utils.ts
160
+ ```
161
+
162
+ ### Example 2: Feature Implementation
163
+
164
+ ```
165
+ Task: "Add rate limiting to API endpoints"
166
+
167
+ Cycle 1:
168
+ DISPATCH: Search "rate", "limit", "api" in routes/**
169
+ EVALUATE: No matches - codebase uses "throttle" terminology
170
+ REFINE: Add "throttle", "middleware" keywords
171
+
172
+ Cycle 2:
173
+ DISPATCH: Search refined terms
174
+ EVALUATE: Found throttle.ts (0.9), middleware/index.ts (0.7)
175
+ REFINE: Need router patterns
176
+
177
+ Cycle 3:
178
+ DISPATCH: Search "router", "express" patterns
179
+ EVALUATE: Found router-setup.ts (0.8)
180
+ REFINE: Sufficient context
181
+
182
+ Result: throttle.ts, middleware/index.ts, router-setup.ts
183
+ ```
184
+
185
+ ## Integration with Agents
186
+
187
+ Use in agent prompts:
188
+
189
+ ```markdown
190
+ When retrieving context for this task:
191
+ 1. Start with broad keyword search
192
+ 2. Evaluate each file's relevance (0-1 scale)
193
+ 3. Identify what context is still missing
194
+ 4. Refine search criteria and repeat (max 3 cycles)
195
+ 5. Return files with relevance >= 0.7
196
+ ```
197
+
198
+ ## Best Practices
199
+
200
+ 1. **Start broad, narrow progressively** - Don't over-specify initial queries
201
+ 2. **Learn codebase terminology** - First cycle often reveals naming conventions
202
+ 3. **Track what's missing** - Explicit gap identification drives refinement
203
+ 4. **Stop at "good enough"** - 3 high-relevance files beats 10 mediocre ones
204
+ 5. **Exclude confidently** - Low-relevance files won't become relevant
205
+
206
+ ## Related
207
+
208
+ - [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) - Subagent orchestration section
209
+ - `continuous-learning` skill - For patterns that improve over time
210
+ - Agent definitions in `~/.claude/agents/`
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: postgres-patterns
3
+ description: PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.
4
+ ---
5
+
6
+ # PostgreSQL Patterns
7
+
8
+ Quick reference for PostgreSQL best practices. For detailed guidance, use the `database-reviewer` agent.
9
+
10
+ ## When to Activate
11
+
12
+ - Writing SQL queries or migrations
13
+ - Designing database schemas
14
+ - Troubleshooting slow queries
15
+ - Implementing Row Level Security
16
+ - Setting up connection pooling
17
+
18
+ ## Quick Reference
19
+
20
+ ### Index Cheat Sheet
21
+
22
+ | Query Pattern | Index Type | Example |
23
+ |--------------|------------|---------|
24
+ | `WHERE col = value` | B-tree (default) | `CREATE INDEX idx ON t (col)` |
25
+ | `WHERE col > value` | B-tree | `CREATE INDEX idx ON t (col)` |
26
+ | `WHERE a = x AND b > y` | Composite | `CREATE INDEX idx ON t (a, b)` |
27
+ | `WHERE jsonb @> '{}'` | GIN | `CREATE INDEX idx ON t USING gin (col)` |
28
+ | `WHERE tsv @@ query` | GIN | `CREATE INDEX idx ON t USING gin (col)` |
29
+ | Time-series ranges | BRIN | `CREATE INDEX idx ON t USING brin (col)` |
30
+
31
+ ### Data Type Quick Reference
32
+
33
+ | Use Case | Correct Type | Avoid |
34
+ |----------|-------------|-------|
35
+ | IDs | `bigint` | `int`, random UUID |
36
+ | Strings | `text` | `varchar(255)` |
37
+ | Timestamps | `timestamptz` | `timestamp` |
38
+ | Money | `numeric(10,2)` | `float` |
39
+ | Flags | `boolean` | `varchar`, `int` |
40
+
41
+ ### Common Patterns
42
+
43
+ **Composite Index Order:**
44
+ ```sql
45
+ -- Equality columns first, then range columns
46
+ CREATE INDEX idx ON orders (status, created_at);
47
+ -- Works for: WHERE status = 'pending' AND created_at > '2024-01-01'
48
+ ```
49
+
50
+ **Covering Index:**
51
+ ```sql
52
+ CREATE INDEX idx ON users (email) INCLUDE (name, created_at);
53
+ -- Avoids table lookup for SELECT email, name, created_at
54
+ ```
55
+
56
+ **Partial Index:**
57
+ ```sql
58
+ CREATE INDEX idx ON users (email) WHERE deleted_at IS NULL;
59
+ -- Smaller index, only includes active users
60
+ ```
61
+
62
+ **RLS Policy (Optimized):**
63
+ ```sql
64
+ CREATE POLICY policy ON orders
65
+ USING ((SELECT auth.uid()) = user_id); -- Wrap in SELECT!
66
+ ```
67
+
68
+ **UPSERT:**
69
+ ```sql
70
+ INSERT INTO settings (user_id, key, value)
71
+ VALUES (123, 'theme', 'dark')
72
+ ON CONFLICT (user_id, key)
73
+ DO UPDATE SET value = EXCLUDED.value;
74
+ ```
75
+
76
+ **Cursor Pagination:**
77
+ ```sql
78
+ SELECT * FROM products WHERE id > $last_id ORDER BY id LIMIT 20;
79
+ -- O(1) vs OFFSET which is O(n)
80
+ ```
81
+
82
+ **Queue Processing:**
83
+ ```sql
84
+ UPDATE jobs SET status = 'processing'
85
+ WHERE id = (
86
+ SELECT id FROM jobs WHERE status = 'pending'
87
+ ORDER BY created_at LIMIT 1
88
+ FOR UPDATE SKIP LOCKED
89
+ ) RETURNING *;
90
+ ```
91
+
92
+ ### Anti-Pattern Detection
93
+
94
+ ```sql
95
+ -- Find unindexed foreign keys
96
+ SELECT conrelid::regclass, a.attname
97
+ FROM pg_constraint c
98
+ JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = ANY(c.conkey)
99
+ WHERE c.contype = 'f'
100
+ AND NOT EXISTS (
101
+ SELECT 1 FROM pg_index i
102
+ WHERE i.indrelid = c.conrelid AND a.attnum = ANY(i.indkey)
103
+ );
104
+
105
+ -- Find slow queries
106
+ SELECT query, mean_exec_time, calls
107
+ FROM pg_stat_statements
108
+ WHERE mean_exec_time > 100
109
+ ORDER BY mean_exec_time DESC;
110
+
111
+ -- Check table bloat
112
+ SELECT relname, n_dead_tup, last_vacuum
113
+ FROM pg_stat_user_tables
114
+ WHERE n_dead_tup > 1000
115
+ ORDER BY n_dead_tup DESC;
116
+ ```
117
+
118
+ ### Configuration Template
119
+
120
+ ```sql
121
+ -- Connection limits (adjust for RAM)
122
+ ALTER SYSTEM SET max_connections = 100;
123
+ ALTER SYSTEM SET work_mem = '8MB';
124
+
125
+ -- Timeouts
126
+ ALTER SYSTEM SET idle_in_transaction_session_timeout = '30s';
127
+ ALTER SYSTEM SET statement_timeout = '30s';
128
+
129
+ -- Monitoring
130
+ CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
131
+
132
+ -- Security defaults
133
+ REVOKE ALL ON SCHEMA public FROM public;
134
+
135
+ SELECT pg_reload_conf();
136
+ ```
137
+
138
+ ## Related
139
+
140
+ - Agent: `database-reviewer` - Full database review workflow
141
+ - Skill: `backend-patterns` - API and backend patterns
142
+
143
+ ---
144
+
145
+ *Based on [Supabase Agent Skills](https://github.com/supabase/agent-skills) (MIT License)*