claude-all-config 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSE.md +70 -0
- package/README.md +133 -0
- package/VERSION +1 -0
- package/agents/accessibility-reviewer.md +96 -0
- package/agents/ai-prompt-optimizer.md +94 -0
- package/agents/api-tester.md +102 -0
- package/agents/code-generator.md +94 -0
- package/agents/code-reviewer.md +47 -0
- package/agents/component-generator.md +102 -0
- package/agents/doc-generator.md +91 -0
- package/agents/migration-generator.md +94 -0
- package/agents/performance-analyzer.md +90 -0
- package/agents/proactive-mode.md +91 -0
- package/agents/readme-generator.md +101 -0
- package/agents/security-auditor.md +86 -0
- package/agents/terraform-generator.md +94 -0
- package/agents/test-generator.md +76 -0
- package/bin/agentrouter.json +36 -0
- package/bin/ai-chat +20 -0
- package/bin/antigravity.json +76 -0
- package/bin/api-manager +340 -0
- package/bin/claude-launcher +19 -0
- package/bin/claude-master +15 -0
- package/bin/claude_master.py +295 -0
- package/bin/cohere.json +7 -0
- package/bin/deepseek.json +44 -0
- package/bin/gemini.json +56 -0
- package/bin/glm.json +21 -0
- package/bin/groq.json +41 -0
- package/bin/minimax.json +26 -0
- package/bin/mistral.json +7 -0
- package/bin/moonshot.json +7 -0
- package/bin/ollama.json +36 -0
- package/bin/openai.json +46 -0
- package/bin/openrouter.json +38 -0
- package/bin/perplexity.json +12 -0
- package/bin/qwen.json +7 -0
- package/bin/switch-provider +73 -0
- package/bin/test.json +7 -0
- package/bin/xai.json +41 -0
- package/claude-all +2707 -0
- package/claude-config.json +340 -0
- package/claude-suite/REFACTORING_SUMMARY.md +88 -0
- package/claude-suite/auth/.antigravity_proxy.py +78 -0
- package/claude-suite/auth/__pycache__/openai_auth.cpython-312.pyc +0 -0
- package/claude-suite/auth/gemini_auth.py +80 -0
- package/claude-suite/auth/openai_auth.py +138 -0
- package/claude-suite/backups/claude-all-before-refactor +1075 -0
- package/claude-suite/backups/claude-all.backup +840 -0
- package/claude-suite/backups/claude-all.original +840 -0
- package/claude-suite/models/add-model-manual.sh +588 -0
- package/claude-suite/models/add-model.sh +114 -0
- package/claude-suite/models/model-switcher.sh +69 -0
- package/claude-suite/providers/claude-glm +89 -0
- package/claude-suite/providers/claude-glm-wrapper.sh +55 -0
- package/claude-suite/providers/claude-minimax +12 -0
- package/claude-suite/providers/claude-smart +132 -0
- package/claude-suite/providers/xai_chat.sh +56 -0
- package/claude-suite/utils/__pycache__/claude_master.cpython-312.pyc +0 -0
- package/claude-suite/utils/antigravity_proxy_server.py +168 -0
- package/claude-suite/utils/claude-all-help.txt +83 -0
- package/claude-suite/utils/claude_master.py +408 -0
- package/commands/brainstorm.md +5 -0
- package/commands/execute-plan.md +5 -0
- package/commands/write-plan.md +5 -0
- package/docs/ANTIGRAVITY-SETUP.md +176 -0
- package/docs/AUTH_CREDENTIALS.md +54 -0
- package/docs/NPM-INSTALLATION.md +166 -0
- package/hooks/hooks.json +15 -0
- package/hooks/run-hook.cmd +19 -0
- package/hooks/session-start.sh +52 -0
- package/install.sh +155 -0
- package/mcp.json +34 -0
- package/model/perplexity.json +12 -0
- package/package.json +69 -0
- package/plugins/README.md +47 -0
- package/plugins/installed_plugins.json +317 -0
- package/plugins/known_marketplaces.json +10 -0
- package/plugins/marketplace-info/marketplace.json +517 -0
- package/postinstall.js +100 -0
- package/scripts/antigravity_proxy_server.py +168 -0
- package/scripts/get_gemini_api_key.py +96 -0
- package/scripts/setup_antigravity_auth.py +171 -0
- package/skills/api-development/SKILL.md +11 -0
- package/skills/api-development/openapi/api-documentation.yaml +108 -0
- package/skills/brainstorming/SKILL.md +54 -0
- package/skills/code-quality/SKILL.md +196 -0
- package/skills/condition-based-waiting/SKILL.md +120 -0
- package/skills/condition-based-waiting/example.ts +158 -0
- package/skills/database-development/SKILL.md +11 -0
- package/skills/database-development/migrations/migration.template.sql +49 -0
- package/skills/defense-in-depth/SKILL.md +127 -0
- package/skills/deployment/SKILL.md +11 -0
- package/skills/deployment/ci-cd/github-actions.yml +95 -0
- package/skills/deployment/docker/Dockerfile.template +39 -0
- package/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/skills/documentation-generation/SKILL.md +8 -0
- package/skills/documentation-generation/templates/README.template.md +60 -0
- package/skills/error-handling/SKILL.md +267 -0
- package/skills/executing-plans/SKILL.md +76 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-design/frontend-design/SKILL.md +42 -0
- package/skills/integration-testing/SKILL.md +13 -0
- package/skills/integration-testing/examples/contract-test.py +317 -0
- package/skills/integration-testing/examples/e2e-test.js +147 -0
- package/skills/integration-testing/examples/test-isolation.md +94 -0
- package/skills/logging-monitoring/SKILL.md +66 -0
- package/skills/mobile-development/SKILL.md +11 -0
- package/skills/mobile-development/responsive/responsive.css +80 -0
- package/skills/performance-optimization/SKILL.md +9 -0
- package/skills/performance-optimization/profiling/profile.template.js +21 -0
- package/skills/receiving-code-review/SKILL.md +209 -0
- package/skills/refactoring/SKILL.md +11 -0
- package/skills/refactoring/code-smells/common-smells.md +115 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/root-cause-tracing/SKILL.md +174 -0
- package/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/skills/security-review/SKILL.md +11 -0
- package/skills/security-review/checklists/owasp-checklist.md +31 -0
- package/skills/sharing-skills/SKILL.md +194 -0
- package/skills/subagent-driven-development/SKILL.md +240 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +295 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +364 -0
- package/skills/testing-anti-patterns/SKILL.md +302 -0
- package/skills/testing-skills-with-subagents/SKILL.md +387 -0
- package/skills/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/ui-ux-review/SKILL.md +13 -0
- package/skills/ui-ux-review/checklists/ux-heuristics.md +61 -0
- package/skills/using-git-worktrees/SKILL.md +213 -0
- package/skills/using-superpowers/SKILL.md +101 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +116 -0
- package/skills/writing-skills/SKILL.md +622 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/update.sh +36 -0
- package/utils/check-superpowers.sh +114 -0
- package/utils/claude-branding.md +166 -0
- package/utils/config.js +185 -0
- package/utils/custom-claude-config.sh +89 -0
- package/utils/custom-claude-hooks.md +129 -0
- package/utils/custom-claude-lib.js +222 -0
- package/utils/customize-claude-ui.sh +162 -0
- package/utils/fix-claude-integration.sh +133 -0
- package/utils/help.js +125 -0
- package/utils/install-curl.ps1 +135 -0
- package/utils/install-curl.sh +525 -0
- package/utils/install-superpowers.js +411 -0
- package/utils/install.js +298 -0
- package/utils/install.sh +182 -0
- package/utils/postinstall.js +63 -0
- package/utils/rename-claude.sh +96 -0
- package/utils/uninstall-superpowers.js +273 -0
- package/utils/uninstall.ps1 +136 -0
- package/utils/uninstall.sh +163 -0
- package/utils/update.sh +160 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Common Code Smells
|
|
2
|
+
|
|
3
|
+
## 1. Long Parameter List
|
|
4
|
+
```javascript
|
|
5
|
+
// Bad
|
|
6
|
+
function createUser(name, email, age, address, phone, role, department, startDate, endDate, salary) {
|
|
7
|
+
// ...
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Good
|
|
11
|
+
function createUser({ name, email, age, address, phone, role, department, startDate, endDate, salary }) {
|
|
12
|
+
// ...
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 2. Duplicate Code
|
|
17
|
+
```javascript
|
|
18
|
+
// Bad
|
|
19
|
+
function processOrderA(order) {
|
|
20
|
+
if (order.total > 100) {
|
|
21
|
+
order.discount = 0.1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function processOrderB(order) {
|
|
26
|
+
if (order.total > 100) {
|
|
27
|
+
order.discount = 0.1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Good
|
|
32
|
+
function applyDiscount(order) {
|
|
33
|
+
if (order.total > 100) {
|
|
34
|
+
order.discount = 0.1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function processOrderA(order) {
|
|
39
|
+
applyDiscount(order);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function processOrderB(order) {
|
|
43
|
+
applyDiscount(order);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 3. Magic Numbers
|
|
48
|
+
```javascript
|
|
49
|
+
// Bad
|
|
50
|
+
if (status === 1) {
|
|
51
|
+
// active
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (timeout > 30000) {
|
|
55
|
+
// error
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Good
|
|
59
|
+
const STATUS = {
|
|
60
|
+
ACTIVE: 1,
|
|
61
|
+
INACTIVE: 2
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const TIMEOUT = 30000;
|
|
65
|
+
|
|
66
|
+
if (status === STATUS.ACTIVE) {
|
|
67
|
+
// active
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (timeout > TIMEOUT) {
|
|
71
|
+
// error
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 4. Large Classes/Methods
|
|
76
|
+
```javascript
|
|
77
|
+
// Bad
|
|
78
|
+
class User {
|
|
79
|
+
// 500 lines of code doing everything
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Good
|
|
83
|
+
class User {
|
|
84
|
+
constructor() {
|
|
85
|
+
this.profile = new UserProfile();
|
|
86
|
+
this.auth = new UserAuth();
|
|
87
|
+
this.notifications = new UserNotifications();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 5. Feature Envy
|
|
93
|
+
```javascript
|
|
94
|
+
// Bad
|
|
95
|
+
class User {
|
|
96
|
+
constructor() {
|
|
97
|
+
this.name = name;
|
|
98
|
+
this.email = email;
|
|
99
|
+
this.saveToDatabase(); // Non-database concerns
|
|
100
|
+
this.sendEmail(); // Notification concerns
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Good
|
|
105
|
+
class User {
|
|
106
|
+
constructor() {
|
|
107
|
+
this.name = name;
|
|
108
|
+
this.email = email;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async save() {
|
|
112
|
+
await this.repository.save(this);
|
|
113
|
+
this.eventEmitter.emit('user-saved', this);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements - dispatches superpowers:code-reviewer subagent to review implementation against plan or requirements before proceeding
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requesting Code Review
|
|
7
|
+
|
|
8
|
+
Dispatch superpowers:code-reviewer subagent to catch issues before they cascade.
|
|
9
|
+
|
|
10
|
+
**Core principle:** Review early, review often.
|
|
11
|
+
|
|
12
|
+
## When to Request Review
|
|
13
|
+
|
|
14
|
+
**Mandatory:**
|
|
15
|
+
- After each task in subagent-driven development
|
|
16
|
+
- After completing major feature
|
|
17
|
+
- Before merge to main
|
|
18
|
+
|
|
19
|
+
**Optional but valuable:**
|
|
20
|
+
- When stuck (fresh perspective)
|
|
21
|
+
- Before refactoring (baseline check)
|
|
22
|
+
- After fixing complex bug
|
|
23
|
+
|
|
24
|
+
## How to Request
|
|
25
|
+
|
|
26
|
+
**1. Get git SHAs:**
|
|
27
|
+
```bash
|
|
28
|
+
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
|
29
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**2. Dispatch code-reviewer subagent:**
|
|
33
|
+
|
|
34
|
+
Use Task tool with superpowers:code-reviewer type, fill template at `code-reviewer.md`
|
|
35
|
+
|
|
36
|
+
**Placeholders:**
|
|
37
|
+
- `{WHAT_WAS_IMPLEMENTED}` - What you just built
|
|
38
|
+
- `{PLAN_OR_REQUIREMENTS}` - What it should do
|
|
39
|
+
- `{BASE_SHA}` - Starting commit
|
|
40
|
+
- `{HEAD_SHA}` - Ending commit
|
|
41
|
+
- `{DESCRIPTION}` - Brief summary
|
|
42
|
+
|
|
43
|
+
**3. Act on feedback:**
|
|
44
|
+
- Fix Critical issues immediately
|
|
45
|
+
- Fix Important issues before proceeding
|
|
46
|
+
- Note Minor issues for later
|
|
47
|
+
- Push back if reviewer is wrong (with reasoning)
|
|
48
|
+
|
|
49
|
+
## Example
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
[Just completed Task 2: Add verification function]
|
|
53
|
+
|
|
54
|
+
You: Let me request code review before proceeding.
|
|
55
|
+
|
|
56
|
+
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
|
|
57
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
58
|
+
|
|
59
|
+
[Dispatch superpowers:code-reviewer subagent]
|
|
60
|
+
WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
|
|
61
|
+
PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
|
|
62
|
+
BASE_SHA: a7981ec
|
|
63
|
+
HEAD_SHA: 3df7661
|
|
64
|
+
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
|
|
65
|
+
|
|
66
|
+
[Subagent returns]:
|
|
67
|
+
Strengths: Clean architecture, real tests
|
|
68
|
+
Issues:
|
|
69
|
+
Important: Missing progress indicators
|
|
70
|
+
Minor: Magic number (100) for reporting interval
|
|
71
|
+
Assessment: Ready to proceed
|
|
72
|
+
|
|
73
|
+
You: [Fix progress indicators]
|
|
74
|
+
[Continue to Task 3]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Integration with Workflows
|
|
78
|
+
|
|
79
|
+
**Subagent-Driven Development:**
|
|
80
|
+
- Review after EACH task
|
|
81
|
+
- Catch issues before they compound
|
|
82
|
+
- Fix before moving to next task
|
|
83
|
+
|
|
84
|
+
**Executing Plans:**
|
|
85
|
+
- Review after each batch (3 tasks)
|
|
86
|
+
- Get feedback, apply, continue
|
|
87
|
+
|
|
88
|
+
**Ad-Hoc Development:**
|
|
89
|
+
- Review before merge
|
|
90
|
+
- Review when stuck
|
|
91
|
+
|
|
92
|
+
## Red Flags
|
|
93
|
+
|
|
94
|
+
**Never:**
|
|
95
|
+
- Skip review because "it's simple"
|
|
96
|
+
- Ignore Critical issues
|
|
97
|
+
- Proceed with unfixed Important issues
|
|
98
|
+
- Argue with valid technical feedback
|
|
99
|
+
|
|
100
|
+
**If reviewer wrong:**
|
|
101
|
+
- Push back with technical reasoning
|
|
102
|
+
- Show code/tests that prove it works
|
|
103
|
+
- Request clarification
|
|
104
|
+
|
|
105
|
+
See template at: requesting-code-review/code-reviewer.md
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Code Review Agent
|
|
2
|
+
|
|
3
|
+
You are reviewing code changes for production readiness.
|
|
4
|
+
|
|
5
|
+
**Your task:**
|
|
6
|
+
1. Review {WHAT_WAS_IMPLEMENTED}
|
|
7
|
+
2. Compare against {PLAN_OR_REQUIREMENTS}
|
|
8
|
+
3. Check code quality, architecture, testing
|
|
9
|
+
4. Categorize issues by severity
|
|
10
|
+
5. Assess production readiness
|
|
11
|
+
|
|
12
|
+
## What Was Implemented
|
|
13
|
+
|
|
14
|
+
{DESCRIPTION}
|
|
15
|
+
|
|
16
|
+
## Requirements/Plan
|
|
17
|
+
|
|
18
|
+
{PLAN_REFERENCE}
|
|
19
|
+
|
|
20
|
+
## Git Range to Review
|
|
21
|
+
|
|
22
|
+
**Base:** {BASE_SHA}
|
|
23
|
+
**Head:** {HEAD_SHA}
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git diff --stat {BASE_SHA}..{HEAD_SHA}
|
|
27
|
+
git diff {BASE_SHA}..{HEAD_SHA}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Review Checklist
|
|
31
|
+
|
|
32
|
+
**Code Quality:**
|
|
33
|
+
- Clean separation of concerns?
|
|
34
|
+
- Proper error handling?
|
|
35
|
+
- Type safety (if applicable)?
|
|
36
|
+
- DRY principle followed?
|
|
37
|
+
- Edge cases handled?
|
|
38
|
+
|
|
39
|
+
**Architecture:**
|
|
40
|
+
- Sound design decisions?
|
|
41
|
+
- Scalability considerations?
|
|
42
|
+
- Performance implications?
|
|
43
|
+
- Security concerns?
|
|
44
|
+
|
|
45
|
+
**Testing:**
|
|
46
|
+
- Tests actually test logic (not mocks)?
|
|
47
|
+
- Edge cases covered?
|
|
48
|
+
- Integration tests where needed?
|
|
49
|
+
- All tests passing?
|
|
50
|
+
|
|
51
|
+
**Requirements:**
|
|
52
|
+
- All plan requirements met?
|
|
53
|
+
- Implementation matches spec?
|
|
54
|
+
- No scope creep?
|
|
55
|
+
- Breaking changes documented?
|
|
56
|
+
|
|
57
|
+
**Production Readiness:**
|
|
58
|
+
- Migration strategy (if schema changes)?
|
|
59
|
+
- Backward compatibility considered?
|
|
60
|
+
- Documentation complete?
|
|
61
|
+
- No obvious bugs?
|
|
62
|
+
|
|
63
|
+
## Output Format
|
|
64
|
+
|
|
65
|
+
### Strengths
|
|
66
|
+
[What's well done? Be specific.]
|
|
67
|
+
|
|
68
|
+
### Issues
|
|
69
|
+
|
|
70
|
+
#### Critical (Must Fix)
|
|
71
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
72
|
+
|
|
73
|
+
#### Important (Should Fix)
|
|
74
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
75
|
+
|
|
76
|
+
#### Minor (Nice to Have)
|
|
77
|
+
[Code style, optimization opportunities, documentation improvements]
|
|
78
|
+
|
|
79
|
+
**For each issue:**
|
|
80
|
+
- File:line reference
|
|
81
|
+
- What's wrong
|
|
82
|
+
- Why it matters
|
|
83
|
+
- How to fix (if not obvious)
|
|
84
|
+
|
|
85
|
+
### Recommendations
|
|
86
|
+
[Improvements for code quality, architecture, or process]
|
|
87
|
+
|
|
88
|
+
### Assessment
|
|
89
|
+
|
|
90
|
+
**Ready to merge?** [Yes/No/With fixes]
|
|
91
|
+
|
|
92
|
+
**Reasoning:** [Technical assessment in 1-2 sentences]
|
|
93
|
+
|
|
94
|
+
## Critical Rules
|
|
95
|
+
|
|
96
|
+
**DO:**
|
|
97
|
+
- Categorize by actual severity (not everything is Critical)
|
|
98
|
+
- Be specific (file:line, not vague)
|
|
99
|
+
- Explain WHY issues matter
|
|
100
|
+
- Acknowledge strengths
|
|
101
|
+
- Give clear verdict
|
|
102
|
+
|
|
103
|
+
**DON'T:**
|
|
104
|
+
- Say "looks good" without checking
|
|
105
|
+
- Mark nitpicks as Critical
|
|
106
|
+
- Give feedback on code you didn't review
|
|
107
|
+
- Be vague ("improve error handling")
|
|
108
|
+
- Avoid giving a clear verdict
|
|
109
|
+
|
|
110
|
+
## Example Output
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
### Strengths
|
|
114
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
115
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
116
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
117
|
+
|
|
118
|
+
### Issues
|
|
119
|
+
|
|
120
|
+
#### Important
|
|
121
|
+
1. **Missing help text in CLI wrapper**
|
|
122
|
+
- File: index-conversations:1-31
|
|
123
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
124
|
+
- Fix: Add --help case with usage examples
|
|
125
|
+
|
|
126
|
+
2. **Date validation missing**
|
|
127
|
+
- File: search.ts:25-27
|
|
128
|
+
- Issue: Invalid dates silently return no results
|
|
129
|
+
- Fix: Validate ISO format, throw error with example
|
|
130
|
+
|
|
131
|
+
#### Minor
|
|
132
|
+
1. **Progress indicators**
|
|
133
|
+
- File: indexer.ts:130
|
|
134
|
+
- Issue: No "X of Y" counter for long operations
|
|
135
|
+
- Impact: Users don't know how long to wait
|
|
136
|
+
|
|
137
|
+
### Recommendations
|
|
138
|
+
- Add progress reporting for user experience
|
|
139
|
+
- Consider config file for excluded projects (portability)
|
|
140
|
+
|
|
141
|
+
### Assessment
|
|
142
|
+
|
|
143
|
+
**Ready to merge: With fixes**
|
|
144
|
+
|
|
145
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
146
|
+
```
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: root-cause-tracing
|
|
3
|
+
description: Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Root Cause Tracing
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
```dot
|
|
17
|
+
digraph when_to_use {
|
|
18
|
+
"Bug appears deep in stack?" [shape=diamond];
|
|
19
|
+
"Can trace backwards?" [shape=diamond];
|
|
20
|
+
"Fix at symptom point" [shape=box];
|
|
21
|
+
"Trace to original trigger" [shape=box];
|
|
22
|
+
"BETTER: Also add defense-in-depth" [shape=box];
|
|
23
|
+
|
|
24
|
+
"Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
|
|
25
|
+
"Can trace backwards?" -> "Trace to original trigger" [label="yes"];
|
|
26
|
+
"Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
|
|
27
|
+
"Trace to original trigger" -> "BETTER: Also add defense-in-depth";
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Use when:**
|
|
32
|
+
- Error happens deep in execution (not at entry point)
|
|
33
|
+
- Stack trace shows long call chain
|
|
34
|
+
- Unclear where invalid data originated
|
|
35
|
+
- Need to find which test/code triggers the problem
|
|
36
|
+
|
|
37
|
+
## The Tracing Process
|
|
38
|
+
|
|
39
|
+
### 1. Observe the Symptom
|
|
40
|
+
```
|
|
41
|
+
Error: git init failed in /Users/jesse/project/packages/core
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Find Immediate Cause
|
|
45
|
+
**What code directly causes this?**
|
|
46
|
+
```typescript
|
|
47
|
+
await execFileAsync('git', ['init'], { cwd: projectDir });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Ask: What Called This?
|
|
51
|
+
```typescript
|
|
52
|
+
WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
53
|
+
→ called by Session.initializeWorkspace()
|
|
54
|
+
→ called by Session.create()
|
|
55
|
+
→ called by test at Project.create()
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Keep Tracing Up
|
|
59
|
+
**What value was passed?**
|
|
60
|
+
- `projectDir = ''` (empty string!)
|
|
61
|
+
- Empty string as `cwd` resolves to `process.cwd()`
|
|
62
|
+
- That's the source code directory!
|
|
63
|
+
|
|
64
|
+
### 5. Find Original Trigger
|
|
65
|
+
**Where did empty string come from?**
|
|
66
|
+
```typescript
|
|
67
|
+
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
68
|
+
Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Adding Stack Traces
|
|
72
|
+
|
|
73
|
+
When you can't trace manually, add instrumentation:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// Before the problematic operation
|
|
77
|
+
async function gitInit(directory: string) {
|
|
78
|
+
const stack = new Error().stack;
|
|
79
|
+
console.error('DEBUG git init:', {
|
|
80
|
+
directory,
|
|
81
|
+
cwd: process.cwd(),
|
|
82
|
+
nodeEnv: process.env.NODE_ENV,
|
|
83
|
+
stack,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
await execFileAsync('git', ['init'], { cwd: directory });
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Critical:** Use `console.error()` in tests (not logger - may not show)
|
|
91
|
+
|
|
92
|
+
**Run and capture:**
|
|
93
|
+
```bash
|
|
94
|
+
npm test 2>&1 | grep 'DEBUG git init'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Analyze stack traces:**
|
|
98
|
+
- Look for test file names
|
|
99
|
+
- Find the line number triggering the call
|
|
100
|
+
- Identify the pattern (same test? same parameter?)
|
|
101
|
+
|
|
102
|
+
## Finding Which Test Causes Pollution
|
|
103
|
+
|
|
104
|
+
If something appears during tests but you don't know which test:
|
|
105
|
+
|
|
106
|
+
Use the bisection script: @find-polluter.sh
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Runs tests one-by-one, stops at first polluter. See script for usage.
|
|
113
|
+
|
|
114
|
+
## Real Example: Empty projectDir
|
|
115
|
+
|
|
116
|
+
**Symptom:** `.git` created in `packages/core/` (source code)
|
|
117
|
+
|
|
118
|
+
**Trace chain:**
|
|
119
|
+
1. `git init` runs in `process.cwd()` ← empty cwd parameter
|
|
120
|
+
2. WorktreeManager called with empty projectDir
|
|
121
|
+
3. Session.create() passed empty string
|
|
122
|
+
4. Test accessed `context.tempDir` before beforeEach
|
|
123
|
+
5. setupCoreTest() returns `{ tempDir: '' }` initially
|
|
124
|
+
|
|
125
|
+
**Root cause:** Top-level variable initialization accessing empty value
|
|
126
|
+
|
|
127
|
+
**Fix:** Made tempDir a getter that throws if accessed before beforeEach
|
|
128
|
+
|
|
129
|
+
**Also added defense-in-depth:**
|
|
130
|
+
- Layer 1: Project.create() validates directory
|
|
131
|
+
- Layer 2: WorkspaceManager validates not empty
|
|
132
|
+
- Layer 3: NODE_ENV guard refuses git init outside tmpdir
|
|
133
|
+
- Layer 4: Stack trace logging before git init
|
|
134
|
+
|
|
135
|
+
## Key Principle
|
|
136
|
+
|
|
137
|
+
```dot
|
|
138
|
+
digraph principle {
|
|
139
|
+
"Found immediate cause" [shape=ellipse];
|
|
140
|
+
"Can trace one level up?" [shape=diamond];
|
|
141
|
+
"Trace backwards" [shape=box];
|
|
142
|
+
"Is this the source?" [shape=diamond];
|
|
143
|
+
"Fix at source" [shape=box];
|
|
144
|
+
"Add validation at each layer" [shape=box];
|
|
145
|
+
"Bug impossible" [shape=doublecircle];
|
|
146
|
+
"NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
|
|
147
|
+
|
|
148
|
+
"Found immediate cause" -> "Can trace one level up?";
|
|
149
|
+
"Can trace one level up?" -> "Trace backwards" [label="yes"];
|
|
150
|
+
"Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
|
|
151
|
+
"Trace backwards" -> "Is this the source?";
|
|
152
|
+
"Is this the source?" -> "Trace backwards" [label="no - keeps going"];
|
|
153
|
+
"Is this the source?" -> "Fix at source" [label="yes"];
|
|
154
|
+
"Fix at source" -> "Add validation at each layer";
|
|
155
|
+
"Add validation at each layer" -> "Bug impossible";
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**NEVER fix just where the error appears.** Trace back to find the original trigger.
|
|
160
|
+
|
|
161
|
+
## Stack Trace Tips
|
|
162
|
+
|
|
163
|
+
**In tests:** Use `console.error()` not logger - logger may be suppressed
|
|
164
|
+
**Before operation:** Log before the dangerous operation, not after it fails
|
|
165
|
+
**Include context:** Directory, cwd, environment variables, timestamps
|
|
166
|
+
**Capture stack:** `new Error().stack` shows complete call chain
|
|
167
|
+
|
|
168
|
+
## Real-World Impact
|
|
169
|
+
|
|
170
|
+
From debugging session (2025-10-03):
|
|
171
|
+
- Found root cause through 5-level trace
|
|
172
|
+
- Fixed at source (getter validation)
|
|
173
|
+
- Added 4 layers of defense
|
|
174
|
+
- 1847 tests passed, zero pollution
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Bisection script to find which test creates unwanted files/state
|
|
3
|
+
# Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
|
|
4
|
+
# Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
if [ $# -ne 2 ]; then
|
|
9
|
+
echo "Usage: $0 <file_to_check> <test_pattern>"
|
|
10
|
+
echo "Example: $0 '.git' 'src/**/*.test.ts'"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
POLLUTION_CHECK="$1"
|
|
15
|
+
TEST_PATTERN="$2"
|
|
16
|
+
|
|
17
|
+
echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
|
|
18
|
+
echo "Test pattern: $TEST_PATTERN"
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
# Get list of test files
|
|
22
|
+
TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
|
|
23
|
+
TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
|
|
24
|
+
|
|
25
|
+
echo "Found $TOTAL test files"
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
COUNT=0
|
|
29
|
+
for TEST_FILE in $TEST_FILES; do
|
|
30
|
+
COUNT=$((COUNT + 1))
|
|
31
|
+
|
|
32
|
+
# Skip if pollution already exists
|
|
33
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
34
|
+
echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
|
|
35
|
+
echo " Skipping: $TEST_FILE"
|
|
36
|
+
continue
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
|
|
40
|
+
|
|
41
|
+
# Run the test
|
|
42
|
+
npm test "$TEST_FILE" > /dev/null 2>&1 || true
|
|
43
|
+
|
|
44
|
+
# Check if pollution appeared
|
|
45
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
46
|
+
echo ""
|
|
47
|
+
echo "🎯 FOUND POLLUTER!"
|
|
48
|
+
echo " Test: $TEST_FILE"
|
|
49
|
+
echo " Created: $POLLUTION_CHECK"
|
|
50
|
+
echo ""
|
|
51
|
+
echo "Pollution details:"
|
|
52
|
+
ls -la "$POLLUTION_CHECK"
|
|
53
|
+
echo ""
|
|
54
|
+
echo "To investigate:"
|
|
55
|
+
echo " npm test $TEST_FILE # Run just this test"
|
|
56
|
+
echo " cat $TEST_FILE # Review test code"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
done
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo "✅ No polluter found - all tests clean!"
|
|
63
|
+
exit 0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
security-review skill helps identify and mitigate security vulnerabilities in code through systematic security analysis using OWASP guidelines.
|
|
2
|
+
|
|
3
|
+
For code review, check that:
|
|
4
|
+
1. Input validation is implemented for all user inputs
|
|
5
|
+
2. Authentication and authorization are properly implemented
|
|
6
|
+
3. SQL injection prevention is in place
|
|
7
|
+
4. XSS protection is implemented
|
|
8
|
+
5. CSRF tokens are used for state-changing operations
|
|
9
|
+
6. Sensitive data is encrypted at rest and in transit
|
|
10
|
+
7. Security headers are properly configured
|
|
11
|
+
8. Dependency vulnerability scans have been run
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# OWASP Security Checklist
|
|
2
|
+
|
|
3
|
+
## Input Validation
|
|
4
|
+
- [ ] All inputs are validated
|
|
5
|
+
- [ ] Whitelisting is used instead of blacklisting
|
|
6
|
+
- [ ] Length limits are enforced
|
|
7
|
+
- [ ] Special characters are escaped
|
|
8
|
+
|
|
9
|
+
## Authentication & Authorization
|
|
10
|
+
- [ ] Password requirements are enforced
|
|
11
|
+
- [ ] Multi-factor authentication is implemented
|
|
12
|
+
- [ ] Session management is secure
|
|
13
|
+
- [ ] Authorization checks are performed on all endpoints
|
|
14
|
+
|
|
15
|
+
## Injection Prevention
|
|
16
|
+
- [ ] Parameterized queries are used
|
|
17
|
+
- [ ] ORM is used with proper escaping
|
|
18
|
+
- [ ] Input encoding is performed
|
|
19
|
+
- [ ] Stored procedures are used when appropriate
|
|
20
|
+
|
|
21
|
+
## XSS Protection
|
|
22
|
+
- [ ] Output encoding is implemented
|
|
23
|
+
- [ ] Content Security Policy is set
|
|
24
|
+
- [ ] HttpOnly cookies are used
|
|
25
|
+
- [ ] Framework's XSS protection is enabled
|
|
26
|
+
|
|
27
|
+
## CSRF Protection
|
|
28
|
+
- [ ] Anti-CSRF tokens are implemented
|
|
29
|
+
- [ ] SameSite cookie attribute is set
|
|
30
|
+
- [ ] Referer checking is implemented
|
|
31
|
+
- [ ] Double submit cookies are used
|