@uniswap/ai-toolkit-nx-claude 0.5.29 → 0.5.30-next.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/dist/cli-generator.cjs +28 -59
- package/dist/packages/ai-toolkit-nx-claude/src/cli-generator.d.ts +8 -10
- package/dist/packages/ai-toolkit-nx-claude/src/cli-generator.d.ts.map +1 -1
- package/dist/packages/ai-toolkit-nx-claude/src/index.d.ts +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/index.d.ts.map +1 -1
- package/generators.json +0 -15
- package/package.json +4 -35
- package/dist/content/agents/agnostic/CLAUDE.md +0 -282
- package/dist/content/agents/agnostic/agent-capability-analyst.md +0 -575
- package/dist/content/agents/agnostic/agent-optimizer.md +0 -396
- package/dist/content/agents/agnostic/agent-orchestrator.md +0 -475
- package/dist/content/agents/agnostic/cicd-agent.md +0 -301
- package/dist/content/agents/agnostic/claude-agent-discovery.md +0 -304
- package/dist/content/agents/agnostic/claude-docs-fact-checker.md +0 -435
- package/dist/content/agents/agnostic/claude-docs-initializer.md +0 -782
- package/dist/content/agents/agnostic/claude-docs-manager.md +0 -595
- package/dist/content/agents/agnostic/code-explainer.md +0 -269
- package/dist/content/agents/agnostic/code-generator.md +0 -785
- package/dist/content/agents/agnostic/commit-message-generator.md +0 -101
- package/dist/content/agents/agnostic/context-loader.md +0 -432
- package/dist/content/agents/agnostic/debug-assistant.md +0 -321
- package/dist/content/agents/agnostic/doc-writer.md +0 -536
- package/dist/content/agents/agnostic/feedback-collector.md +0 -165
- package/dist/content/agents/agnostic/infrastructure-agent.md +0 -406
- package/dist/content/agents/agnostic/migration-assistant.md +0 -489
- package/dist/content/agents/agnostic/pattern-learner.md +0 -481
- package/dist/content/agents/agnostic/performance-analyzer.md +0 -528
- package/dist/content/agents/agnostic/plan-reviewer.md +0 -173
- package/dist/content/agents/agnostic/planner.md +0 -235
- package/dist/content/agents/agnostic/pr-creator.md +0 -498
- package/dist/content/agents/agnostic/pr-reviewer.md +0 -142
- package/dist/content/agents/agnostic/prompt-engineer.md +0 -541
- package/dist/content/agents/agnostic/refactorer.md +0 -311
- package/dist/content/agents/agnostic/researcher.md +0 -349
- package/dist/content/agents/agnostic/security-analyzer.md +0 -1087
- package/dist/content/agents/agnostic/stack-splitter.md +0 -642
- package/dist/content/agents/agnostic/style-enforcer.md +0 -568
- package/dist/content/agents/agnostic/test-runner.md +0 -481
- package/dist/content/agents/agnostic/test-writer.md +0 -292
- package/dist/content/commands/agnostic/CLAUDE.md +0 -207
- package/dist/content/commands/agnostic/address-pr-issues.md +0 -205
- package/dist/content/commands/agnostic/auto-spec.md +0 -386
- package/dist/content/commands/agnostic/claude-docs.md +0 -409
- package/dist/content/commands/agnostic/claude-init-plus.md +0 -439
- package/dist/content/commands/agnostic/create-pr.md +0 -79
- package/dist/content/commands/agnostic/daily-standup.md +0 -185
- package/dist/content/commands/agnostic/deploy.md +0 -441
- package/dist/content/commands/agnostic/execute-plan.md +0 -167
- package/dist/content/commands/agnostic/explain-file.md +0 -303
- package/dist/content/commands/agnostic/explore.md +0 -82
- package/dist/content/commands/agnostic/fix-bug.md +0 -273
- package/dist/content/commands/agnostic/gen-tests.md +0 -185
- package/dist/content/commands/agnostic/generate-commit-message.md +0 -92
- package/dist/content/commands/agnostic/git-worktree-orchestrator.md +0 -647
- package/dist/content/commands/agnostic/implement-spec.md +0 -270
- package/dist/content/commands/agnostic/monitor.md +0 -581
- package/dist/content/commands/agnostic/perf-analyze.md +0 -214
- package/dist/content/commands/agnostic/plan.md +0 -453
- package/dist/content/commands/agnostic/refactor.md +0 -315
- package/dist/content/commands/agnostic/refine-linear-task.md +0 -575
- package/dist/content/commands/agnostic/research.md +0 -49
- package/dist/content/commands/agnostic/review-code.md +0 -321
- package/dist/content/commands/agnostic/review-plan.md +0 -109
- package/dist/content/commands/agnostic/review-pr.md +0 -393
- package/dist/content/commands/agnostic/split-stack.md +0 -705
- package/dist/content/commands/agnostic/update-claude-md.md +0 -401
- package/dist/content/commands/agnostic/work-through-pr-comments.md +0 -873
- package/dist/generators/add-agent/CLAUDE.md +0 -130
- package/dist/generators/add-agent/files/__name__.md.template +0 -37
- package/dist/generators/add-agent/generator.cjs +0 -640
- package/dist/generators/add-agent/schema.json +0 -59
- package/dist/generators/add-command/CLAUDE.md +0 -131
- package/dist/generators/add-command/files/__name__.md.template +0 -46
- package/dist/generators/add-command/generator.cjs +0 -643
- package/dist/generators/add-command/schema.json +0 -50
- package/dist/generators/files/src/index.ts.template +0 -1
- package/dist/generators/init/CLAUDE.md +0 -520
- package/dist/generators/init/generator.cjs +0 -3304
- package/dist/generators/init/schema.json +0 -180
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-agent/generator.d.ts +0 -5
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-agent/generator.d.ts.map +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-command/generator.d.ts +0 -5
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-command/generator.d.ts.map +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/generators/init/generator.d.ts +0 -5
- package/dist/packages/ai-toolkit-nx-claude/src/generators/init/generator.d.ts.map +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/utils/auto-update-utils.d.ts +0 -30
- package/dist/packages/ai-toolkit-nx-claude/src/utils/auto-update-utils.d.ts.map +0 -1
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Comprehensive code explanation using multi-agent analysis for architecture, patterns, security, and performance insights.
|
|
3
|
-
argument-hint: <path|glob> [--depth overview|deep|architectural] [--focus patterns|security|performance|all]
|
|
4
|
-
allowed-tools: Read(*), Grep(*), Bash(git show:*), Bash(git ls-files:*), Task(subagent_type:code-explainer), Task(subagent_type:security-analyzer), Task(subagent_type:performance-analyzer), Task(subagent_type:context-loader)
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Inputs
|
|
8
|
-
|
|
9
|
-
Parse arguments from `$ARGUMENTS`:
|
|
10
|
-
|
|
11
|
-
- **path**: File path, directory, or glob pattern (required)
|
|
12
|
-
- **--depth**: Analysis depth (overview|deep|architectural) - default: overview
|
|
13
|
-
- **--focus**: Specific aspects to emphasize (patterns|security|performance|all) - default: all
|
|
14
|
-
- **--compare**: Compare with another file/version for diff analysis
|
|
15
|
-
- **--context**: Include surrounding context analysis (default: true for deep/architectural)
|
|
16
|
-
|
|
17
|
-
Examples:
|
|
18
|
-
|
|
19
|
-
- `/explain-file src/auth/login.ts`
|
|
20
|
-
- `/explain-file src/api/*.ts --depth deep --focus security`
|
|
21
|
-
- `/explain-file src/core/ --depth architectural`
|
|
22
|
-
- `/explain-file src/utils/validator.ts --compare src/utils/validator.old.ts`
|
|
23
|
-
|
|
24
|
-
## Task
|
|
25
|
-
|
|
26
|
-
Provide comprehensive code explanation through multi-agent analysis:
|
|
27
|
-
|
|
28
|
-
1. **Code Structure Analysis**: Understand architecture and design patterns
|
|
29
|
-
2. **Dependency Mapping**: Trace imports and external dependencies
|
|
30
|
-
3. **Risk Assessment**: Identify potential issues and vulnerabilities
|
|
31
|
-
4. **Performance Analysis**: Evaluate computational complexity
|
|
32
|
-
5. **Pattern Recognition**: Identify design patterns and anti-patterns
|
|
33
|
-
|
|
34
|
-
## Orchestration Strategy
|
|
35
|
-
|
|
36
|
-
### Single File Analysis (Default)
|
|
37
|
-
|
|
38
|
-
For simple file explanations, direct delegation:
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
{
|
|
42
|
-
agent: "code-explainer",
|
|
43
|
-
params: {
|
|
44
|
-
path: parsedPath,
|
|
45
|
-
depth: depth,
|
|
46
|
-
focus: ["structure", "patterns", "risks"]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Deep Analysis (--depth deep)
|
|
52
|
-
|
|
53
|
-
Coordinate multiple specialized agents:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
{
|
|
57
|
-
parallel: [
|
|
58
|
-
{
|
|
59
|
-
agent: 'code-explainer',
|
|
60
|
-
focus: 'architecture-and-patterns',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
agent: 'security-analyzer',
|
|
64
|
-
focus: 'vulnerability-assessment',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
agent: 'performance-analyzer',
|
|
68
|
-
focus: 'complexity-analysis',
|
|
69
|
-
},
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Architectural Analysis (--depth architectural)
|
|
75
|
-
|
|
76
|
-
Full system context analysis:
|
|
77
|
-
|
|
78
|
-
1. **Context Loading Phase**:
|
|
79
|
-
|
|
80
|
-
- Invoke **context-loader** to map surrounding architecture
|
|
81
|
-
- Identify integration points and dependencies
|
|
82
|
-
- Build system-level understanding
|
|
83
|
-
|
|
84
|
-
2. **Multi-Agent Analysis**:
|
|
85
|
-
- **code-explainer**: Core functionality and patterns
|
|
86
|
-
- **security-analyzer**: Security boundaries and risks
|
|
87
|
-
- **performance-analyzer**: Scalability implications
|
|
88
|
-
- **refactorer**: Improvement opportunities
|
|
89
|
-
|
|
90
|
-
## Output Format
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
{
|
|
94
|
-
summary: {
|
|
95
|
-
purpose: string; // Primary responsibility
|
|
96
|
-
complexity: 'simple' | 'moderate' | 'complex' | 'highly-complex';
|
|
97
|
-
loc: number; // Lines of code
|
|
98
|
-
maintainability: number; // Score 0-100
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
architecture: {
|
|
102
|
-
patterns: Array<{
|
|
103
|
-
pattern: string; // e.g., "Singleton", "Factory", "Observer"
|
|
104
|
-
location: string; // Where in the code
|
|
105
|
-
implementation: string; // How it's implemented
|
|
106
|
-
quality: 'excellent' | 'good' | 'acceptable' | 'needs-improvement';
|
|
107
|
-
}>;
|
|
108
|
-
structure: {
|
|
109
|
-
layers: string[]; // Architectural layers detected
|
|
110
|
-
components: Array<{
|
|
111
|
-
name: string;
|
|
112
|
-
responsibility: string;
|
|
113
|
-
dependencies: string[];
|
|
114
|
-
}>;
|
|
115
|
-
coupling: 'loose' | 'moderate' | 'tight';
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
functionality: {
|
|
120
|
-
mainPurpose: string;
|
|
121
|
-
keyFeatures: string[];
|
|
122
|
-
dataFlow: Array<{
|
|
123
|
-
input: string;
|
|
124
|
-
processing: string;
|
|
125
|
-
output: string;
|
|
126
|
-
}>;
|
|
127
|
-
sideEffects: string[]; // External state changes
|
|
128
|
-
invariants: string[]; // Conditions that must always hold
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
dependencies: {
|
|
132
|
-
imports: Array<{
|
|
133
|
-
module: string;
|
|
134
|
-
type: 'external' | 'internal' | 'relative';
|
|
135
|
-
usage: string;
|
|
136
|
-
risk: 'low' | 'medium' | 'high';
|
|
137
|
-
}>;
|
|
138
|
-
exports: Array<{
|
|
139
|
-
name: string;
|
|
140
|
-
type: string;
|
|
141
|
-
consumers: string[]; // Who uses this export
|
|
142
|
-
}>;
|
|
143
|
-
circular: string[]; // Any circular dependencies detected
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
risks: {
|
|
147
|
-
security: Array<{
|
|
148
|
-
type: string; // e.g., "SQL Injection", "XSS"
|
|
149
|
-
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
150
|
-
location: string;
|
|
151
|
-
mitigation: string;
|
|
152
|
-
}>;
|
|
153
|
-
performance: Array<{
|
|
154
|
-
issue: string; // e.g., "N+1 queries", "Memory leak"
|
|
155
|
-
impact: 'high' | 'medium' | 'low';
|
|
156
|
-
location: string;
|
|
157
|
-
suggestion: string;
|
|
158
|
-
}>;
|
|
159
|
-
maintainability: Array<{
|
|
160
|
-
issue: string; // e.g., "High complexity", "Code duplication"
|
|
161
|
-
metric: string; // Specific metric violated
|
|
162
|
-
suggestion: string;
|
|
163
|
-
}>;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
improvements: {
|
|
167
|
-
immediate: string[]; // Quick wins
|
|
168
|
-
refactoring: Array<{
|
|
169
|
-
type: string; // e.g., "Extract method", "Introduce parameter object"
|
|
170
|
-
rationale: string;
|
|
171
|
-
effort: 'low' | 'medium' | 'high';
|
|
172
|
-
impact: 'low' | 'medium' | 'high';
|
|
173
|
-
}>;
|
|
174
|
-
architectural: string[]; // Larger structural improvements
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
testing: {
|
|
178
|
-
coverage: number; // Estimated test coverage
|
|
179
|
-
testability: 'high' | 'medium' | 'low';
|
|
180
|
-
suggestedTests: string[]; // Types of tests needed
|
|
181
|
-
mockingStrategy: string; // How to mock dependencies
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
documentation: {
|
|
185
|
-
inline: 'comprehensive' | 'adequate' | 'minimal' | 'missing';
|
|
186
|
-
publicApi: boolean; // Has public API documentation
|
|
187
|
-
examples: boolean; // Has usage examples
|
|
188
|
-
suggestions: string[]; // Documentation improvements
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Specialized Analysis Modes
|
|
194
|
-
|
|
195
|
-
### Pattern Focus
|
|
196
|
-
|
|
197
|
-
When `--focus patterns`:
|
|
198
|
-
|
|
199
|
-
- Emphasize design pattern identification
|
|
200
|
-
- Analyze SOLID principle compliance
|
|
201
|
-
- Identify anti-patterns and code smells
|
|
202
|
-
- Suggest pattern-based refactoring
|
|
203
|
-
|
|
204
|
-
### Security Focus
|
|
205
|
-
|
|
206
|
-
When `--focus security`:
|
|
207
|
-
|
|
208
|
-
- Deep vulnerability scanning
|
|
209
|
-
- Input validation analysis
|
|
210
|
-
- Authentication/authorization review
|
|
211
|
-
- Dependency vulnerability check
|
|
212
|
-
- Sensitive data handling
|
|
213
|
-
|
|
214
|
-
### Performance Focus
|
|
215
|
-
|
|
216
|
-
When `--focus performance`:
|
|
217
|
-
|
|
218
|
-
- Algorithm complexity analysis (Big O)
|
|
219
|
-
- Memory usage patterns
|
|
220
|
-
- Database query optimization
|
|
221
|
-
- Caching opportunities
|
|
222
|
-
- Async/concurrent processing
|
|
223
|
-
|
|
224
|
-
## Comparison Mode
|
|
225
|
-
|
|
226
|
-
When `--compare` is specified:
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
{
|
|
230
|
-
comparison: {
|
|
231
|
-
added: string[]; // New functionality
|
|
232
|
-
removed: string[]; // Deleted functionality
|
|
233
|
-
modified: Array<{
|
|
234
|
-
component: string;
|
|
235
|
-
before: string;
|
|
236
|
-
after: string;
|
|
237
|
-
impact: string;
|
|
238
|
-
}>;
|
|
239
|
-
improvements: string[]; // Positive changes
|
|
240
|
-
regressions: string[]; // Negative changes
|
|
241
|
-
riskDelta: 'increased' | 'decreased' | 'unchanged';
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
## Examples
|
|
247
|
-
|
|
248
|
-
### Basic File Explanation
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
/explain-file src/utils/validator.ts
|
|
252
|
-
# Quick overview of the validator utility
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Deep Security Analysis
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
/explain-file src/api/auth.ts --depth deep --focus security
|
|
259
|
-
# Comprehensive security analysis of authentication code
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Architectural Analysis
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
/explain-file src/core/ --depth architectural
|
|
266
|
-
# Full architectural analysis of core module
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Comparison Analysis
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
/explain-file src/service.ts --compare main:src/service.ts
|
|
273
|
-
# Compare current version with main branch
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
## Integration Points
|
|
277
|
-
|
|
278
|
-
### IDE Integration
|
|
279
|
-
|
|
280
|
-
- Hover explanations for complex code
|
|
281
|
-
- Inline risk indicators
|
|
282
|
-
- Architecture visualization
|
|
283
|
-
|
|
284
|
-
### Documentation Generation
|
|
285
|
-
|
|
286
|
-
- Auto-generate API documentation
|
|
287
|
-
- Create architecture diagrams
|
|
288
|
-
- Generate README sections
|
|
289
|
-
|
|
290
|
-
### Code Review
|
|
291
|
-
|
|
292
|
-
- Automated explanation for reviewers
|
|
293
|
-
- Risk assessment for changes
|
|
294
|
-
- Pattern compliance checking
|
|
295
|
-
|
|
296
|
-
## Best Practices
|
|
297
|
-
|
|
298
|
-
1. **Start Simple**: Use overview mode for quick understanding
|
|
299
|
-
2. **Deep Dive Strategically**: Use deep analysis for critical code
|
|
300
|
-
3. **Focus Areas**: Use focused analysis for specific concerns
|
|
301
|
-
4. **Regular Analysis**: Run on changed files during review
|
|
302
|
-
5. **Document Findings**: Save architectural analyses for onboarding
|
|
303
|
-
6. **Track Improvements**: Monitor risk scores over time
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Deep dive into a codebase area to build comprehensive understanding before creating and implementing a plan.
|
|
3
|
-
argument-hint: <natural language description of what you want to understand>
|
|
4
|
-
allowed-tools: Bash(git ls-files:*), Bash(find:*), Fetch(*), Bash(git log:*), Bash(git show:*), Bash(npx nx graph:*)
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Inputs
|
|
8
|
-
|
|
9
|
-
Accept natural language description and intelligently extract:
|
|
10
|
-
|
|
11
|
-
- `topic`: The main area/feature/component (inferred from the description)
|
|
12
|
-
- `files`: Specific files mentioned (look for file paths with extensions)
|
|
13
|
-
- `focus`: Specific aspects emphasized (e.g., "focusing on X", "especially Y", "particularly Z")
|
|
14
|
-
|
|
15
|
-
Examples:
|
|
16
|
-
|
|
17
|
-
- `/explore authentication system`
|
|
18
|
-
- `/explore I want to understand the scrapers, especially error handling`
|
|
19
|
-
- `/explore show me how the data pipeline works in src/pipeline.ts and src/transform.ts`
|
|
20
|
-
- `/explore explain the Nx configuration focusing on package dependencies`
|
|
21
|
-
|
|
22
|
-
## Task
|
|
23
|
-
|
|
24
|
-
Build a comprehensive mental model of the specified codebase area:
|
|
25
|
-
|
|
26
|
-
1. Map out the relevant files and directory structure
|
|
27
|
-
2. Understand the architecture and design patterns
|
|
28
|
-
3. Identify dependencies and integration points
|
|
29
|
-
4. Note conventions, gotchas, and edge cases
|
|
30
|
-
5. Prepare actionable context for implementation work
|
|
31
|
-
|
|
32
|
-
## Delegation
|
|
33
|
-
|
|
34
|
-
Invoke **context-loader** with:
|
|
35
|
-
|
|
36
|
-
- `topic`: Inferred from the natural language description
|
|
37
|
-
- `files`: Extracted file paths from the description (optional)
|
|
38
|
-
- `focus`: Specific aspects mentioned in the description (optional)
|
|
39
|
-
|
|
40
|
-
## Output
|
|
41
|
-
|
|
42
|
-
Return the structured analysis from context-loader:
|
|
43
|
-
|
|
44
|
-
- `summary`: Executive summary of the area
|
|
45
|
-
- `key-components`: Core files and their responsibilities
|
|
46
|
-
- `patterns`: Conventions and patterns to follow
|
|
47
|
-
- `dependencies`: External dependencies and integrations
|
|
48
|
-
- `data-flow`: How data moves through the system
|
|
49
|
-
- `gotchas`: Non-obvious behaviors and pitfalls
|
|
50
|
-
- `implementation-notes`: Key considerations for new work
|
|
51
|
-
- `testing-approach`: How this area is tested
|
|
52
|
-
|
|
53
|
-
## Workflow Integration (Optional)
|
|
54
|
-
|
|
55
|
-
This command is **Step 1** of the implementation workflow:
|
|
56
|
-
|
|
57
|
-
1. **Explore** → 2. Plan → 3. Review → 4. Execute
|
|
58
|
-
|
|
59
|
-
### Next Steps
|
|
60
|
-
|
|
61
|
-
After exploring an area, the context findings are automatically available for:
|
|
62
|
-
|
|
63
|
-
- `/plan <task>` - Creates implementation plan using the explored context
|
|
64
|
-
- The plan command will automatically leverage your exploration findings
|
|
65
|
-
|
|
66
|
-
### Example Workflow
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
# Step 1: Explore and understand the area
|
|
70
|
-
/explore authentication system
|
|
71
|
-
|
|
72
|
-
# Step 2: Plan implementation with automatic context
|
|
73
|
-
/plan add two-factor authentication
|
|
74
|
-
|
|
75
|
-
# Step 3: Review the generated plan
|
|
76
|
-
/review-plan auth-2fa-plan.md
|
|
77
|
-
|
|
78
|
-
# Step 4: Execute the approved plan
|
|
79
|
-
/execute-plan auth-2fa-plan.md
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**Note for Claude Code**: Store the context-loader findings in memory for automatic use by the `/plan` command in the same session.
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Comprehensively diagnose bugs with root cause analysis, systematic fixes, regression tests, and prevention strategies.
|
|
3
|
-
argument-hint: <error text or pointer> [--run-tests] [--deep-analysis] [--generate-tests] [--prevention-mode]
|
|
4
|
-
allowed-tools: Bash(npm test:*), Bash(pnpm test:*), Bash(npm test:*), Bash(yarn test:*), Bash(npm run lint*), Bash(pnpm lint*), Bash(npm lint*), Bash(yarn lint*)
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Inputs
|
|
8
|
-
|
|
9
|
-
- `$ARGUMENTS`: Error message, stack trace, failing test output, or bug description
|
|
10
|
-
- `--run-tests`: Execute project test suites to capture live failure output
|
|
11
|
-
- `--deep-analysis`: Perform comprehensive Five Whys analysis and system-level investigation
|
|
12
|
-
- `--generate-tests`: Automatically create regression tests with edge case coverage
|
|
13
|
-
- `--prevention-mode`: Focus on prevention strategies and system improvements
|
|
14
|
-
|
|
15
|
-
## Phase 1: Enhanced Debugging & Analysis
|
|
16
|
-
|
|
17
|
-
### Initial Diagnosis
|
|
18
|
-
|
|
19
|
-
Use **debug-assistant** with enhanced capabilities to:
|
|
20
|
-
|
|
21
|
-
1. **Error Pattern Recognition**:
|
|
22
|
-
|
|
23
|
-
- Classify error type (runtime, compilation, logic, integration, performance)
|
|
24
|
-
- Identify error patterns and common causes
|
|
25
|
-
- Check for known issue signatures in codebase
|
|
26
|
-
- Analyze error frequency and impact scope
|
|
27
|
-
|
|
28
|
-
2. **Multi-File Context Analysis**:
|
|
29
|
-
|
|
30
|
-
- Trace error propagation across modules
|
|
31
|
-
- Identify all affected files and dependencies
|
|
32
|
-
- Map data flow through the error chain
|
|
33
|
-
- Check for cascading failures
|
|
34
|
-
|
|
35
|
-
3. **Five Whys Root Cause Analysis**:
|
|
36
|
-
- Why did the error occur? (immediate cause)
|
|
37
|
-
- Why did the immediate cause happen? (contributing factors)
|
|
38
|
-
- Why did those factors exist? (system conditions)
|
|
39
|
-
- Why were those conditions present? (process gaps)
|
|
40
|
-
- Why weren't these gaps prevented? (root cause)
|
|
41
|
-
|
|
42
|
-
### Deep System Analysis
|
|
43
|
-
|
|
44
|
-
If `--deep-analysis` is provided:
|
|
45
|
-
|
|
46
|
-
1. **Causal Chain Mapping**:
|
|
47
|
-
|
|
48
|
-
- Primary cause identification
|
|
49
|
-
- Secondary contributing factors
|
|
50
|
-
- Environmental conditions
|
|
51
|
-
- Timing dependencies
|
|
52
|
-
- Resource constraints
|
|
53
|
-
|
|
54
|
-
2. **System-Level vs Code-Level Classification**:
|
|
55
|
-
|
|
56
|
-
- Code logic errors
|
|
57
|
-
- Architecture problems
|
|
58
|
-
- Configuration issues
|
|
59
|
-
- Infrastructure limitations
|
|
60
|
-
- Process failures
|
|
61
|
-
|
|
62
|
-
3. **Impact Assessment**:
|
|
63
|
-
- Affected user scenarios
|
|
64
|
-
- Performance implications
|
|
65
|
-
- Security considerations
|
|
66
|
-
- Data integrity risks
|
|
67
|
-
|
|
68
|
-
## Phase 2: Systematic Fix Implementation
|
|
69
|
-
|
|
70
|
-
### Fix Strategy Development
|
|
71
|
-
|
|
72
|
-
Based on root cause analysis, develop:
|
|
73
|
-
|
|
74
|
-
1. **Immediate Fix Plan**:
|
|
75
|
-
|
|
76
|
-
- Minimal code changes required
|
|
77
|
-
- Risk assessment of each change
|
|
78
|
-
- Rollback strategy if needed
|
|
79
|
-
- Testing approach
|
|
80
|
-
|
|
81
|
-
2. **Implementation Approach**:
|
|
82
|
-
- Use **refactorer** for minimal, surgical patches
|
|
83
|
-
- Prioritize backwards compatibility
|
|
84
|
-
- Implement defensive programming practices
|
|
85
|
-
- Add appropriate error handling
|
|
86
|
-
|
|
87
|
-
### Code Quality Assurance
|
|
88
|
-
|
|
89
|
-
- Ensure fix follows project coding standards
|
|
90
|
-
- Verify no introduction of new vulnerabilities
|
|
91
|
-
- Maintain existing API contracts
|
|
92
|
-
- Optimize for maintainability
|
|
93
|
-
|
|
94
|
-
## Phase 3: Comprehensive Test Generation
|
|
95
|
-
|
|
96
|
-
### Regression Test Suite
|
|
97
|
-
|
|
98
|
-
Use **test-writer** to create:
|
|
99
|
-
|
|
100
|
-
1. **Core Regression Tests**:
|
|
101
|
-
|
|
102
|
-
- Test the exact scenario that failed
|
|
103
|
-
- Verify the fix resolves the issue
|
|
104
|
-
- Ensure no side effects introduced
|
|
105
|
-
|
|
106
|
-
2. **Edge Case Coverage**:
|
|
107
|
-
|
|
108
|
-
- Boundary conditions that led to the bug
|
|
109
|
-
- Input validation scenarios
|
|
110
|
-
- Error state handling
|
|
111
|
-
- Resource exhaustion cases
|
|
112
|
-
|
|
113
|
-
3. **Multi-Level Testing**:
|
|
114
|
-
|
|
115
|
-
- **Unit Tests**: Component-level validation
|
|
116
|
-
- **Integration Tests**: Cross-module interactions
|
|
117
|
-
- **End-to-End Tests**: Full user workflow validation
|
|
118
|
-
- **Performance Tests**: Resource usage verification
|
|
119
|
-
|
|
120
|
-
4. **Test Coverage Metrics**:
|
|
121
|
-
- Measure code coverage improvement
|
|
122
|
-
- Identify untested paths
|
|
123
|
-
- Ensure critical paths are covered
|
|
124
|
-
- Track test execution performance
|
|
125
|
-
|
|
126
|
-
## Phase 4: Prevention Strategy Implementation
|
|
127
|
-
|
|
128
|
-
### Code-Level Improvements
|
|
129
|
-
|
|
130
|
-
1. **Defensive Programming**:
|
|
131
|
-
|
|
132
|
-
- Input validation enhancements
|
|
133
|
-
- Error boundary implementations
|
|
134
|
-
- Graceful degradation patterns
|
|
135
|
-
- Resource cleanup procedures
|
|
136
|
-
|
|
137
|
-
2. **Type Safety & Validation**:
|
|
138
|
-
- Strengthen type definitions
|
|
139
|
-
- Add runtime validation
|
|
140
|
-
- Implement schema validation
|
|
141
|
-
- Use assertion libraries
|
|
142
|
-
|
|
143
|
-
### System-Level Enhancements
|
|
144
|
-
|
|
145
|
-
1. **Monitoring & Observability**:
|
|
146
|
-
|
|
147
|
-
- Add logging for critical paths
|
|
148
|
-
- Implement health checks
|
|
149
|
-
- Create performance metrics
|
|
150
|
-
- Set up alerting thresholds
|
|
151
|
-
|
|
152
|
-
2. **Configuration Management**:
|
|
153
|
-
- Externalize configuration
|
|
154
|
-
- Add configuration validation
|
|
155
|
-
- Implement feature flags
|
|
156
|
-
- Create environment-specific settings
|
|
157
|
-
|
|
158
|
-
### Process Improvements
|
|
159
|
-
|
|
160
|
-
1. **Code Review Guidelines**:
|
|
161
|
-
|
|
162
|
-
- Add specific review criteria
|
|
163
|
-
- Create bug pattern checklists
|
|
164
|
-
- Implement pair programming for critical code
|
|
165
|
-
- Establish security review requirements
|
|
166
|
-
|
|
167
|
-
2. **Testing Strategy**:
|
|
168
|
-
|
|
169
|
-
- Enhance CI/CD pipeline
|
|
170
|
-
- Add pre-commit hooks
|
|
171
|
-
- Implement property-based testing
|
|
172
|
-
- Create mutation testing
|
|
173
|
-
|
|
174
|
-
3. **Documentation Updates**:
|
|
175
|
-
- Update API documentation
|
|
176
|
-
- Create troubleshooting guides
|
|
177
|
-
- Document known limitations
|
|
178
|
-
- Add deployment procedures
|
|
179
|
-
|
|
180
|
-
## Enhanced Output Structure
|
|
181
|
-
|
|
182
|
-
### Comprehensive Report
|
|
183
|
-
|
|
184
|
-
```json
|
|
185
|
-
{
|
|
186
|
-
"errorAnalysis": {
|
|
187
|
-
"errorType": "string",
|
|
188
|
-
"errorPattern": "string",
|
|
189
|
-
"severity": "critical|high|medium|low",
|
|
190
|
-
"scope": "string[]"
|
|
191
|
-
},
|
|
192
|
-
"rootCauseAnalysis": {
|
|
193
|
-
"fiveWhys": {
|
|
194
|
-
"why1": "immediate cause",
|
|
195
|
-
"why2": "contributing factors",
|
|
196
|
-
"why3": "system conditions",
|
|
197
|
-
"why4": "process gaps",
|
|
198
|
-
"why5": "root cause"
|
|
199
|
-
},
|
|
200
|
-
"causalChain": "string[]",
|
|
201
|
-
"contributingFactors": "string[]",
|
|
202
|
-
"systemLevel": "boolean",
|
|
203
|
-
"codeLevel": "boolean"
|
|
204
|
-
},
|
|
205
|
-
"fixImplementation": {
|
|
206
|
-
"strategy": "string",
|
|
207
|
-
"patches": [
|
|
208
|
-
{
|
|
209
|
-
"file": "string",
|
|
210
|
-
"description": "string",
|
|
211
|
-
"changes": "string",
|
|
212
|
-
"riskLevel": "low|medium|high"
|
|
213
|
-
}
|
|
214
|
-
],
|
|
215
|
-
"rollbackPlan": "string"
|
|
216
|
-
},
|
|
217
|
-
"regressionTests": {
|
|
218
|
-
"unitTests": "TestCase[]",
|
|
219
|
-
"integrationTests": "TestCase[]",
|
|
220
|
-
"e2eTests": "TestCase[]",
|
|
221
|
-
"coverageMetrics": {
|
|
222
|
-
"before": "number",
|
|
223
|
-
"after": "number",
|
|
224
|
-
"improvement": "number"
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
"preventionRecommendations": {
|
|
228
|
-
"codeLevel": {
|
|
229
|
-
"defensiveProgramming": "string[]",
|
|
230
|
-
"typeValidation": "string[]",
|
|
231
|
-
"errorHandling": "string[]"
|
|
232
|
-
},
|
|
233
|
-
"systemLevel": {
|
|
234
|
-
"monitoring": "string[]",
|
|
235
|
-
"configuration": "string[]",
|
|
236
|
-
"infrastructure": "string[]"
|
|
237
|
-
},
|
|
238
|
-
"processLevel": {
|
|
239
|
-
"codeReview": "string[]",
|
|
240
|
-
"testing": "string[]",
|
|
241
|
-
"documentation": "string[]",
|
|
242
|
-
"cicd": "string[]"
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
"implementationPlan": {
|
|
246
|
-
"immediate": "string[]",
|
|
247
|
-
"shortTerm": "string[]",
|
|
248
|
-
"longTerm": "string[]"
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Agent Orchestration Strategy
|
|
254
|
-
|
|
255
|
-
### Primary Agents
|
|
256
|
-
|
|
257
|
-
1. **debug-assistant**: Enhanced with Five Whys methodology, pattern recognition, and multi-file analysis
|
|
258
|
-
2. **refactorer**: Minimal, surgical code fixes with risk assessment
|
|
259
|
-
3. **test-writer**: Comprehensive test suite generation with coverage analysis
|
|
260
|
-
|
|
261
|
-
### Secondary Agents (as needed)
|
|
262
|
-
|
|
263
|
-
1. **security-analyst**: For security-related bugs
|
|
264
|
-
2. **performance-optimizer**: For performance issues
|
|
265
|
-
3. **architect**: For system-level design problems
|
|
266
|
-
4. **devops-engineer**: For infrastructure and deployment issues
|
|
267
|
-
|
|
268
|
-
### Workflow Orchestration
|
|
269
|
-
|
|
270
|
-
1. **Sequential Analysis**: Root cause → Fix → Test → Prevention
|
|
271
|
-
2. **Parallel Processing**: Where appropriate for independent analysis
|
|
272
|
-
3. **Iterative Refinement**: Based on test results and validation
|
|
273
|
-
4. **Quality Gates**: Validation at each phase before proceeding
|