@cregis-dev/cckit 0.6.5 → 0.6.7
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/README.md +221 -221
- package/package.json +1 -1
- package/registry.json +145 -128
- package/src/cli.js +79 -79
- package/src/commands/init.js +174 -161
- package/src/commands/status.js +125 -85
- package/src/commands/update.js +192 -151
- package/src/core/config.js +82 -74
- package/src/core/orchestrator.js +79 -79
- package/src/core/registry.js +60 -60
- package/src/steps/add-plugin.js +148 -0
- package/src/steps/configure-user.js +181 -181
- package/src/steps/enable-plugins.js +97 -97
- package/src/steps/install-bmad.js +85 -85
- package/src/steps/install-mcp.js +70 -70
- package/src/steps/install-rules.js +69 -69
- package/src/steps/install-skills.js +56 -56
- package/src/utils/compare-versions.js +106 -0
- package/src/utils/fs.js +33 -33
- package/src/utils/manifest.js +101 -99
- package/src/utils/prompt.js +41 -41
- package/templates/mcp/claude-code/.mcp.json +40 -40
- package/templates/rules/README.md +103 -103
- package/templates/rules/common/agents.md +49 -49
- package/templates/rules/common/coding-style.md +48 -48
- package/templates/rules/common/development-workflow.md +37 -37
- package/templates/rules/common/git-workflow.md +24 -24
- package/templates/rules/common/hooks.md +30 -30
- package/templates/rules/common/patterns.md +31 -31
- package/templates/rules/common/performance.md +55 -55
- package/templates/rules/common/security.md +29 -29
- package/templates/rules/common/testing.md +29 -29
- package/templates/rules/golang/coding-style.md +32 -32
- package/templates/rules/golang/hooks.md +17 -17
- package/templates/rules/golang/patterns.md +45 -45
- package/templates/rules/golang/security.md +34 -34
- package/templates/rules/golang/testing.md +31 -31
- package/templates/rules/python/coding-style.md +42 -42
- package/templates/rules/python/hooks.md +19 -19
- package/templates/rules/python/patterns.md +39 -39
- package/templates/rules/python/security.md +30 -30
- package/templates/rules/python/testing.md +38 -38
- package/templates/rules/swift/coding-style.md +47 -47
- package/templates/rules/swift/hooks.md +20 -20
- package/templates/rules/swift/patterns.md +66 -66
- package/templates/rules/swift/security.md +33 -33
- package/templates/rules/swift/testing.md +45 -45
- package/templates/rules/typescript/coding-style.md +65 -65
- package/templates/rules/typescript/hooks.md +22 -22
- package/templates/rules/typescript/patterns.md +52 -52
- package/templates/rules/typescript/security.md +28 -28
- package/templates/rules/typescript/testing.md +18 -18
|
@@ -1,49 +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
|
|
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
|
|
@@ -1,48 +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)
|
|
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)
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
# Development Workflow
|
|
2
|
-
|
|
3
|
-
> This file extends [common/git-workflow.md](./git-workflow.md) with the full feature development process that happens before git operations.
|
|
4
|
-
|
|
5
|
-
The Feature Implementation Workflow describes the development pipeline: research, planning, TDD, code review, and then committing to git.
|
|
6
|
-
|
|
7
|
-
## Feature Implementation Workflow
|
|
8
|
-
|
|
9
|
-
0. **Research & Reuse** _(mandatory before any new implementation)_
|
|
10
|
-
- **GitHub code search first:** Run `gh search repos` and `gh search code` to find existing implementations, templates, and patterns before writing anything new.
|
|
11
|
-
- **Exa MCP for research:** Use `exa-web-search` MCP during the planning phase for broader research, data ingestion, and discovering prior art.
|
|
12
|
-
- **Check package registries:** Search npm, PyPI, crates.io, and other registries before writing utility code. Prefer battle-tested libraries over hand-rolled solutions.
|
|
13
|
-
- **Search for adaptable implementations:** Look for open-source projects that solve 80%+ of the problem and can be forked, ported, or wrapped.
|
|
14
|
-
- Prefer adopting or porting a proven approach over writing net-new code when it meets the requirement.
|
|
15
|
-
|
|
16
|
-
1. **Plan First**
|
|
17
|
-
- Use **planner** agent to create implementation plan
|
|
18
|
-
- Generate planning docs before coding: PRD, architecture, system_design, tech_doc, task_list
|
|
19
|
-
- Identify dependencies and risks
|
|
20
|
-
- Break down into phases
|
|
21
|
-
|
|
22
|
-
2. **TDD Approach**
|
|
23
|
-
- Use **tdd-guide** agent
|
|
24
|
-
- Write tests first (RED)
|
|
25
|
-
- Implement to pass tests (GREEN)
|
|
26
|
-
- Refactor (IMPROVE)
|
|
27
|
-
- Verify 80%+ coverage
|
|
28
|
-
|
|
29
|
-
3. **Code Review**
|
|
30
|
-
- Use **code-reviewer** agent immediately after writing code
|
|
31
|
-
- Address CRITICAL and HIGH issues
|
|
32
|
-
- Fix MEDIUM issues when possible
|
|
33
|
-
|
|
34
|
-
4. **Commit & Push**
|
|
35
|
-
- Detailed commit messages
|
|
36
|
-
- Follow conventional commits format
|
|
37
|
-
- See [git-workflow.md](./git-workflow.md) for commit message format and PR process
|
|
1
|
+
# Development Workflow
|
|
2
|
+
|
|
3
|
+
> This file extends [common/git-workflow.md](./git-workflow.md) with the full feature development process that happens before git operations.
|
|
4
|
+
|
|
5
|
+
The Feature Implementation Workflow describes the development pipeline: research, planning, TDD, code review, and then committing to git.
|
|
6
|
+
|
|
7
|
+
## Feature Implementation Workflow
|
|
8
|
+
|
|
9
|
+
0. **Research & Reuse** _(mandatory before any new implementation)_
|
|
10
|
+
- **GitHub code search first:** Run `gh search repos` and `gh search code` to find existing implementations, templates, and patterns before writing anything new.
|
|
11
|
+
- **Exa MCP for research:** Use `exa-web-search` MCP during the planning phase for broader research, data ingestion, and discovering prior art.
|
|
12
|
+
- **Check package registries:** Search npm, PyPI, crates.io, and other registries before writing utility code. Prefer battle-tested libraries over hand-rolled solutions.
|
|
13
|
+
- **Search for adaptable implementations:** Look for open-source projects that solve 80%+ of the problem and can be forked, ported, or wrapped.
|
|
14
|
+
- Prefer adopting or porting a proven approach over writing net-new code when it meets the requirement.
|
|
15
|
+
|
|
16
|
+
1. **Plan First**
|
|
17
|
+
- Use **planner** agent to create implementation plan
|
|
18
|
+
- Generate planning docs before coding: PRD, architecture, system_design, tech_doc, task_list
|
|
19
|
+
- Identify dependencies and risks
|
|
20
|
+
- Break down into phases
|
|
21
|
+
|
|
22
|
+
2. **TDD Approach**
|
|
23
|
+
- Use **tdd-guide** agent
|
|
24
|
+
- Write tests first (RED)
|
|
25
|
+
- Implement to pass tests (GREEN)
|
|
26
|
+
- Refactor (IMPROVE)
|
|
27
|
+
- Verify 80%+ coverage
|
|
28
|
+
|
|
29
|
+
3. **Code Review**
|
|
30
|
+
- Use **code-reviewer** agent immediately after writing code
|
|
31
|
+
- Address CRITICAL and HIGH issues
|
|
32
|
+
- Fix MEDIUM issues when possible
|
|
33
|
+
|
|
34
|
+
4. **Commit & Push**
|
|
35
|
+
- Detailed commit messages
|
|
36
|
+
- Follow conventional commits format
|
|
37
|
+
- See [git-workflow.md](./git-workflow.md) for commit message format and PR process
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# Git Workflow
|
|
2
|
-
|
|
3
|
-
## Commit Message Format
|
|
4
|
-
```
|
|
5
|
-
<type>: <description>
|
|
6
|
-
|
|
7
|
-
<optional body>
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
11
|
-
|
|
12
|
-
Note: Attribution disabled globally via ~/.claude/settings.json.
|
|
13
|
-
|
|
14
|
-
## Pull Request Workflow
|
|
15
|
-
|
|
16
|
-
When creating PRs:
|
|
17
|
-
1. Analyze full commit history (not just latest commit)
|
|
18
|
-
2. Use `git diff [base-branch]...HEAD` to see all changes
|
|
19
|
-
3. Draft comprehensive PR summary
|
|
20
|
-
4. Include test plan with TODOs
|
|
21
|
-
5. Push with `-u` flag if new branch
|
|
22
|
-
|
|
23
|
-
> For the full development process (planning, TDD, code review) before git operations,
|
|
24
|
-
> see [development-workflow.md](./development-workflow.md).
|
|
1
|
+
# Git Workflow
|
|
2
|
+
|
|
3
|
+
## Commit Message Format
|
|
4
|
+
```
|
|
5
|
+
<type>: <description>
|
|
6
|
+
|
|
7
|
+
<optional body>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
11
|
+
|
|
12
|
+
Note: Attribution disabled globally via ~/.claude/settings.json.
|
|
13
|
+
|
|
14
|
+
## Pull Request Workflow
|
|
15
|
+
|
|
16
|
+
When creating PRs:
|
|
17
|
+
1. Analyze full commit history (not just latest commit)
|
|
18
|
+
2. Use `git diff [base-branch]...HEAD` to see all changes
|
|
19
|
+
3. Draft comprehensive PR summary
|
|
20
|
+
4. Include test plan with TODOs
|
|
21
|
+
5. Push with `-u` flag if new branch
|
|
22
|
+
|
|
23
|
+
> For the full development process (planning, TDD, code review) before git operations,
|
|
24
|
+
> see [development-workflow.md](./development-workflow.md).
|
|
@@ -1,30 +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
|
|
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
|
|
@@ -1,31 +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)
|
|
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)
|
|
@@ -1,55 +1,55 @@
|
|
|
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.6** (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
|
-
## Extended Thinking + Plan Mode
|
|
34
|
-
|
|
35
|
-
Extended thinking is enabled by default, reserving up to 31,999 tokens for internal reasoning.
|
|
36
|
-
|
|
37
|
-
Control extended thinking via:
|
|
38
|
-
- **Toggle**: Option+T (macOS) / Alt+T (Windows/Linux)
|
|
39
|
-
- **Config**: Set `alwaysThinkingEnabled` in `~/.claude/settings.json`
|
|
40
|
-
- **Budget cap**: `export MAX_THINKING_TOKENS=10000`
|
|
41
|
-
- **Verbose mode**: Ctrl+O to see thinking output
|
|
42
|
-
|
|
43
|
-
For complex tasks requiring deep reasoning:
|
|
44
|
-
1. Ensure extended thinking is enabled (on by default)
|
|
45
|
-
2. Enable **Plan Mode** for structured approach
|
|
46
|
-
3. Use multiple critique rounds for thorough analysis
|
|
47
|
-
4. Use split role sub-agents for diverse perspectives
|
|
48
|
-
|
|
49
|
-
## Build Troubleshooting
|
|
50
|
-
|
|
51
|
-
If build fails:
|
|
52
|
-
1. Use **build-error-resolver** agent
|
|
53
|
-
2. Analyze error messages
|
|
54
|
-
3. Fix incrementally
|
|
55
|
-
4. Verify after each fix
|
|
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.6** (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
|
+
## Extended Thinking + Plan Mode
|
|
34
|
+
|
|
35
|
+
Extended thinking is enabled by default, reserving up to 31,999 tokens for internal reasoning.
|
|
36
|
+
|
|
37
|
+
Control extended thinking via:
|
|
38
|
+
- **Toggle**: Option+T (macOS) / Alt+T (Windows/Linux)
|
|
39
|
+
- **Config**: Set `alwaysThinkingEnabled` in `~/.claude/settings.json`
|
|
40
|
+
- **Budget cap**: `export MAX_THINKING_TOKENS=10000`
|
|
41
|
+
- **Verbose mode**: Ctrl+O to see thinking output
|
|
42
|
+
|
|
43
|
+
For complex tasks requiring deep reasoning:
|
|
44
|
+
1. Ensure extended thinking is enabled (on by default)
|
|
45
|
+
2. Enable **Plan Mode** for structured approach
|
|
46
|
+
3. Use multiple critique rounds for thorough analysis
|
|
47
|
+
4. Use split role sub-agents for diverse perspectives
|
|
48
|
+
|
|
49
|
+
## Build Troubleshooting
|
|
50
|
+
|
|
51
|
+
If build fails:
|
|
52
|
+
1. Use **build-error-resolver** agent
|
|
53
|
+
2. Analyze error messages
|
|
54
|
+
3. Fix incrementally
|
|
55
|
+
4. Verify after each fix
|
|
@@ -1,29 +1,29 @@
|
|
|
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
|
-
- NEVER hardcode secrets in source code
|
|
18
|
-
- ALWAYS use environment variables or a secret manager
|
|
19
|
-
- Validate that required secrets are present at startup
|
|
20
|
-
- Rotate any secrets that may have been exposed
|
|
21
|
-
|
|
22
|
-
## Security Response Protocol
|
|
23
|
-
|
|
24
|
-
If security issue found:
|
|
25
|
-
1. STOP immediately
|
|
26
|
-
2. Use **security-reviewer** agent
|
|
27
|
-
3. Fix CRITICAL issues before continuing
|
|
28
|
-
4. Rotate any exposed secrets
|
|
29
|
-
5. Review entire codebase for similar issues
|
|
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
|
+
- NEVER hardcode secrets in source code
|
|
18
|
+
- ALWAYS use environment variables or a secret manager
|
|
19
|
+
- Validate that required secrets are present at startup
|
|
20
|
+
- Rotate any secrets that may have been exposed
|
|
21
|
+
|
|
22
|
+
## Security Response Protocol
|
|
23
|
+
|
|
24
|
+
If security issue found:
|
|
25
|
+
1. STOP immediately
|
|
26
|
+
2. Use **security-reviewer** agent
|
|
27
|
+
3. Fix CRITICAL issues before continuing
|
|
28
|
+
4. Rotate any exposed secrets
|
|
29
|
+
5. Review entire codebase for similar issues
|