@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.
- package/assets/agents/architect.md +211 -0
- package/assets/agents/build-error-resolver.md +114 -0
- package/assets/agents/ccwin-code-reviewer.md +224 -0
- package/assets/agents/database-reviewer.md +91 -0
- package/assets/agents/doc-updater.md +107 -0
- package/assets/agents/e2e-runner.md +107 -0
- package/assets/agents/planner.md +212 -0
- package/assets/agents/python-reviewer.md +98 -0
- package/assets/agents/refactor-cleaner.md +85 -0
- package/assets/agents/security-reviewer.md +108 -0
- package/assets/agents/superpower-code-reviewer.md +48 -0
- package/assets/agents/tdd-guide.md +80 -0
- package/assets/commands/build-fix.md +62 -0
- package/assets/commands/checkpoint.md +74 -0
- package/assets/commands/code-review.md +40 -0
- package/assets/commands/e2e.md +362 -0
- package/assets/commands/eval.md +120 -0
- package/assets/commands/orchestrate.md +172 -0
- package/assets/commands/plan.md +113 -0
- package/assets/commands/python-review.md +297 -0
- package/assets/commands/refactor-clean.md +80 -0
- package/assets/commands/sessions.md +305 -0
- package/assets/commands/tdd.md +326 -0
- package/assets/commands/test-coverage.md +69 -0
- package/assets/commands/update-codemaps.md +72 -0
- package/assets/commands/update-docs.md +84 -0
- package/assets/commands/verify.md +59 -0
- package/assets/hooks/post-edit-format.js +49 -0
- package/assets/hooks/post-edit-typecheck.js +96 -0
- package/assets/mcps/mcp-servers.json +92 -0
- package/assets/rules/common/agents.md +49 -0
- package/assets/rules/common/coding-style.md +48 -0
- package/assets/rules/common/git-workflow.md +45 -0
- package/assets/rules/common/hooks.md +30 -0
- package/assets/rules/common/patterns.md +31 -0
- package/assets/rules/common/performance.md +55 -0
- package/assets/rules/common/security.md +29 -0
- package/assets/rules/common/testing.md +29 -0
- package/assets/rules/python/coding-style.md +42 -0
- package/assets/rules/python/hooks.md +19 -0
- package/assets/rules/python/patterns.md +39 -0
- package/assets/rules/python/security.md +30 -0
- package/assets/rules/python/testing.md +38 -0
- package/assets/rules/typescript/coding-style.md +18 -0
- package/assets/rules/typescript/hooks.md +19 -0
- package/assets/rules/typescript/patterns.md +39 -0
- package/assets/rules/typescript/security.md +30 -0
- package/assets/rules/typescript/testing.md +38 -0
- package/assets/skills/api-design/SKILL.md +522 -0
- package/assets/skills/backend-patterns/SKILL.md +597 -0
- package/assets/skills/brainstorming/SKILL.md +96 -0
- package/assets/skills/coding-standards/SKILL.md +529 -0
- package/assets/skills/database-migrations/SKILL.md +334 -0
- package/assets/skills/deployment-patterns/SKILL.md +426 -0
- package/assets/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/assets/skills/docker-patterns/SKILL.md +363 -0
- package/assets/skills/e2e-testing/SKILL.md +325 -0
- package/assets/skills/eval-harness/SKILL.md +235 -0
- package/assets/skills/executing-plans/SKILL.md +84 -0
- package/assets/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/assets/skills/frontend-patterns/SKILL.md +641 -0
- package/assets/skills/iterative-retrieval/SKILL.md +210 -0
- package/assets/skills/postgres-patterns/SKILL.md +145 -0
- package/assets/skills/python-patterns/SKILL.md +749 -0
- package/assets/skills/python-testing/SKILL.md +815 -0
- package/assets/skills/receiving-code-review/SKILL.md +213 -0
- package/assets/skills/requesting-code-review/SKILL.md +105 -0
- package/assets/skills/requesting-code-review/code-reviewer-template.md +146 -0
- package/assets/skills/subagent-driven-development/SKILL.md +242 -0
- package/assets/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/assets/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/assets/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/assets/skills/systematic-debugging/CREATION-LOG.md +114 -0
- package/assets/skills/systematic-debugging/SKILL.md +296 -0
- package/assets/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/assets/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/assets/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/assets/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/assets/skills/systematic-debugging/scripts/find-polluter.sh +63 -0
- package/assets/skills/systematic-debugging/test-academic.md +14 -0
- package/assets/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/assets/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/assets/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/assets/skills/tdd-workflow/SKILL.md +409 -0
- package/assets/skills/test-driven-development/SKILL.md +371 -0
- package/assets/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/assets/skills/using-git-worktrees/SKILL.md +218 -0
- package/assets/skills/verification-before-completion/SKILL.md +139 -0
- package/assets/skills/verification-loop/SKILL.md +125 -0
- package/assets/skills/writing-plans/SKILL.md +116 -0
- package/dist/agents-AEKT67A6.js +9 -0
- package/dist/chunk-3GUKEMND.js +28 -0
- package/dist/chunk-3UNN3IBE.js +54 -0
- package/dist/chunk-3Y26YU4R.js +27 -0
- package/dist/chunk-5XOKKPAA.js +21 -0
- package/dist/chunk-6B46AIFM.js +136 -0
- package/dist/chunk-EYY2IZ7N.js +27 -0
- package/dist/chunk-K25UZZVG.js +17 -0
- package/dist/chunk-KEENFBLL.js +24 -0
- package/dist/chunk-RMUKD7CW.js +44 -0
- package/dist/chunk-W63UKEIT.js +50 -0
- package/dist/cli-VZRGF733.js +238 -0
- package/dist/commands-P5LILVZ5.js +9 -0
- package/dist/hooks-IIG2XK4I.js +9 -0
- package/dist/index.js +131 -0
- package/dist/mcps-67Q7TBGW.js +6 -0
- package/dist/paths-FT6KBIRD.js +10 -0
- package/dist/registry-EGXWYWWK.js +17 -0
- package/dist/rules-2CPBVNNJ.js +7 -0
- package/dist/skills-ULMW3UCM.js +8 -0
- package/package.json +36 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Update Codemaps
|
|
2
|
+
|
|
3
|
+
Analyze the codebase structure and generate token-lean architecture documentation.
|
|
4
|
+
|
|
5
|
+
## Step 1: Scan Project Structure
|
|
6
|
+
|
|
7
|
+
1. Identify the project type (monorepo, single app, library, microservice)
|
|
8
|
+
2. Find all source directories (src/, lib/, app/, packages/)
|
|
9
|
+
3. Map entry points (main.ts, index.ts, app.py, main.go, etc.)
|
|
10
|
+
|
|
11
|
+
## Step 2: Generate Codemaps
|
|
12
|
+
|
|
13
|
+
Create or update codemaps in `docs/CODEMAPS/` (or `.reports/codemaps/`):
|
|
14
|
+
|
|
15
|
+
| File | Contents |
|
|
16
|
+
|------|----------|
|
|
17
|
+
| `architecture.md` | High-level system diagram, service boundaries, data flow |
|
|
18
|
+
| `backend.md` | API routes, middleware chain, service → repository mapping |
|
|
19
|
+
| `frontend.md` | Page tree, component hierarchy, state management flow |
|
|
20
|
+
| `data.md` | Database tables, relationships, migration history |
|
|
21
|
+
| `dependencies.md` | External services, third-party integrations, shared libraries |
|
|
22
|
+
|
|
23
|
+
### Codemap Format
|
|
24
|
+
|
|
25
|
+
Each codemap should be token-lean — optimized for AI context consumption:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# Backend Architecture
|
|
29
|
+
|
|
30
|
+
## Routes
|
|
31
|
+
POST /api/users → UserController.create → UserService.create → UserRepo.insert
|
|
32
|
+
GET /api/users/:id → UserController.get → UserService.findById → UserRepo.findById
|
|
33
|
+
|
|
34
|
+
## Key Files
|
|
35
|
+
src/services/user.ts (business logic, 120 lines)
|
|
36
|
+
src/repos/user.ts (database access, 80 lines)
|
|
37
|
+
|
|
38
|
+
## Dependencies
|
|
39
|
+
- PostgreSQL (primary data store)
|
|
40
|
+
- Redis (session cache, rate limiting)
|
|
41
|
+
- Stripe (payment processing)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Step 3: Diff Detection
|
|
45
|
+
|
|
46
|
+
1. If previous codemaps exist, calculate the diff percentage
|
|
47
|
+
2. If changes > 30%, show the diff and request user approval before overwriting
|
|
48
|
+
3. If changes <= 30%, update in place
|
|
49
|
+
|
|
50
|
+
## Step 4: Add Metadata
|
|
51
|
+
|
|
52
|
+
Add a freshness header to each codemap:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
<!-- Generated: 2026-02-11 | Files scanned: 142 | Token estimate: ~800 -->
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Step 5: Save Analysis Report
|
|
59
|
+
|
|
60
|
+
Write a summary to `.reports/codemap-diff.txt`:
|
|
61
|
+
- Files added/removed/modified since last scan
|
|
62
|
+
- New dependencies detected
|
|
63
|
+
- Architecture changes (new routes, new services, etc.)
|
|
64
|
+
- Staleness warnings for docs not updated in 90+ days
|
|
65
|
+
|
|
66
|
+
## Tips
|
|
67
|
+
|
|
68
|
+
- Focus on **high-level structure**, not implementation details
|
|
69
|
+
- Prefer **file paths and function signatures** over full code blocks
|
|
70
|
+
- Keep each codemap under **1000 tokens** for efficient context loading
|
|
71
|
+
- Use ASCII diagrams for data flow instead of verbose descriptions
|
|
72
|
+
- Run after major feature additions or refactoring sessions
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Update Documentation
|
|
2
|
+
|
|
3
|
+
Sync documentation with the codebase, generating from source-of-truth files.
|
|
4
|
+
|
|
5
|
+
## Step 1: Identify Sources of Truth
|
|
6
|
+
|
|
7
|
+
| Source | Generates |
|
|
8
|
+
|--------|-----------|
|
|
9
|
+
| `package.json` scripts | Available commands reference |
|
|
10
|
+
| `.env.example` | Environment variable documentation |
|
|
11
|
+
| `openapi.yaml` / route files | API endpoint reference |
|
|
12
|
+
| Source code exports | Public API documentation |
|
|
13
|
+
| `Dockerfile` / `docker-compose.yml` | Infrastructure setup docs |
|
|
14
|
+
|
|
15
|
+
## Step 2: Generate Script Reference
|
|
16
|
+
|
|
17
|
+
1. Read `package.json` (or `Makefile`, `Cargo.toml`, `pyproject.toml`)
|
|
18
|
+
2. Extract all scripts/commands with their descriptions
|
|
19
|
+
3. Generate a reference table:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
| Command | Description |
|
|
23
|
+
|---------|-------------|
|
|
24
|
+
| `npm run dev` | Start development server with hot reload |
|
|
25
|
+
| `npm run build` | Production build with type checking |
|
|
26
|
+
| `npm test` | Run test suite with coverage |
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Step 3: Generate Environment Documentation
|
|
30
|
+
|
|
31
|
+
1. Read `.env.example` (or `.env.template`, `.env.sample`)
|
|
32
|
+
2. Extract all variables with their purposes
|
|
33
|
+
3. Categorize as required vs optional
|
|
34
|
+
4. Document expected format and valid values
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
| Variable | Required | Description | Example |
|
|
38
|
+
|----------|----------|-------------|---------|
|
|
39
|
+
| `DATABASE_URL` | Yes | PostgreSQL connection string | `postgres://user:pass@host:5432/db` |
|
|
40
|
+
| `LOG_LEVEL` | No | Logging verbosity (default: info) | `debug`, `info`, `warn`, `error` |
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Step 4: Update Contributing Guide
|
|
44
|
+
|
|
45
|
+
Generate or update `docs/CONTRIBUTING.md` with:
|
|
46
|
+
- Development environment setup (prerequisites, install steps)
|
|
47
|
+
- Available scripts and their purposes
|
|
48
|
+
- Testing procedures (how to run, how to write new tests)
|
|
49
|
+
- Code style enforcement (linter, formatter, pre-commit hooks)
|
|
50
|
+
- PR submission checklist
|
|
51
|
+
|
|
52
|
+
## Step 5: Update Runbook
|
|
53
|
+
|
|
54
|
+
Generate or update `docs/RUNBOOK.md` with:
|
|
55
|
+
- Deployment procedures (step-by-step)
|
|
56
|
+
- Health check endpoints and monitoring
|
|
57
|
+
- Common issues and their fixes
|
|
58
|
+
- Rollback procedures
|
|
59
|
+
- Alerting and escalation paths
|
|
60
|
+
|
|
61
|
+
## Step 6: Staleness Check
|
|
62
|
+
|
|
63
|
+
1. Find documentation files not modified in 90+ days
|
|
64
|
+
2. Cross-reference with recent source code changes
|
|
65
|
+
3. Flag potentially outdated docs for manual review
|
|
66
|
+
|
|
67
|
+
## Step 7: Show Summary
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Documentation Update
|
|
71
|
+
──────────────────────────────
|
|
72
|
+
Updated: docs/CONTRIBUTING.md (scripts table)
|
|
73
|
+
Updated: docs/ENV.md (3 new variables)
|
|
74
|
+
Flagged: docs/DEPLOY.md (142 days stale)
|
|
75
|
+
Skipped: docs/API.md (no changes detected)
|
|
76
|
+
──────────────────────────────
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Rules
|
|
80
|
+
|
|
81
|
+
- **Single source of truth**: Always generate from code, never manually edit generated sections
|
|
82
|
+
- **Preserve manual sections**: Only update generated sections; leave hand-written prose intact
|
|
83
|
+
- **Mark generated content**: Use `<!-- AUTO-GENERATED -->` markers around generated sections
|
|
84
|
+
- **Don't create docs unprompted**: Only create new doc files if the command explicitly requests it
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Verification Command
|
|
2
|
+
|
|
3
|
+
Run comprehensive verification on current codebase state.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Execute verification in this exact order:
|
|
8
|
+
|
|
9
|
+
1. **Build Check**
|
|
10
|
+
- Run the build command for this project
|
|
11
|
+
- If it fails, report errors and STOP
|
|
12
|
+
|
|
13
|
+
2. **Type Check**
|
|
14
|
+
- Run TypeScript/type checker
|
|
15
|
+
- Report all errors with file:line
|
|
16
|
+
|
|
17
|
+
3. **Lint Check**
|
|
18
|
+
- Run linter
|
|
19
|
+
- Report warnings and errors
|
|
20
|
+
|
|
21
|
+
4. **Test Suite**
|
|
22
|
+
- Run all tests
|
|
23
|
+
- Report pass/fail count
|
|
24
|
+
- Report coverage percentage
|
|
25
|
+
|
|
26
|
+
5. **Console.log Audit**
|
|
27
|
+
- Search for console.log in source files
|
|
28
|
+
- Report locations
|
|
29
|
+
|
|
30
|
+
6. **Git Status**
|
|
31
|
+
- Show uncommitted changes
|
|
32
|
+
- Show files modified since last commit
|
|
33
|
+
|
|
34
|
+
## Output
|
|
35
|
+
|
|
36
|
+
Produce a concise verification report:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
VERIFICATION: [PASS/FAIL]
|
|
40
|
+
|
|
41
|
+
Build: [OK/FAIL]
|
|
42
|
+
Types: [OK/X errors]
|
|
43
|
+
Lint: [OK/X issues]
|
|
44
|
+
Tests: [X/Y passed, Z% coverage]
|
|
45
|
+
Secrets: [OK/X found]
|
|
46
|
+
Logs: [OK/X console.logs]
|
|
47
|
+
|
|
48
|
+
Ready for PR: [YES/NO]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If any critical issues, list them with fix suggestions.
|
|
52
|
+
|
|
53
|
+
## Arguments
|
|
54
|
+
|
|
55
|
+
$ARGUMENTS can be:
|
|
56
|
+
- `quick` - Only build + types
|
|
57
|
+
- `full` - All checks (default)
|
|
58
|
+
- `pre-commit` - Checks relevant for commits
|
|
59
|
+
- `pre-pr` - Full checks plus security scan
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PostToolUse Hook: Auto-format JS/TS files with Prettier after edits
|
|
4
|
+
*
|
|
5
|
+
* Cross-platform (Windows, macOS, Linux)
|
|
6
|
+
*
|
|
7
|
+
* Runs after Edit tool use. If the edited file is a JS/TS file,
|
|
8
|
+
* formats it with Prettier. Fails silently if Prettier isn't installed.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { execFileSync } = require('child_process');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
const MAX_STDIN = 1024 * 1024; // 1MB limit
|
|
15
|
+
let data = '';
|
|
16
|
+
process.stdin.setEncoding('utf8');
|
|
17
|
+
|
|
18
|
+
process.stdin.on('data', chunk => {
|
|
19
|
+
if (data.length < MAX_STDIN) {
|
|
20
|
+
const remaining = MAX_STDIN - data.length;
|
|
21
|
+
data += chunk.substring(0, remaining);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
process.stdin.on('end', () => {
|
|
26
|
+
try {
|
|
27
|
+
const input = JSON.parse(data);
|
|
28
|
+
const filePath = input.tool_input?.file_path;
|
|
29
|
+
|
|
30
|
+
if (filePath && /\.(ts|tsx|js|jsx)$/.test(filePath)) {
|
|
31
|
+
try {
|
|
32
|
+
// Use npx.cmd on Windows to avoid shell: true which enables command injection
|
|
33
|
+
const npxBin = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
34
|
+
execFileSync(npxBin, ['prettier', '--write', filePath], {
|
|
35
|
+
cwd: path.dirname(path.resolve(filePath)),
|
|
36
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
37
|
+
timeout: 15000
|
|
38
|
+
});
|
|
39
|
+
} catch {
|
|
40
|
+
// Prettier not installed, file missing, or failed — non-blocking
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
// Invalid input — pass through
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
process.stdout.write(data);
|
|
48
|
+
process.exit(0);
|
|
49
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* PostToolUse Hook: TypeScript check after editing .ts/.tsx files
|
|
4
|
+
*
|
|
5
|
+
* Cross-platform (Windows, macOS, Linux)
|
|
6
|
+
*
|
|
7
|
+
* Runs after Edit tool use on TypeScript files. Walks up from the file's
|
|
8
|
+
* directory to find the nearest tsconfig.json, then runs tsc --noEmit
|
|
9
|
+
* and reports only errors related to the edited file.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { execFileSync } = require("child_process");
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
|
|
16
|
+
const MAX_STDIN = 1024 * 1024; // 1MB limit
|
|
17
|
+
let data = "";
|
|
18
|
+
process.stdin.setEncoding("utf8");
|
|
19
|
+
|
|
20
|
+
process.stdin.on("data", (chunk) => {
|
|
21
|
+
if (data.length < MAX_STDIN) {
|
|
22
|
+
const remaining = MAX_STDIN - data.length;
|
|
23
|
+
data += chunk.substring(0, remaining);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
process.stdin.on("end", () => {
|
|
28
|
+
try {
|
|
29
|
+
const input = JSON.parse(data);
|
|
30
|
+
const filePath = input.tool_input?.file_path;
|
|
31
|
+
|
|
32
|
+
if (filePath && /\.(ts|tsx)$/.test(filePath)) {
|
|
33
|
+
const resolvedPath = path.resolve(filePath);
|
|
34
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
35
|
+
process.stdout.write(data);
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
// Find nearest tsconfig.json by walking up (max 20 levels to prevent infinite loop)
|
|
39
|
+
let dir = path.dirname(resolvedPath);
|
|
40
|
+
const root = path.parse(dir).root;
|
|
41
|
+
let depth = 0;
|
|
42
|
+
|
|
43
|
+
while (dir !== root && depth < 20) {
|
|
44
|
+
if (fs.existsSync(path.join(dir, "tsconfig.json"))) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
dir = path.dirname(dir);
|
|
48
|
+
depth++;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (fs.existsSync(path.join(dir, "tsconfig.json"))) {
|
|
52
|
+
try {
|
|
53
|
+
// Use npx.cmd on Windows to avoid shell: true which enables command injection
|
|
54
|
+
const npxBin = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
55
|
+
execFileSync(npxBin, ["tsc", "--noEmit", "--pretty", "false"], {
|
|
56
|
+
cwd: dir,
|
|
57
|
+
encoding: "utf8",
|
|
58
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
59
|
+
timeout: 30000,
|
|
60
|
+
});
|
|
61
|
+
} catch (err) {
|
|
62
|
+
// tsc exits non-zero when there are errors — filter to edited file
|
|
63
|
+
const output = (err.stdout || "") + (err.stderr || "");
|
|
64
|
+
// Compute paths that uniquely identify the edited file.
|
|
65
|
+
// tsc output uses paths relative to its cwd (the tsconfig dir),
|
|
66
|
+
// so check for the relative path, absolute path, and original path.
|
|
67
|
+
// Avoid bare basename matching — it causes false positives when
|
|
68
|
+
// multiple files share the same name (e.g., src/utils.ts vs tests/utils.ts).
|
|
69
|
+
const relPath = path.relative(dir, resolvedPath);
|
|
70
|
+
const candidates = new Set([filePath, resolvedPath, relPath]);
|
|
71
|
+
const relevantLines = output
|
|
72
|
+
.split("\n")
|
|
73
|
+
.filter((line) => {
|
|
74
|
+
for (const candidate of candidates) {
|
|
75
|
+
if (line.includes(candidate)) return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
})
|
|
79
|
+
.slice(0, 10);
|
|
80
|
+
|
|
81
|
+
if (relevantLines.length > 0) {
|
|
82
|
+
console.error(
|
|
83
|
+
"[Hook] TypeScript errors in " + path.basename(filePath) + ":",
|
|
84
|
+
);
|
|
85
|
+
relevantLines.forEach((line) => console.error(line));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} catch {
|
|
91
|
+
// Invalid input — pass through
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
process.stdout.write(data);
|
|
95
|
+
process.exit(0);
|
|
96
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
{
|
|
3
|
+
"mcpServers": {
|
|
4
|
+
"github": {
|
|
5
|
+
"command": "npx",
|
|
6
|
+
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
7
|
+
"env": {
|
|
8
|
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT_HERE"
|
|
9
|
+
},
|
|
10
|
+
"description": "GitHub operations - PRs, issues, repos"
|
|
11
|
+
},
|
|
12
|
+
"firecrawl": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "firecrawl-mcp"],
|
|
15
|
+
"env": {
|
|
16
|
+
"FIRECRAWL_API_KEY": "YOUR_FIRECRAWL_KEY_HERE"
|
|
17
|
+
},
|
|
18
|
+
"description": "Web scraping and crawling"
|
|
19
|
+
},
|
|
20
|
+
"supabase": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "@supabase/mcp-server-supabase@latest", "--project-ref=YOUR_PROJECT_REF"],
|
|
23
|
+
"description": "Supabase database operations"
|
|
24
|
+
},
|
|
25
|
+
"memory": {
|
|
26
|
+
"command": "npx",
|
|
27
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
28
|
+
"description": "Persistent memory across sessions"
|
|
29
|
+
},
|
|
30
|
+
"sequential-thinking": {
|
|
31
|
+
"command": "npx",
|
|
32
|
+
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"],
|
|
33
|
+
"description": "Chain-of-thought reasoning"
|
|
34
|
+
},
|
|
35
|
+
"vercel": {
|
|
36
|
+
"type": "http",
|
|
37
|
+
"url": "https://mcp.vercel.com",
|
|
38
|
+
"description": "Vercel deployments and projects"
|
|
39
|
+
},
|
|
40
|
+
"railway": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["-y", "@railway/mcp-server"],
|
|
43
|
+
"description": "Railway deployments"
|
|
44
|
+
},
|
|
45
|
+
"cloudflare-docs": {
|
|
46
|
+
"type": "http",
|
|
47
|
+
"url": "https://docs.mcp.cloudflare.com/mcp",
|
|
48
|
+
"description": "Cloudflare documentation search"
|
|
49
|
+
},
|
|
50
|
+
"cloudflare-workers-builds": {
|
|
51
|
+
"type": "http",
|
|
52
|
+
"url": "https://builds.mcp.cloudflare.com/mcp",
|
|
53
|
+
"description": "Cloudflare Workers builds"
|
|
54
|
+
},
|
|
55
|
+
"cloudflare-workers-bindings": {
|
|
56
|
+
"type": "http",
|
|
57
|
+
"url": "https://bindings.mcp.cloudflare.com/mcp",
|
|
58
|
+
"description": "Cloudflare Workers bindings"
|
|
59
|
+
},
|
|
60
|
+
"cloudflare-observability": {
|
|
61
|
+
"type": "http",
|
|
62
|
+
"url": "https://observability.mcp.cloudflare.com/mcp",
|
|
63
|
+
"description": "Cloudflare observability/logs"
|
|
64
|
+
},
|
|
65
|
+
"clickhouse": {
|
|
66
|
+
"type": "http",
|
|
67
|
+
"url": "https://mcp.clickhouse.cloud/mcp",
|
|
68
|
+
"description": "ClickHouse analytics queries"
|
|
69
|
+
},
|
|
70
|
+
"context7": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["-y", "@context7/mcp-server"],
|
|
73
|
+
"description": "Live documentation lookup"
|
|
74
|
+
},
|
|
75
|
+
"magic": {
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": ["-y", "@magicuidesign/mcp@latest"],
|
|
78
|
+
"description": "Magic UI components"
|
|
79
|
+
},
|
|
80
|
+
"filesystem": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/projects"],
|
|
83
|
+
"description": "Filesystem operations (set your path)"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"_comments": {
|
|
87
|
+
"usage": "Copy the servers you need to your ~/.claude.json mcpServers section",
|
|
88
|
+
"env_vars": "Replace YOUR_*_HERE placeholders with actual values",
|
|
89
|
+
"disabling": "Use disabledMcpServers array in project config to disable per-project",
|
|
90
|
+
"context_warning": "Keep under 10 MCPs enabled to preserve context window"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -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 module
|
|
35
|
+
2. Agent 2: Performance review of cache system
|
|
36
|
+
3. Agent 3: Type checking of utilities
|
|
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,48 @@
|
|
|
1
|
+
# Coding Style
|
|
2
|
+
|
|
3
|
+
## Immutability (CRITICAL)
|
|
4
|
+
|
|
5
|
+
ALWAYS create new objects, NEVER mutate existing ones:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
// Pseudocode
|
|
9
|
+
WRONG: modify(original, field, value) → changes original in-place
|
|
10
|
+
CORRECT: update(original, field, value) → returns new copy with change
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Rationale: Immutable data prevents hidden side effects, makes debugging easier, and enables safe concurrency.
|
|
14
|
+
|
|
15
|
+
## File Organization
|
|
16
|
+
|
|
17
|
+
MANY SMALL FILES > FEW LARGE FILES:
|
|
18
|
+
- High cohesion, low coupling
|
|
19
|
+
- 200-400 lines typical, 800 max
|
|
20
|
+
- Extract utilities from large modules
|
|
21
|
+
- Organize by feature/domain, not by type
|
|
22
|
+
|
|
23
|
+
## Error Handling
|
|
24
|
+
|
|
25
|
+
ALWAYS handle errors comprehensively:
|
|
26
|
+
- Handle errors explicitly at every level
|
|
27
|
+
- Provide user-friendly error messages in UI-facing code
|
|
28
|
+
- Log detailed error context on the server side
|
|
29
|
+
- Never silently swallow errors
|
|
30
|
+
|
|
31
|
+
## Input Validation
|
|
32
|
+
|
|
33
|
+
ALWAYS validate at system boundaries:
|
|
34
|
+
- Validate all user input before processing
|
|
35
|
+
- Use schema-based validation where available
|
|
36
|
+
- Fail fast with clear error messages
|
|
37
|
+
- Never trust external data (API responses, user input, file content)
|
|
38
|
+
|
|
39
|
+
## Code Quality Checklist
|
|
40
|
+
|
|
41
|
+
Before marking work complete:
|
|
42
|
+
- [ ] Code is readable and well-named
|
|
43
|
+
- [ ] Functions are small (<50 lines)
|
|
44
|
+
- [ ] Files are focused (<800 lines)
|
|
45
|
+
- [ ] No deep nesting (>4 levels)
|
|
46
|
+
- [ ] Proper error handling
|
|
47
|
+
- [ ] No hardcoded values (use constants or config)
|
|
48
|
+
- [ ] 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,30 @@
|
|
|
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
|
+
## Auto-Accept Permissions
|
|
10
|
+
|
|
11
|
+
Use with caution:
|
|
12
|
+
- Enable for trusted, well-defined plans
|
|
13
|
+
- Disable for exploratory work
|
|
14
|
+
- Never use dangerously-skip-permissions flag
|
|
15
|
+
- Configure `allowedTools` in `~/.claude.json` instead
|
|
16
|
+
|
|
17
|
+
## TodoWrite Best Practices
|
|
18
|
+
|
|
19
|
+
Use TodoWrite tool to:
|
|
20
|
+
- Track progress on multi-step tasks
|
|
21
|
+
- Verify understanding of instructions
|
|
22
|
+
- Enable real-time steering
|
|
23
|
+
- Show granular implementation steps
|
|
24
|
+
|
|
25
|
+
Todo list reveals:
|
|
26
|
+
- Out of order steps
|
|
27
|
+
- Missing items
|
|
28
|
+
- Extra unnecessary items
|
|
29
|
+
- Wrong granularity
|
|
30
|
+
- Misinterpreted requirements
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Common Patterns
|
|
2
|
+
|
|
3
|
+
## Skeleton Projects
|
|
4
|
+
|
|
5
|
+
When implementing new functionality:
|
|
6
|
+
1. Search for battle-tested skeleton projects
|
|
7
|
+
2. Use parallel agents to evaluate options:
|
|
8
|
+
- Security assessment
|
|
9
|
+
- Extensibility analysis
|
|
10
|
+
- Relevance scoring
|
|
11
|
+
- Implementation planning
|
|
12
|
+
3. Clone best match as foundation
|
|
13
|
+
4. Iterate within proven structure
|
|
14
|
+
|
|
15
|
+
## Design Patterns
|
|
16
|
+
|
|
17
|
+
### Repository Pattern
|
|
18
|
+
|
|
19
|
+
Encapsulate data access behind a consistent interface:
|
|
20
|
+
- Define standard operations: findAll, findById, create, update, delete
|
|
21
|
+
- Concrete implementations handle storage details (database, API, file, etc.)
|
|
22
|
+
- Business logic depends on the abstract interface, not the storage mechanism
|
|
23
|
+
- Enables easy swapping of data sources and simplifies testing with mocks
|
|
24
|
+
|
|
25
|
+
### API Response Format
|
|
26
|
+
|
|
27
|
+
Use a consistent envelope for all API responses:
|
|
28
|
+
- Include a success/status indicator
|
|
29
|
+
- Include the data payload (nullable on error)
|
|
30
|
+
- Include an error message field (nullable on success)
|
|
31
|
+
- Include metadata for paginated responses (total, page, limit)
|