claude-dev-kit 2.1.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/.claude/agents/angelic-workshop-energy-clearing.md +113 -0
- package/.claude/agents/angelic-workshop-intake.md +84 -0
- package/.claude/agents/angelic-workshop-integration.md +140 -0
- package/.claude/agents/angelic-workshop-invocation.md +92 -0
- package/.claude/agents/angelic-workshop-lead.md +225 -0
- package/.claude/agents/angelic-workshop-transmission.md +108 -0
- package/.claude/agents/deep-think-partner.md +41 -0
- package/.claude/agents/dev-backend.md +74 -0
- package/.claude/agents/dev-e2e.md +101 -0
- package/.claude/agents/dev-frontend.md +82 -0
- package/.claude/agents/dev-lead.md +144 -0
- package/.claude/agents/dev-reviewer.md +122 -0
- package/.claude/agents/dev-test.md +88 -0
- package/.claude/agents/documentation-manager.md +73 -0
- package/.claude/agents/haiku-executor.md +8 -0
- package/.claude/agents/pm-groomer.md +98 -0
- package/.claude/agents/pm-prp-writer.md +144 -0
- package/.claude/agents/pm-sizer.md +84 -0
- package/.claude/agents/project-manager.md +91 -0
- package/.claude/agents/system-architect.md +98 -0
- package/.claude/agents/validation-gates.md +121 -0
- package/.claude/agents/workflow-builder.md +416 -0
- package/.claude/commands/ai/detect.md +117 -0
- package/.claude/commands/ai/route.md +128 -0
- package/.claude/commands/ai/switch.md +121 -0
- package/.claude/commands/bs/brainstorm_full.md +149 -0
- package/.claude/commands/bs/claude.md +37 -0
- package/.claude/commands/bs/codex.md +37 -0
- package/.claude/commands/bs/gemini.md +37 -0
- package/.claude/commands/bs/glm.md +37 -0
- package/.claude/commands/bs/grok.md +37 -0
- package/.claude/commands/bs/kimi.md +37 -0
- package/.claude/commands/bs/minimax.md +37 -0
- package/.claude/commands/bs/ollama.md +71 -0
- package/.claude/commands/code/build-and-fix.md +80 -0
- package/.claude/commands/code/simplify.md +77 -0
- package/.claude/commands/dev/backend.md +47 -0
- package/.claude/commands/dev/e2e.md +49 -0
- package/.claude/commands/dev/frontend.md +45 -0
- package/.claude/commands/dev/review.md +48 -0
- package/.claude/commands/dev/test.md +54 -0
- package/.claude/commands/dev-epic.md +121 -0
- package/.claude/commands/dev-issue.md +79 -0
- package/.claude/commands/dev.md +134 -0
- package/.claude/commands/execute-prp.md +113 -0
- package/.claude/commands/fix-github-issue.md +14 -0
- package/.claude/commands/generate-prp.md +73 -0
- package/.claude/commands/git/status.md +14 -0
- package/.claude/commands/haiku.md +13 -0
- package/.claude/commands/improve.md +178 -0
- package/.claude/commands/init.md +311 -0
- package/.claude/commands/pm/groom.md +58 -0
- package/.claude/commands/pm/plan-epic.md +74 -0
- package/.claude/commands/pm/size.md +46 -0
- package/.claude/commands/pm.md +47 -0
- package/.claude/commands/primer.md +16 -0
- package/.claude/commands/self-improve.md +243 -0
- package/.claude/commands/think.md +68 -0
- package/.claude/commands/workflow/angelic-workshop.md +89 -0
- package/.claude/commands/workflow/build.md +91 -0
- package/.claude/hooks/pre-tool-use/block-dangerous-commands.js +196 -0
- package/.claude/hooks/skill-activation-prompt/package-lock.json +560 -0
- package/.claude/hooks/skill-activation-prompt/package.json +16 -0
- package/.claude/hooks/skill-activation-prompt/skill-activation-prompt.ts +135 -0
- package/.claude/hooks/skill-activation-prompt/skill-rules.json +50 -0
- package/.claude/hooks/stop/context_monitor.py +155 -0
- package/.claude/hooks/stop/learning_logger.py +218 -0
- package/.claude/skills/ai-router/SKILL.md +119 -0
- package/.claude/skills/build-and-fix/SKILL.md +271 -0
- package/.claude/skills/build-and-fix/examples/javascript-lint-fix.md +37 -0
- package/.claude/skills/build-and-fix/language-configs/javascript.yaml +139 -0
- package/.claude/skills/build-and-fix/references/config-schema.md +120 -0
- package/.claude/skills/build-and-fix/references/error-patterns.md +273 -0
- package/.claude/skills/code-investigator/SKILL.md +299 -0
- package/.claude/skills/code-investigator/references/investigation-workflows.md +542 -0
- package/.claude/skills/code-investigator/references/language-specific.md +761 -0
- package/.claude/skills/code-investigator/references/search-patterns.md +258 -0
- package/.claude/skills/code-investigator/references/serena-patterns.md +328 -0
- package/.claude/skills/stack-detector/SKILL.md +153 -0
- package/.claude/skills/verification-before-completion/SKILL.md +143 -0
- package/.claude/templates/claude-md-template.md +56 -0
- package/.claude/templates/stacks/express-node.md +134 -0
- package/.claude/templates/stacks/fastapi.md +152 -0
- package/.claude/templates/stacks/generic.md +101 -0
- package/.claude/templates/stacks/nextjs-prisma.md +235 -0
- package/README.md +499 -0
- package/bin/claude-dev-kit.js +11 -0
- package/package.json +31 -0
- package/scripts/install.sh +448 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Error Patterns Reference
|
|
2
|
+
|
|
3
|
+
This document describes the error pattern syntax used in language configs and provides common patterns for each supported language.
|
|
4
|
+
|
|
5
|
+
## Pattern Syntax
|
|
6
|
+
|
|
7
|
+
### Regex Basics
|
|
8
|
+
|
|
9
|
+
All patterns use Python `re` module compatible regular expressions:
|
|
10
|
+
|
|
11
|
+
| Syntax | Meaning | Example |
|
|
12
|
+
|--------|---------|---------|
|
|
13
|
+
| `.` | Any single character | `error.` matches "error:" |
|
|
14
|
+
| `.*` | Any characters (greedy) | `error.*` matches "error: something" |
|
|
15
|
+
| `.+` | One or more characters | `.+\.rs` matches "file.rs" |
|
|
16
|
+
| `\d` | Any digit | `\d+` matches "123" |
|
|
17
|
+
| `\s` | Any whitespace | `\s+` matches spaces/tabs |
|
|
18
|
+
| `()` | Capture group | `(.+):(\d+)` captures file and line |
|
|
19
|
+
| `(?:)` | Non-capturing group | `(?:error\|warning)` matches either |
|
|
20
|
+
| `\[` | Literal bracket | `\[E0308\]` matches "[E0308]" |
|
|
21
|
+
| `^` | Start of line | `^error:` matches line starting with "error:" |
|
|
22
|
+
| `$` | End of line | `\.rs$` matches lines ending in ".rs" |
|
|
23
|
+
|
|
24
|
+
### Capture Groups
|
|
25
|
+
|
|
26
|
+
Capture groups extract data from matched text:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
error_parsing:
|
|
30
|
+
patterns:
|
|
31
|
+
- regex: '(.+):(\d+):(\d+): (error|warning): (.+)'
|
|
32
|
+
file: 1 # First capture group
|
|
33
|
+
line: 2 # Second capture group
|
|
34
|
+
column: 3 # Third capture group
|
|
35
|
+
severity: 4 # Fourth capture group
|
|
36
|
+
message: 5 # Fifth capture group
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Named Capture Groups
|
|
40
|
+
|
|
41
|
+
For clarity, use named groups:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
- regex: '(?P<file>.+):(?P<line>\d+):(?P<col>\d+)'
|
|
45
|
+
file: file
|
|
46
|
+
line: line
|
|
47
|
+
column: col
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Rust Error Patterns
|
|
51
|
+
|
|
52
|
+
### Compiler Errors
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
error[E0308]: mismatched types
|
|
56
|
+
--> src/main.rs:15:20
|
|
57
|
+
|
|
|
58
|
+
15 | let x: i32 = "hello";
|
|
59
|
+
| --- ^^^^^^^ expected `i32`, found `&str`
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Pattern:
|
|
63
|
+
```yaml
|
|
64
|
+
- regex: 'error\[E(\d+)\]:.*\n\s*--> (.+):(\d+):(\d+)'
|
|
65
|
+
code: 1
|
|
66
|
+
file: 2
|
|
67
|
+
line: 3
|
|
68
|
+
column: 4
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Common Rust Error Codes
|
|
72
|
+
|
|
73
|
+
| Code | Description | Auto-fixable |
|
|
74
|
+
|------|-------------|--------------|
|
|
75
|
+
| E0308 | Mismatched types | No |
|
|
76
|
+
| E0382 | Use of moved value | No |
|
|
77
|
+
| E0425 | Cannot find value in scope | No |
|
|
78
|
+
| E0433 | Failed to resolve (unresolved import) | No |
|
|
79
|
+
| E0502 | Cannot borrow as mutable | No |
|
|
80
|
+
| E0597 | Value does not live long enough | No |
|
|
81
|
+
|
|
82
|
+
### Rustfmt Output
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Diff in /src/main.rs at line 5:
|
|
86
|
+
-fn main(){
|
|
87
|
+
+fn main() {
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Pattern:
|
|
91
|
+
```yaml
|
|
92
|
+
- pattern: 'Diff in .+\.rs'
|
|
93
|
+
action: format
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## JavaScript/TypeScript Error Patterns
|
|
97
|
+
|
|
98
|
+
### TypeScript Compiler
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
src/utils.ts(10,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Pattern:
|
|
105
|
+
```yaml
|
|
106
|
+
- regex: '(.+)\((\d+),(\d+)\): error (TS\d+): (.+)'
|
|
107
|
+
file: 1
|
|
108
|
+
line: 2
|
|
109
|
+
column: 3
|
|
110
|
+
code: 4
|
|
111
|
+
message: 5
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### ESLint
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
/src/components/Button.tsx
|
|
118
|
+
5:1 error Unexpected var, use let or const no-var
|
|
119
|
+
12:10 error Missing semicolon semi
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Pattern:
|
|
123
|
+
```yaml
|
|
124
|
+
- regex: '^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$'
|
|
125
|
+
line: 1
|
|
126
|
+
column: 2
|
|
127
|
+
severity: 3
|
|
128
|
+
message: 4
|
|
129
|
+
rule: 5
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Fixable ESLint Errors
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
✖ 5 problems (5 errors, 0 warnings)
|
|
136
|
+
3 errors and 0 warnings potentially fixable with the `--fix` option.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Pattern:
|
|
140
|
+
```yaml
|
|
141
|
+
- pattern: '\d+ errors? and \d+ warnings? potentially fixable'
|
|
142
|
+
action: lint_fix
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Python Error Patterns
|
|
146
|
+
|
|
147
|
+
### Python Traceback
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
Traceback (most recent call last):
|
|
151
|
+
File "src/main.py", line 10, in <module>
|
|
152
|
+
result = process(data)
|
|
153
|
+
TypeError: process() takes 0 positional arguments but 1 was given
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Pattern:
|
|
157
|
+
```yaml
|
|
158
|
+
- regex: 'File "(.+)", line (\d+)'
|
|
159
|
+
file: 1
|
|
160
|
+
line: 2
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Black Formatter
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
would reformat src/utils.py
|
|
167
|
+
would reformat tests/test_main.py
|
|
168
|
+
Oh no! 💥 💔 💥
|
|
169
|
+
2 files would be reformatted.
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Pattern:
|
|
173
|
+
```yaml
|
|
174
|
+
- regex: 'would reformat (.+\.py)'
|
|
175
|
+
file: 1
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Ruff/Flake8
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
src/main.py:10:5: E501 Line too long (120 > 88 characters)
|
|
182
|
+
src/main.py:15:1: F401 'os' imported but unused
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Pattern:
|
|
186
|
+
```yaml
|
|
187
|
+
- regex: '(.+\.py):(\d+):(\d+): ([A-Z]\d+) (.+)'
|
|
188
|
+
file: 1
|
|
189
|
+
line: 2
|
|
190
|
+
column: 3
|
|
191
|
+
code: 4
|
|
192
|
+
message: 5
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## C++ Error Patterns
|
|
196
|
+
|
|
197
|
+
### GCC/Clang
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
src/main.cpp:15:10: error: use of undeclared identifier 'foo'
|
|
201
|
+
int x = foo;
|
|
202
|
+
^
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Pattern:
|
|
206
|
+
```yaml
|
|
207
|
+
- regex: '(.+\.(cpp|cc|cxx|c|h|hpp)):(\d+):(\d+): (error|warning): (.+)'
|
|
208
|
+
file: 1
|
|
209
|
+
line: 3
|
|
210
|
+
column: 4
|
|
211
|
+
severity: 5
|
|
212
|
+
message: 6
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### MSVC
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
src\main.cpp(15): error C2065: 'foo': undeclared identifier
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Pattern:
|
|
222
|
+
```yaml
|
|
223
|
+
- regex: '(.+\.(cpp|cc|cxx|c|h|hpp))\((\d+)\): (error|warning) (C\d+): (.+)'
|
|
224
|
+
file: 1
|
|
225
|
+
line: 3
|
|
226
|
+
severity: 4
|
|
227
|
+
code: 5
|
|
228
|
+
message: 6
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Linker Errors
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
/usr/bin/ld: main.o: undefined reference to `foo()'
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Pattern:
|
|
238
|
+
```yaml
|
|
239
|
+
- regex: 'undefined reference to `(.+)'''
|
|
240
|
+
symbol: 1
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Pattern Precedence
|
|
244
|
+
|
|
245
|
+
1. **Bail patterns are checked first** - If any bail pattern matches, stop immediately
|
|
246
|
+
2. **Error parsing patterns** - Extract file:line:column for reporting
|
|
247
|
+
3. **Fix patterns** - Match against fixable errors
|
|
248
|
+
|
|
249
|
+
## Testing Patterns
|
|
250
|
+
|
|
251
|
+
To test a pattern against sample output:
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
import re
|
|
255
|
+
|
|
256
|
+
pattern = r'error\[E(\d+)\]:.*\n\s*--> (.+):(\d+):(\d+)'
|
|
257
|
+
text = """error[E0308]: mismatched types
|
|
258
|
+
--> src/main.rs:15:20"""
|
|
259
|
+
|
|
260
|
+
match = re.search(pattern, text)
|
|
261
|
+
if match:
|
|
262
|
+
print(f"Code: {match.group(1)}") # E0308
|
|
263
|
+
print(f"File: {match.group(2)}") # src/main.rs
|
|
264
|
+
print(f"Line: {match.group(3)}") # 15
|
|
265
|
+
print(f"Col: {match.group(4)}") # 20
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Common Pitfalls
|
|
269
|
+
|
|
270
|
+
1. **Escaping backslashes** - In YAML, use `\\` for literal backslash
|
|
271
|
+
2. **Greedy matching** - Use `.*?` for non-greedy matching
|
|
272
|
+
3. **Multiline patterns** - Use `\n` or `(?s)` flag for multiline
|
|
273
|
+
4. **Special characters** - Escape `[`, `]`, `(`, `)`, `.`, `*`, `+`, `?`
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-investigator
|
|
3
|
+
description: >-
|
|
4
|
+
Efficient code investigation through targeted searches. Use for (1) investigating
|
|
5
|
+
how code works, (2) debugging specific issues, (3) understanding APIs/libraries,
|
|
6
|
+
(4) exploring large codebases, (5) tracing code paths and call hierarchies,
|
|
7
|
+
(6) finding where symbols are defined/used, or when users request "efficient",
|
|
8
|
+
"trace", "how does X work", "find the bug", "call hierarchy", "who calls this",
|
|
9
|
+
"where is X defined", "find all usages", "what type is this", "go to definition",
|
|
10
|
+
"find references", "symbol lookup", "minimal context", "save tokens", or
|
|
11
|
+
"targeted search" approaches.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Code Investigator
|
|
15
|
+
|
|
16
|
+
Investigate code efficiently through semantic analysis and targeted searches. Minimize token usage by using structured tools before reading files.
|
|
17
|
+
|
|
18
|
+
## Core Philosophy
|
|
19
|
+
|
|
20
|
+
- **Structure before content** - Use `get_symbols_overview` before reading files
|
|
21
|
+
- **Semantic over textual** - Prefer `find_symbol` over Grep when symbol name is known
|
|
22
|
+
- **Snippets over locations** - `find_referencing_symbols` gives context, not just line numbers
|
|
23
|
+
- **Escalate gradually** - Start with zero-cost tools, increase scope only when necessary
|
|
24
|
+
- **Think before concluding** - Use thinking checkpoints to maintain quality
|
|
25
|
+
- **Remember across sessions** - Persist valuable findings in memory
|
|
26
|
+
- **Batch operations** - Run independent searches in parallel
|
|
27
|
+
|
|
28
|
+
## Quick Reference (Serena-First)
|
|
29
|
+
|
|
30
|
+
| Query Type | Serena Tool | LSP Fallback | Grep Fallback |
|
|
31
|
+
|------------|-------------|--------------|---------------|
|
|
32
|
+
| "List symbols in file" | `get_symbols_overview` | `documentSymbol` | Grep definitions |
|
|
33
|
+
| "Where is X defined?" | `find_symbol` (name path) | `goToDefinition` | Grep definition pattern |
|
|
34
|
+
| "Who calls X?" | `find_referencing_symbols` | `incomingCalls` | Grep `functionName\s*\(` |
|
|
35
|
+
| "Find all uses of X" | `find_referencing_symbols` | `findReferences` | Grep pattern |
|
|
36
|
+
| "Find symbol by name" | `find_symbol` (substring) | `workspaceSymbol` | Glob + Grep |
|
|
37
|
+
| "What does X call?" | `find_symbol` + body | `outgoingCalls` | Read function body |
|
|
38
|
+
| "What type is X?" | `find_symbol` + info | `hover` | Infer from context |
|
|
39
|
+
| "Pattern in code only" | `search_for_pattern` | - | Grep with glob |
|
|
40
|
+
| "How does X work?" | `find_symbol` chain | Call hierarchy | Explore agent |
|
|
41
|
+
|
|
42
|
+
## Tool Priority (Lowest to Highest Cost)
|
|
43
|
+
|
|
44
|
+
| Priority | Tool | Best For | Cost |
|
|
45
|
+
|----------|------|----------|------|
|
|
46
|
+
| 1 | **Serena `get_symbols_overview`** | File structure, first look at new files | Zero |
|
|
47
|
+
| 2 | **Serena `find_symbol`** | Known symbol names, name path patterns | Zero |
|
|
48
|
+
| 3 | **Serena `find_referencing_symbols`** | All usages with code snippets | Zero |
|
|
49
|
+
| 4 | **LSP tools** | Call hierarchy, hover, cursor-based ops | Zero |
|
|
50
|
+
| 5 | **Context7** | Third-party library documentation | Low |
|
|
51
|
+
| 6 | **Serena `search_for_pattern`** | Regex with file filtering, code-only | Low |
|
|
52
|
+
| 7 | **Glob / `find_file`** | File discovery by pattern | Low |
|
|
53
|
+
| 8 | **Grep** | Content search (when Serena unavailable) | Medium |
|
|
54
|
+
| 9 | **Git** | Change history (`log -p`, `blame`, `diff`) | Medium |
|
|
55
|
+
| 10 | **Read ranges** | Specific line ranges (`offset`/`limit`) | Medium |
|
|
56
|
+
| 11 | **Read full** | Small files only (<100 lines) | High |
|
|
57
|
+
|
|
58
|
+
## Default Workflow
|
|
59
|
+
|
|
60
|
+
1. **Check memory** - `list_memories` for prior investigation of this area
|
|
61
|
+
2. **Understand structure** - `get_symbols_overview` for new files
|
|
62
|
+
3. **Find symbols** - `find_symbol` for name-based discovery
|
|
63
|
+
4. **Trace references** - `find_referencing_symbols` for usages with context
|
|
64
|
+
5. **Search patterns** - `search_for_pattern` for regex searches
|
|
65
|
+
6. **Quality checkpoint** - `think_about_collected_information` after 3-5 searches
|
|
66
|
+
7. **Fall back** - LSP, then Grep if Serena tools fail
|
|
67
|
+
8. **Persist findings** - `write_memory` for complex investigations
|
|
68
|
+
9. **Report concisely** - Use `file_path:line_number` format
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Serena Tools (Primary)
|
|
73
|
+
|
|
74
|
+
### get_symbols_overview - First Tool for New Files
|
|
75
|
+
|
|
76
|
+
Use this **before reading any file** to understand its structure.
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
Parameters:
|
|
80
|
+
relative_path: "src/auth/login.ts" # Required
|
|
81
|
+
depth: 1 # 0=top-level, 1=+children
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Returns compact symbol tree grouped by kind (classes, functions, methods).
|
|
85
|
+
|
|
86
|
+
### find_symbol - Pattern-Based Symbol Discovery
|
|
87
|
+
|
|
88
|
+
More powerful than LSP - supports name paths and substring matching.
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
Parameters:
|
|
92
|
+
name_path_pattern: "ClassName/method" # Required - supports patterns
|
|
93
|
+
relative_path: "src/" # Scope search (optional)
|
|
94
|
+
depth: 1 # Get children (0=symbol only)
|
|
95
|
+
include_body: false # Include source code
|
|
96
|
+
include_info: true # Include type/signature
|
|
97
|
+
substring_matching: true # Fuzzy matching
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Name path examples:**
|
|
101
|
+
- `"AuthService/login"` - Exact path
|
|
102
|
+
- `"*/render"` - Any class with render method
|
|
103
|
+
- `"validate"` with `substring_matching: true` - Matches validateInput, validateUser, etc.
|
|
104
|
+
|
|
105
|
+
### find_referencing_symbols - Usages with Context
|
|
106
|
+
|
|
107
|
+
Superior to LSP `findReferences` - returns code snippets, not just locations.
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
Parameters:
|
|
111
|
+
name_path: "utils/handleError" # Symbol to find refs for
|
|
112
|
+
relative_path: "src/utils/error.ts" # File containing symbol
|
|
113
|
+
include_info: false # Include signatures
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### search_for_pattern - Filtered Regex Search
|
|
117
|
+
|
|
118
|
+
More powerful than Grep - glob filtering and code-only restriction.
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
Parameters:
|
|
122
|
+
substring_pattern: "TODO|FIXME" # Python regex
|
|
123
|
+
relative_path: "src/" # Scope (optional)
|
|
124
|
+
paths_include_glob: "**/*.ts" # Include patterns
|
|
125
|
+
paths_exclude_glob: "**/*.test.ts" # Exclude patterns
|
|
126
|
+
restrict_search_to_code_files: true # Skip configs/docs
|
|
127
|
+
context_lines_before: 1
|
|
128
|
+
context_lines_after: 2
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Investigation Quality Control
|
|
134
|
+
|
|
135
|
+
Use thinking tools at key checkpoints to maintain investigation rigor.
|
|
136
|
+
|
|
137
|
+
### Checkpoint 1: After Information Gathering
|
|
138
|
+
|
|
139
|
+
**When:** After 3-5 searches or when you feel you have basics.
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
Tool: mcp__serena__think_about_collected_information
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Ask: Do I have enough? Am I missing context? Should I search deeper?
|
|
146
|
+
|
|
147
|
+
### Checkpoint 2: Before Code Changes
|
|
148
|
+
|
|
149
|
+
**When:** Before any insert, replace, or rename operation.
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
Tool: mcp__serena__think_about_task_adherence
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Ask: Am I still on track? Did I drift from the original request?
|
|
156
|
+
|
|
157
|
+
### Checkpoint 3: Before Claiming Done
|
|
158
|
+
|
|
159
|
+
**When:** Before final answer or summary.
|
|
160
|
+
|
|
161
|
+
```yaml
|
|
162
|
+
Tool: mcp__serena__think_about_whether_you_are_done
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Ask: Have I actually answered the question? Are there loose ends?
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Fallback Strategy
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
Symbol Definition:
|
|
173
|
+
find_symbol → LSP goToDefinition → Grep pattern
|
|
174
|
+
|
|
175
|
+
References with Context:
|
|
176
|
+
find_referencing_symbols → LSP findReferences + Read → Grep
|
|
177
|
+
|
|
178
|
+
File Structure:
|
|
179
|
+
get_symbols_overview → LSP documentSymbol → Grep definitions
|
|
180
|
+
|
|
181
|
+
Pattern Search:
|
|
182
|
+
search_for_pattern → Grep with glob → Read + manual search
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### When to Escalate
|
|
186
|
+
|
|
187
|
+
| Condition | Action |
|
|
188
|
+
|-----------|--------|
|
|
189
|
+
| Serena returns empty | Enable `substring_matching`, broaden pattern |
|
|
190
|
+
| Still empty | Try LSP equivalent |
|
|
191
|
+
| LSP fails | Fall back to Grep patterns |
|
|
192
|
+
| File <100 lines | Safe to read fully |
|
|
193
|
+
| Open-ended exploration | Delegate to Explore agent |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Persistent Memory
|
|
198
|
+
|
|
199
|
+
Store findings for multi-session investigations.
|
|
200
|
+
|
|
201
|
+
### When to Use Memory
|
|
202
|
+
|
|
203
|
+
- Investigation took >3 tool calls to complete
|
|
204
|
+
- Complex architecture discovered
|
|
205
|
+
- Bug root cause found
|
|
206
|
+
- Patterns/conventions documented
|
|
207
|
+
|
|
208
|
+
### Memory Workflow
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
# Check for existing findings
|
|
212
|
+
Tool: mcp__serena__list_memories
|
|
213
|
+
|
|
214
|
+
# Read relevant memory
|
|
215
|
+
Tool: mcp__serena__read_memory
|
|
216
|
+
memory_file_name: "auth-flow"
|
|
217
|
+
|
|
218
|
+
# Store new findings
|
|
219
|
+
Tool: mcp__serena__write_memory
|
|
220
|
+
memory_file_name: "auth-flow"
|
|
221
|
+
content: |
|
|
222
|
+
# Auth Flow
|
|
223
|
+
## Entry Points
|
|
224
|
+
- src/auth/login.ts:login()
|
|
225
|
+
## Key Components
|
|
226
|
+
- JWT in src/auth/jwt.ts
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Naming Conventions
|
|
230
|
+
|
|
231
|
+
- `{feature}-architecture` - System overviews
|
|
232
|
+
- `{topic}-investigation` - Deep dive findings
|
|
233
|
+
- `{component}-known-issues` - Documented bugs
|
|
234
|
+
- `codebase-conventions` - Patterns and standards
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## LSP Tools (Fallback)
|
|
239
|
+
|
|
240
|
+
Use when Serena tools are unavailable or for cursor-based operations.
|
|
241
|
+
|
|
242
|
+
| Operation | Use Case |
|
|
243
|
+
|-----------|----------|
|
|
244
|
+
| `goToDefinition` | Jump to declaration |
|
|
245
|
+
| `findReferences` | All usages (locations only) |
|
|
246
|
+
| `hover` | Type info and docs |
|
|
247
|
+
| `documentSymbol` | File symbol list |
|
|
248
|
+
| `workspaceSymbol` | Global symbol search |
|
|
249
|
+
| `incomingCalls` | Who calls this? |
|
|
250
|
+
| `outgoingCalls` | What does this call? |
|
|
251
|
+
|
|
252
|
+
### LSP Supported Languages
|
|
253
|
+
|
|
254
|
+
TypeScript/JavaScript, Python, Rust, Go, C/C++, Java, Kotlin, C#, Swift, PHP, Lua
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Guardrails
|
|
259
|
+
|
|
260
|
+
| Condition | Action |
|
|
261
|
+
|-----------|--------|
|
|
262
|
+
| New file to understand | Use `get_symbols_overview` first |
|
|
263
|
+
| Known symbol name | Use `find_symbol`, not Grep |
|
|
264
|
+
| Need usage context | Use `find_referencing_symbols` |
|
|
265
|
+
| After 3-5 searches | Use `think_about_collected_information` |
|
|
266
|
+
| Before code changes | Use `think_about_task_adherence` |
|
|
267
|
+
| Complex investigation | Store in memory |
|
|
268
|
+
| Serena/LSP fail | Fall back to Grep patterns |
|
|
269
|
+
|
|
270
|
+
## When to Delegate to Explore Agent
|
|
271
|
+
|
|
272
|
+
For open-ended exploration requiring multiple search rounds, use the `Task` tool with `subagent_type="Explore"`:
|
|
273
|
+
|
|
274
|
+
```yaml
|
|
275
|
+
Task:
|
|
276
|
+
subagent_type: "Explore"
|
|
277
|
+
prompt: "Explore how authentication works in this codebase"
|
|
278
|
+
description: "Explore auth system"
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Use Explore agent when:
|
|
282
|
+
- "What is the codebase structure?"
|
|
283
|
+
- "Where are errors handled?"
|
|
284
|
+
- "How does feature X work?" (when starting point unknown)
|
|
285
|
+
- Investigation requires many search iterations
|
|
286
|
+
- You're unsure where to start looking
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Bundled References
|
|
291
|
+
|
|
292
|
+
Load reference files when deeper guidance is needed. To load a reference, read the file at `references/<filename>.md`.
|
|
293
|
+
|
|
294
|
+
| Reference | Use When |
|
|
295
|
+
|-----------|----------|
|
|
296
|
+
| `references/serena-patterns.md` | Serena tool examples, name path patterns, memory patterns |
|
|
297
|
+
| `references/search-patterns.md` | Grep/Glob syntax, output modes, filtering |
|
|
298
|
+
| `references/language-specific.md` | Language-specific Grep fallbacks when Serena/LSP unavailable |
|
|
299
|
+
| `references/investigation-workflows.md` | Complex debugging, tracing, security audit, refactoring prep |
|