claudify-agent 0.0.0-stage → 1.0.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/.claude/QUICK-REFERENCE.md +213 -0
- package/.claude/cost-dashboard.md +162 -0
- package/.claude/docs/COST-OPTIMIZATION.md +403 -0
- package/.claude/docs/MCP-INTEGRATION-GUIDE.md +348 -0
- package/.claude/docs/PLAN-MODE-OPTIMIZATION.md +836 -0
- package/.claude/hooks/auto-learning-review.ts +195 -0
- package/.claude/hooks/auto-lint-fix.ts +104 -0
- package/.claude/hooks/auto-security-review.ts +354 -0
- package/.claude/hooks/auto-validate.ts +348 -0
- package/.claude/hooks/plan-quality-tracker.ts +719 -0
- package/.claude/rules/anti-patterns.md +22 -0
- package/.claude/rules/context-tier-1.md +41 -0
- package/.claude/rules/context-tier-2.md +285 -0
- package/.claude/rules/general.md +25 -0
- package/.claude/rules/mcp-auto-use.md +46 -0
- package/.claude/rules/parallel-exploration-auto.md +31 -0
- package/.claude/rules/plan-mode-execution.md +289 -0
- package/.claude/rules/plan-mode-research.md +34 -0
- package/.claude/rules/plan-mode-structure.md +166 -0
- package/.claude/rules/plan-mode-validation.md +130 -0
- package/.claude/rules/security-critical.md +19 -0
- package/.claude/rules/tool-auto-selection.md +45 -0
- package/.claude/rules/tool-strategy.md +22 -0
- package/.claude/scripts/auto-validate.js +69 -0
- package/.claude/scripts/security-scan.js +45 -0
- package/.claude/security-dashboard.md +142 -0
- package/.claude/skills/backend-concurrency/SKILL.md +203 -0
- package/.claude/skills/debug-optimizer/SKILL.md +399 -0
- package/.claude/skills/debug-optimizer.md +12 -0
- package/.claude/skills/golang-guide/SKILL.md +177 -0
- package/.claude/skills/learning-loop/SKILL.md +308 -0
- package/.claude/skills/mcp-mastery/SKILL.md +214 -0
- package/.claude/skills/nestjs-guide/SKILL.md +197 -0
- package/.claude/skills/nextjs-guide/SKILL.md +687 -0
- package/.claude/skills/nextjs.md +13 -0
- package/.claude/skills/parallel-exploration/SKILL.md +193 -0
- package/.claude/skills/plan-mode-mastery/SKILL.md +263 -0
- package/.claude/skills/python-guide/SKILL.md +822 -0
- package/.claude/skills/react-guide/SKILL.md +762 -0
- package/.claude/skills/react.md +12 -0
- package/.claude/skills/security.md +18 -0
- package/.claude/skills/solidity-guide/SKILL.md +32 -0
- package/.claude/skills/tool-selection/SKILL.md +428 -0
- package/.claude/skills/vite-guide/SKILL.md +445 -0
- package/CLAUDE.md +49 -0
- package/README.md +65 -2
- package/bin/cli.js +50 -0
- package/package.json +44 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# React & State Management Mastery
|
|
2
|
+
|
|
3
|
+
## Architecture Rules
|
|
4
|
+
1. **Single Source of Truth:** Keep state as close to where it is consumed as possible.
|
|
5
|
+
2. **State Elevation:** Only elevate state to global store (Zustand, Context) when shared across distant siblings.
|
|
6
|
+
3. **Pure Components:** Keep rendering pure. Side effects belong strictly in `useEffect` or event handlers.
|
|
7
|
+
4. **Custom Hooks:** Extract reusable component logic and state handling into `use[Feature]` custom hooks.
|
|
8
|
+
|
|
9
|
+
## Performance Checklist
|
|
10
|
+
- Memoize expensive calculations with `useMemo`.
|
|
11
|
+
- Avoid premature optimization; profile render frequency before adding `useCallback` everywhere.
|
|
12
|
+
- Always provide stable, unique `key` props (never use array index for dynamic/reorderable lists).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Security & Defensive Coding Standards (OWASP Top 10)
|
|
2
|
+
|
|
3
|
+
## Mandatory Checks
|
|
4
|
+
1. **Secrets Management:**
|
|
5
|
+
- NEVER commit `.env`, `.pem`, API keys, or JWT secrets to source control.
|
|
6
|
+
- Always reference environment variables via `process.env.VARIABLE_NAME`.
|
|
7
|
+
- Provide clear `.env.example` templates with empty placeholders.
|
|
8
|
+
|
|
9
|
+
2. **Injection Prevention:**
|
|
10
|
+
- Use parameterized queries or verified ORMs (Prisma, Drizzle) for SQL. Never concatenate user input into SQL strings.
|
|
11
|
+
- Sanitize all user inputs before rendering into raw HTML (`dangerouslySetInnerHTML`).
|
|
12
|
+
|
|
13
|
+
3. **Authentication & Authorization:**
|
|
14
|
+
- Enforce server-side role and session checks on every sensitive endpoint. Never trust client-side claims alone.
|
|
15
|
+
- Use constant-time comparison algorithms for secrets/hashes to prevent timing attacks.
|
|
16
|
+
|
|
17
|
+
4. **Input Validation:**
|
|
18
|
+
- All external payload boundaries (HTTP Body, Query Params, Webhooks) must be strictly validated with Zod/Valibot schemas.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Solidity & Smart Contract (SMC) Security Skill
|
|
2
|
+
|
|
3
|
+
## 1. Smart Contract Security Mandates (Critical)
|
|
4
|
+
Smart contract bugs mean irreversible financial loss. Every smart contract edit MUST satisfy:
|
|
5
|
+
- **Reentrancy Protection:**
|
|
6
|
+
- Always implement OpenZeppelin's `ReentrancyGuard` with `nonReentrant` on external state-changing functions.
|
|
7
|
+
- Follow the **CEI Pattern (Checks-Effects-Interactions)** strictly: Perform validations, update internal contract state, and ONLY THEN perform external calls or token transfers.
|
|
8
|
+
- **Access Control:**
|
|
9
|
+
- Explicitly restrict administrative functions using `Ownable2Step` (prevents accidental transfer to wrong address) or `AccessControl`.
|
|
10
|
+
- Validate address parameters against `address(0)` in constructors and setters.
|
|
11
|
+
- **Integer & Math Safety:**
|
|
12
|
+
- Use Solidity `^0.8.20+` for built-in overflow/underflow checks.
|
|
13
|
+
- Avoid `unchecked` blocks unless gas optimization is strictly benchmarked and proven provably safe.
|
|
14
|
+
|
|
15
|
+
## 2. Gas Optimization Protocols
|
|
16
|
+
- Cache storage variables (`sload`) into memory/local stack variables before reading in loops.
|
|
17
|
+
- Use `uint256` in state variables where packing isn't possible (EVM native word size).
|
|
18
|
+
- Mark functions `external` instead of `public` if they are never invoked internally within the contract.
|
|
19
|
+
- Use custom errors `error Unauthorized()` instead of long `require(..., "string message")` to save deployment and execution gas.
|
|
20
|
+
|
|
21
|
+
## 3. Local Verification Loop (Hardhat & Foundry)
|
|
22
|
+
Execute local compilation and security suite:
|
|
23
|
+
```bash
|
|
24
|
+
forge build --sizes # Foundry contract compilation & size check
|
|
25
|
+
forge test -vvv # Unit & Fuzz testing
|
|
26
|
+
slither . # Static analysis vulnerability scanner
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 4. Anti-Patterns to Avoid
|
|
30
|
+
- ❌ Do NOT use `tx.origin` for authorization; always use `msg.sender`.
|
|
31
|
+
- ❌ Do NOT use `block.timestamp` or `blockhash` as sources of randomness (use Chainlink VRF).
|
|
32
|
+
- ❌ Do NOT perform transfer calls with raw `.call.value()()` without checking boolean return value and reentrancy guards.
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
# SKILL.md: Optimal Tool Selection
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
Automatically select best tools for each plan step based on task type, complexity, and available resources.
|
|
5
|
+
|
|
6
|
+
## When to Use
|
|
7
|
+
- Creating implementation plans
|
|
8
|
+
- Deciding which tools to use
|
|
9
|
+
- Optimizing workflow efficiency
|
|
10
|
+
- Troubleshooting tool failures
|
|
11
|
+
|
|
12
|
+
## Capabilities
|
|
13
|
+
- Tool selection decision tree
|
|
14
|
+
- Cost/complexity analysis
|
|
15
|
+
- Fallback tool identification
|
|
16
|
+
- Tool combination strategies
|
|
17
|
+
|
|
18
|
+
## Tool Selection Rules
|
|
19
|
+
|
|
20
|
+
### For Exploration
|
|
21
|
+
|
|
22
|
+
| Goal | Tool | When |
|
|
23
|
+
|------|------|------|
|
|
24
|
+
| Read single file | Read | Know exact path |
|
|
25
|
+
| Find multiple files | Glob + Read | Pattern matching |
|
|
26
|
+
| Exact text search | Grep | Specific strings/symbols |
|
|
27
|
+
| Conceptual search | SemanticSearch | Behavior/pattern |
|
|
28
|
+
| Broad exploration | Task (explore) | Multi-file investigation |
|
|
29
|
+
|
|
30
|
+
### For Implementation
|
|
31
|
+
|
|
32
|
+
| Goal | Tool | When |
|
|
33
|
+
|------|------|------|
|
|
34
|
+
| New file | Write | Creating from scratch |
|
|
35
|
+
| Small edit (<50 lines) | StrReplace | Targeted changes |
|
|
36
|
+
| Large rewrite (>50 lines) | Write | Replace entire file |
|
|
37
|
+
| Jupyter notebook | EditNotebook | Cell-level edits |
|
|
38
|
+
|
|
39
|
+
### For Validation
|
|
40
|
+
|
|
41
|
+
| Goal | Tool | When |
|
|
42
|
+
|------|------|------|
|
|
43
|
+
| Code quality | ReadLints | After edits |
|
|
44
|
+
| Functionality | Shell (tests) | Run test suite |
|
|
45
|
+
| Visual changes | Browser/Screenshot | UI verification |
|
|
46
|
+
| User feedback | AskQuestion | Decisions needed |
|
|
47
|
+
|
|
48
|
+
### For Complex Tasks
|
|
49
|
+
|
|
50
|
+
| Goal | Tool | When |
|
|
51
|
+
|------|------|------|
|
|
52
|
+
| Multi-step tracking | TodoWrite | 3+ steps |
|
|
53
|
+
| Ambiguous requirements | AskQuestion | Clarification needed |
|
|
54
|
+
| Risky changes | Checkpoints | Before breaking changes |
|
|
55
|
+
| Iterative fixes | /grind loop | Tests failing |
|
|
56
|
+
|
|
57
|
+
## Decision Trees
|
|
58
|
+
|
|
59
|
+
### "I need to find code"
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Know file path?
|
|
63
|
+
├─ Yes → Read
|
|
64
|
+
└─ No
|
|
65
|
+
├─ Exact text/symbol?
|
|
66
|
+
│ ├─ Yes → Grep
|
|
67
|
+
│ └─ No
|
|
68
|
+
│ ├─ Concept/behavior?
|
|
69
|
+
│ │ ├─ Yes → SemanticSearch
|
|
70
|
+
│ │ └─ No
|
|
71
|
+
│ └─ Broad exploration?
|
|
72
|
+
│ ├─ Yes → Task (explore)
|
|
73
|
+
│ └─ No → Glob
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### "I need to modify code"
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Jupyter notebook?
|
|
80
|
+
├─ Yes → EditNotebook
|
|
81
|
+
└─ No
|
|
82
|
+
├─ New file?
|
|
83
|
+
│ ├─ Yes → Write
|
|
84
|
+
│ └─ No
|
|
85
|
+
│ ├─ <50 lines change?
|
|
86
|
+
│ │ ├─ Yes → StrReplace
|
|
87
|
+
│ │ └─ No → Write (replace entire file)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### "I need to verify"
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Linting issues?
|
|
94
|
+
├─ Yes → ReadLints
|
|
95
|
+
└─ No
|
|
96
|
+
├─ Tests needed?
|
|
97
|
+
│ ├─ Yes → Shell (npm run test)
|
|
98
|
+
│ └─ No
|
|
99
|
+
│ ├─ Visual changes?
|
|
100
|
+
│ │ ├─ Yes → Browser/Screenshot
|
|
101
|
+
│ │ └─ No
|
|
102
|
+
│ └─ User approval?
|
|
103
|
+
│ ├─ Yes → AskQuestion
|
|
104
|
+
│ └─ No → Continue
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### "I need to automate browser"
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Need performance profiling?
|
|
111
|
+
├─ Yes → cursor-ide-browser (has profiling)
|
|
112
|
+
└─ No
|
|
113
|
+
├─ Need Lighthouse audits?
|
|
114
|
+
│ ├─ Yes → user-chrome-devtools
|
|
115
|
+
│ └─ No
|
|
116
|
+
│ ├─ Need cross-browser testing?
|
|
117
|
+
│ │ ├─ Yes → user-playwright
|
|
118
|
+
│ │ └─ No
|
|
119
|
+
│ └─ Quick testing?
|
|
120
|
+
│ ├─ Yes → Built-in Browser (7 capabilities)
|
|
121
|
+
│ └─ No → user-selenium (accessibility)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Tool Cost Hierarchy
|
|
125
|
+
|
|
126
|
+
**Start cheap, escalate as needed:**
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Tier 1 (Cheapest, fastest):
|
|
130
|
+
- Read (single file)
|
|
131
|
+
- Glob (file finding)
|
|
132
|
+
- Grep (exact text)
|
|
133
|
+
|
|
134
|
+
Tier 2 (Moderate cost):
|
|
135
|
+
- SemanticSearch (conceptual)
|
|
136
|
+
- StrReplace (edits)
|
|
137
|
+
- Write (new files)
|
|
138
|
+
|
|
139
|
+
Tier 3 (Higher cost):
|
|
140
|
+
- Task (subagents)
|
|
141
|
+
- Shell (command execution)
|
|
142
|
+
- ReadLints (analysis)
|
|
143
|
+
|
|
144
|
+
Tier 4 (Most expensive):
|
|
145
|
+
- Multiple parallel subagents
|
|
146
|
+
- Browser automation (MCP)
|
|
147
|
+
- Complex multi-tool workflows
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Tool Combinations
|
|
151
|
+
|
|
152
|
+
### Common Patterns
|
|
153
|
+
|
|
154
|
+
**Pattern 1: Feature Implementation**
|
|
155
|
+
```
|
|
156
|
+
1. SemanticSearch: Find patterns
|
|
157
|
+
2. Read: Study examples
|
|
158
|
+
3. Write: Create new files
|
|
159
|
+
4. Shell: Run tests
|
|
160
|
+
5. ReadLints: Verify quality
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Pattern 2: Bug Fix**
|
|
164
|
+
```
|
|
165
|
+
1. Grep: Find related code
|
|
166
|
+
2. Read: Understand issue
|
|
167
|
+
3. StrReplace: Fix code
|
|
168
|
+
4. Shell: Run tests
|
|
169
|
+
5. ReadLints: Check quality
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Pattern 3: Refactor**
|
|
173
|
+
```
|
|
174
|
+
1. Task (explore): Map all usages
|
|
175
|
+
2. SemanticSearch: Find patterns
|
|
176
|
+
3. Read: Review current code
|
|
177
|
+
4. Checkpoint: Before changes
|
|
178
|
+
5. StrReplace: Incremental changes
|
|
179
|
+
6. Shell: Run tests after each
|
|
180
|
+
7. ReadLints: Verify quality
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Pattern 4: Code Review**
|
|
184
|
+
```
|
|
185
|
+
1. Glob: Find changed files
|
|
186
|
+
2. Read: Review diffs
|
|
187
|
+
3. ReadLints: Check for issues
|
|
188
|
+
4. Shell: Run tests
|
|
189
|
+
5. AskQuestion: Clarify if needed
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Examples
|
|
193
|
+
|
|
194
|
+
### Example 1: Add API Endpoint
|
|
195
|
+
|
|
196
|
+
User: "Add /api/products endpoint"
|
|
197
|
+
|
|
198
|
+
Tool sequence:
|
|
199
|
+
1. **SemanticSearch**: "Find API route patterns"
|
|
200
|
+
- Result: app/api/users/route.ts
|
|
201
|
+
|
|
202
|
+
2. **Read**: Existing route file
|
|
203
|
+
- Understand pattern
|
|
204
|
+
|
|
205
|
+
3. **Write**: New route file
|
|
206
|
+
- Create app/api/products/route.ts
|
|
207
|
+
|
|
208
|
+
4. **Shell**: Run tests
|
|
209
|
+
- Command: npm run test -- products.test.ts
|
|
210
|
+
|
|
211
|
+
5. **ReadLints**: Check for errors
|
|
212
|
+
- Verify quality
|
|
213
|
+
|
|
214
|
+
**Why these tools**:
|
|
215
|
+
- SemanticSearch: Find pattern (conceptual)
|
|
216
|
+
- Read: Study example (single file)
|
|
217
|
+
- Write: New file (creation)
|
|
218
|
+
- Shell: Validate (tests)
|
|
219
|
+
- ReadLints: Quality gate
|
|
220
|
+
|
|
221
|
+
### Example 2: Refactor Authentication
|
|
222
|
+
|
|
223
|
+
User: "Refactor auth system"
|
|
224
|
+
|
|
225
|
+
Tool sequence:
|
|
226
|
+
1. **Task (explore)**: "Find all auth code"
|
|
227
|
+
- Parallel: JWT, sessions, OAuth, hashing
|
|
228
|
+
|
|
229
|
+
2. **SemanticSearch**: "Find token validation"
|
|
230
|
+
- Result: src/auth/validateToken.ts
|
|
231
|
+
|
|
232
|
+
3. **Read**: Auth files
|
|
233
|
+
- Understand current implementation
|
|
234
|
+
|
|
235
|
+
4. **Checkpoint**: Before breaking changes
|
|
236
|
+
- Rollback point
|
|
237
|
+
|
|
238
|
+
5. **StrReplace**: Incremental changes
|
|
239
|
+
- Small, safe edits
|
|
240
|
+
|
|
241
|
+
6. **Shell**: Run auth tests
|
|
242
|
+
- After each change
|
|
243
|
+
|
|
244
|
+
7. **ReadLints**: Verify quality
|
|
245
|
+
- Zero new lints
|
|
246
|
+
|
|
247
|
+
**Why these tools**:
|
|
248
|
+
- Task: Broad exploration (complex)
|
|
249
|
+
- SemanticSearch: Specific patterns
|
|
250
|
+
- Read: Understanding
|
|
251
|
+
- Checkpoint: Safety (risky change)
|
|
252
|
+
- StrReplace: Targeted edits
|
|
253
|
+
- Shell + ReadLints: Validation
|
|
254
|
+
|
|
255
|
+
### Example 3: Fix Bug
|
|
256
|
+
|
|
257
|
+
User: "Fix login bug"
|
|
258
|
+
|
|
259
|
+
Tool sequence:
|
|
260
|
+
1. **Grep**: "Find login function"
|
|
261
|
+
- Exact text search
|
|
262
|
+
|
|
263
|
+
2. **Read**: Login code
|
|
264
|
+
- Understand issue
|
|
265
|
+
|
|
266
|
+
3. **ReadLints**: Check for errors
|
|
267
|
+
- Identify problems
|
|
268
|
+
|
|
269
|
+
4. **StrReplace**: Fix code
|
|
270
|
+
- Targeted fix
|
|
271
|
+
|
|
272
|
+
5. **Shell**: Run login tests
|
|
273
|
+
- Verify fix
|
|
274
|
+
|
|
275
|
+
6. **ReadLints**: Final check
|
|
276
|
+
- Quality gate
|
|
277
|
+
|
|
278
|
+
**Why these tools**:
|
|
279
|
+
- Grep: Exact search (cheap)
|
|
280
|
+
- Read: Understanding
|
|
281
|
+
- ReadLints: Find issues
|
|
282
|
+
- StrReplace: Small fix
|
|
283
|
+
- Shell + ReadLints: Validate
|
|
284
|
+
|
|
285
|
+
## Anti-Patterns
|
|
286
|
+
|
|
287
|
+
### ❌ Using Expensive Tools When Cheap Works
|
|
288
|
+
|
|
289
|
+
Bad: Task subagent to find single file
|
|
290
|
+
Good: Read (know path) or Glob (pattern)
|
|
291
|
+
|
|
292
|
+
### ❌ Using Wrong Tool for Job
|
|
293
|
+
|
|
294
|
+
Bad: Grep for conceptual search
|
|
295
|
+
Good: SemanticSearch for behavior
|
|
296
|
+
|
|
297
|
+
### ❌ Skipping Validation
|
|
298
|
+
|
|
299
|
+
Bad: Edit without ReadLints
|
|
300
|
+
Good: Always validate after substantive changes
|
|
301
|
+
|
|
302
|
+
### ❌ No Checkpoints for Risky Changes
|
|
303
|
+
|
|
304
|
+
Bad: Refactor without rollback
|
|
305
|
+
Good: Checkpoint before breaking changes
|
|
306
|
+
|
|
307
|
+
## Automatic Tool Selection Workflow
|
|
308
|
+
|
|
309
|
+
### Decision Matrix (Automatic, No User Input)
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
Task Type → Tool Sequence
|
|
313
|
+
─────────────────────────
|
|
314
|
+
"Find [symbol/text]" → Grep → Read
|
|
315
|
+
"Find [pattern/concept]" → SemanticSearch → Task (if broad)
|
|
316
|
+
"Add [feature]" → Research patterns → Write/StrReplace → ReadLints → Shell
|
|
317
|
+
"Fix [bug]" → Grep/SemanticSearch → Read → StrReplace → ReadLints → Shell
|
|
318
|
+
"Refactor [X]" → Task (explore) → Checkpoint → StrReplace → ReadLints → Shell
|
|
319
|
+
"Test [feature]" → Read existing tests → Write tests → Shell → ReadLints
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### MCP Server Selection (Automatic)
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
User Request → MCP Server
|
|
326
|
+
─────────────────────────
|
|
327
|
+
"UI", "visual", "browser" → cursor-ide-browser
|
|
328
|
+
"PR", "issue", "github" → user-github
|
|
329
|
+
"lint", "quality" → user-ESLint
|
|
330
|
+
"how to [library]", "[framework] setup" → user-context7
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Tool Escalation Protocol
|
|
334
|
+
|
|
335
|
+
**Rule**: Start with Tier 1, escalate only if needed
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
Tier 1 (Try First):
|
|
339
|
+
- Read: Know exact file path
|
|
340
|
+
- Glob: Pattern matching
|
|
341
|
+
- Grep: Exact text search
|
|
342
|
+
|
|
343
|
+
If Tier 1 fails → Escalate to Tier 2:
|
|
344
|
+
- SemanticSearch: Conceptual search
|
|
345
|
+
- StrReplace: Small edits
|
|
346
|
+
- Write: New files
|
|
347
|
+
|
|
348
|
+
If Tier 2 insufficient → Escalate to Tier 3:
|
|
349
|
+
- Task: Complex exploration
|
|
350
|
+
- Shell: Run commands/tests
|
|
351
|
+
- ReadLints: Quality checks
|
|
352
|
+
|
|
353
|
+
If Tier 3 inadequate → Escalate to Tier 4:
|
|
354
|
+
- Parallel subagents: Multi-angle exploration
|
|
355
|
+
- Browser MCP: Visual verification
|
|
356
|
+
- Complex workflows: Multi-step automation
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Automatic Validation Rules
|
|
360
|
+
|
|
361
|
+
**After EVERY Code Change**:
|
|
362
|
+
1. ReadLints on modified files
|
|
363
|
+
2. Fix introduced lints immediately
|
|
364
|
+
3. If tests exist → run relevant tests
|
|
365
|
+
4. Update TodoWrite if tracking
|
|
366
|
+
|
|
367
|
+
**Before EVERY Commit**:
|
|
368
|
+
1. Run full test suite
|
|
369
|
+
2. Run linter
|
|
370
|
+
3. Run typecheck
|
|
371
|
+
4. Create checkpoint if breaking change
|
|
372
|
+
|
|
373
|
+
## Examples
|
|
374
|
+
|
|
375
|
+
### Example: Automatic Tool Selection
|
|
376
|
+
|
|
377
|
+
User: "Add authentication to checkout"
|
|
378
|
+
|
|
379
|
+
Agent automatically selects:
|
|
380
|
+
1. **SemanticSearch**: "How is authentication implemented?" (Tier 2)
|
|
381
|
+
2. **Read**: `@src/auth/validateToken.ts` (Tier 1)
|
|
382
|
+
3. **StrReplace**: Add auth to checkout (Tier 2)
|
|
383
|
+
4. **ReadLints**: Verify quality (Tier 3, automatic)
|
|
384
|
+
5. **Shell**: Run auth tests (Tier 3, automatic)
|
|
385
|
+
|
|
386
|
+
### Example: Automatic MCP Use
|
|
387
|
+
|
|
388
|
+
User: "Fix issue #123"
|
|
389
|
+
|
|
390
|
+
Agent automatically:
|
|
391
|
+
1. **user-github**: Fetch issue #123
|
|
392
|
+
2. **Grep**: Find related code
|
|
393
|
+
3. **StrReplace**: Implement fix
|
|
394
|
+
4. **user-ESLint**: Check quality
|
|
395
|
+
5. **user-github**: Create PR linking issue
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Troubleshooting
|
|
400
|
+
|
|
401
|
+
### Tool Not Available
|
|
402
|
+
|
|
403
|
+
**Problem**: Selected tool not accessible
|
|
404
|
+
|
|
405
|
+
**Solutions**:
|
|
406
|
+
1. Check MCP server running
|
|
407
|
+
2. Use alternative tool
|
|
408
|
+
3. Fallback to manual approach
|
|
409
|
+
|
|
410
|
+
### Tool Taking Too Long
|
|
411
|
+
|
|
412
|
+
**Problem**: Tool execution slow
|
|
413
|
+
|
|
414
|
+
**Solutions**:
|
|
415
|
+
1. Use model="fast" for subagents
|
|
416
|
+
2. Narrow scope (target_directories)
|
|
417
|
+
3. Try cheaper alternative
|
|
418
|
+
4. Time-box execution
|
|
419
|
+
|
|
420
|
+
### Tool Failing Repeatedly
|
|
421
|
+
|
|
422
|
+
**Problem**: Tool errors persist
|
|
423
|
+
|
|
424
|
+
**Solutions**:
|
|
425
|
+
1. Check parameters
|
|
426
|
+
2. Verify permissions
|
|
427
|
+
3. Try alternative approach
|
|
428
|
+
4. Report blocker
|