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,258 @@
|
|
|
1
|
+
# Search Patterns Reference
|
|
2
|
+
|
|
3
|
+
Patterns for the Grep tool and Glob tool.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Glob Tool Patterns
|
|
8
|
+
|
|
9
|
+
Use Glob for file discovery before content search.
|
|
10
|
+
|
|
11
|
+
### Common Patterns
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
# All TypeScript files
|
|
15
|
+
Glob pattern="**/*.ts"
|
|
16
|
+
|
|
17
|
+
# TypeScript in src directory
|
|
18
|
+
Glob pattern="src/**/*.ts"
|
|
19
|
+
|
|
20
|
+
# Multiple extensions
|
|
21
|
+
Glob pattern="**/*.{ts,tsx,js,jsx}"
|
|
22
|
+
|
|
23
|
+
# Config files
|
|
24
|
+
Glob pattern="**/*.{json,yaml,yml,toml}"
|
|
25
|
+
|
|
26
|
+
# Test files
|
|
27
|
+
Glob pattern="**/*.test.ts" OR Glob pattern="**/*.spec.ts"
|
|
28
|
+
|
|
29
|
+
# Specific directory
|
|
30
|
+
Glob pattern="src/components/**/*.tsx" path="."
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Grep Tool Patterns
|
|
36
|
+
|
|
37
|
+
The Grep tool is built on ripgrep. Use it for all content searches.
|
|
38
|
+
|
|
39
|
+
### Output Modes
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
# Find files containing pattern (fastest for discovery)
|
|
43
|
+
Grep pattern="<pattern>" output_mode="files_with_matches"
|
|
44
|
+
|
|
45
|
+
# Show matching lines with context
|
|
46
|
+
Grep pattern="<pattern>" output_mode="content" -A 5 -B 5
|
|
47
|
+
|
|
48
|
+
# Count matches per file
|
|
49
|
+
Grep pattern="<pattern>" output_mode="count"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Filtering
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
# By file extension
|
|
56
|
+
Grep pattern="<pattern>" glob="*.ts"
|
|
57
|
+
|
|
58
|
+
# By file type (more efficient than glob)
|
|
59
|
+
Grep pattern="<pattern>" type="py"
|
|
60
|
+
|
|
61
|
+
# Multiple extensions
|
|
62
|
+
Grep pattern="<pattern>" glob="*.{ts,tsx,js,jsx}"
|
|
63
|
+
|
|
64
|
+
# Specific directory
|
|
65
|
+
Grep pattern="<pattern>" path="src/components"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Context Control
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
# Lines after match
|
|
72
|
+
Grep pattern="<pattern>" -A 10 output_mode="content"
|
|
73
|
+
|
|
74
|
+
# Lines before match
|
|
75
|
+
Grep pattern="<pattern>" -B 5 output_mode="content"
|
|
76
|
+
|
|
77
|
+
# Lines before and after
|
|
78
|
+
Grep pattern="<pattern>" -C 5 output_mode="content"
|
|
79
|
+
|
|
80
|
+
# With line numbers (default true)
|
|
81
|
+
Grep pattern="<pattern>" -n true output_mode="content"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Limiting Results
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
# First N results
|
|
88
|
+
Grep pattern="<pattern>" head_limit=10
|
|
89
|
+
|
|
90
|
+
# Skip first N, then take M
|
|
91
|
+
Grep pattern="<pattern>" offset=5 head_limit=10
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Multiline Matching
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
# Match patterns spanning lines
|
|
98
|
+
Grep pattern="class.*\{[\s\S]*?constructor" multiline=true
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Case Insensitive
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Grep pattern="error" -i=true output_mode="content"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Common Search Recipes
|
|
110
|
+
|
|
111
|
+
### Find Function/Method Definitions
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
# JavaScript/TypeScript
|
|
115
|
+
Grep pattern="^\s*(export\s+)?(async\s+)?function\s+functionName" type="ts"
|
|
116
|
+
Grep pattern="^\s*(public|private|protected)?\s*(async\s+)?functionName\s*\(" type="ts"
|
|
117
|
+
|
|
118
|
+
# Python
|
|
119
|
+
Grep pattern="^\s*def\s+function_name\s*\(" type="py"
|
|
120
|
+
Grep pattern="^\s*async\s+def\s+function_name\s*\(" type="py"
|
|
121
|
+
|
|
122
|
+
# Rust
|
|
123
|
+
Grep pattern="^\s*(pub\s+)?fn\s+function_name" type="rust"
|
|
124
|
+
|
|
125
|
+
# Go
|
|
126
|
+
Grep pattern="^func\s+(\([^)]+\)\s+)?FunctionName" type="go"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Find Class/Type Definitions
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
# JavaScript/TypeScript
|
|
133
|
+
Grep pattern="^\s*(export\s+)?(abstract\s+)?class\s+ClassName" type="ts"
|
|
134
|
+
Grep pattern="^\s*(export\s+)?interface\s+InterfaceName" type="ts"
|
|
135
|
+
Grep pattern="^\s*(export\s+)?type\s+TypeName\s*=" type="ts"
|
|
136
|
+
|
|
137
|
+
# Python
|
|
138
|
+
Grep pattern="^\s*class\s+ClassName\s*[\(:]" type="py"
|
|
139
|
+
|
|
140
|
+
# Rust
|
|
141
|
+
Grep pattern="^\s*(pub\s+)?struct\s+StructName" type="rust"
|
|
142
|
+
Grep pattern="^\s*(pub\s+)?enum\s+EnumName" type="rust"
|
|
143
|
+
|
|
144
|
+
# Go
|
|
145
|
+
Grep pattern="^type\s+TypeName\s+struct" type="go"
|
|
146
|
+
Grep pattern="^type\s+InterfaceName\s+interface" type="go"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Find Imports/Dependencies
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
# JavaScript/TypeScript
|
|
153
|
+
Grep pattern="^import.*from\s+['\"]moduleName['\"]" type="ts"
|
|
154
|
+
Grep pattern="require\(['\"]moduleName['\"]\)" type="js"
|
|
155
|
+
|
|
156
|
+
# Python
|
|
157
|
+
Grep pattern="^(from\s+\S+\s+)?import\s+.*module_name" type="py"
|
|
158
|
+
|
|
159
|
+
# Rust
|
|
160
|
+
Grep pattern="^use\s+.*crate_name" type="rust"
|
|
161
|
+
|
|
162
|
+
# Go
|
|
163
|
+
Grep pattern="^\s*\".*package/path\"" type="go"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Find Error Handling
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
# Try-catch blocks
|
|
170
|
+
Grep pattern="try\s*\{" -A 20 output_mode="content" type="ts"
|
|
171
|
+
|
|
172
|
+
# Throw statements
|
|
173
|
+
Grep pattern="throw\s+new\s+\w+Error" type="ts"
|
|
174
|
+
|
|
175
|
+
# Error returns (Go)
|
|
176
|
+
Grep pattern="return.*err\s*$" type="go"
|
|
177
|
+
Grep pattern="if\s+err\s*!=\s*nil" type="go"
|
|
178
|
+
|
|
179
|
+
# Rust Result/Error
|
|
180
|
+
Grep pattern="Result<[^>]+>" type="rust"
|
|
181
|
+
Grep pattern="\.(unwrap|expect)\s*\(" type="rust"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Find TODO/FIXME Comments
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
# All markers
|
|
188
|
+
Grep pattern="(TODO|FIXME|HACK|XXX|BUG):" -i=true output_mode="content"
|
|
189
|
+
|
|
190
|
+
# With author
|
|
191
|
+
Grep pattern="TODO\([^)]+\):" output_mode="content"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Find API Endpoints
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
# Express/Node.js
|
|
198
|
+
Grep pattern="\.(get|post|put|delete|patch)\s*\(['\"]" type="ts"
|
|
199
|
+
|
|
200
|
+
# FastAPI/Flask
|
|
201
|
+
Grep pattern="@(app|router)\.(get|post|put|delete|patch)\s*\(" type="py"
|
|
202
|
+
|
|
203
|
+
# Go HTTP
|
|
204
|
+
Grep pattern="\.(HandleFunc|Handle|Get|Post|Put|Delete)\s*\(" type="go"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Find React Components
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
# Function components
|
|
211
|
+
Grep pattern="^\s*(export\s+)?(default\s+)?function\s+[A-Z]\w+" type="tsx"
|
|
212
|
+
Grep pattern="^\s*const\s+[A-Z]\w+\s*[:=]\s*(React\.)?FC" type="tsx"
|
|
213
|
+
|
|
214
|
+
# Hooks
|
|
215
|
+
Grep pattern="^\s*(export\s+)?(const|function)\s+use[A-Z]\w+" type="ts"
|
|
216
|
+
|
|
217
|
+
# Props interfaces
|
|
218
|
+
Grep pattern="interface\s+\w+Props" type="ts"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Converting Grep Results to Read Ranges
|
|
224
|
+
|
|
225
|
+
When Grep returns line numbers, calculate Read parameters:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
offset = max(matched_line - padding, 0)
|
|
229
|
+
limit = padding * 2 + span
|
|
230
|
+
|
|
231
|
+
Padding guidelines:
|
|
232
|
+
- Functions: 10-15 lines
|
|
233
|
+
- Configuration: 5 lines
|
|
234
|
+
- Multi-branch logic: 15-20 lines
|
|
235
|
+
- Single statements: 3-5 lines
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Example: Grep finds match at line 150 in a function context.
|
|
239
|
+
```
|
|
240
|
+
offset = max(150 - 15, 0) = 135
|
|
241
|
+
limit = 15 * 2 + 1 = 31
|
|
242
|
+
Read file="path" offset=135 limit=31
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Parallel Search Strategy
|
|
248
|
+
|
|
249
|
+
Batch independent searches in a single response:
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
# Search for multiple patterns simultaneously
|
|
253
|
+
Grep pattern="functionA" output_mode="files_with_matches"
|
|
254
|
+
Grep pattern="functionB" output_mode="files_with_matches"
|
|
255
|
+
Grep pattern="functionC" output_mode="files_with_matches"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
This reduces round-trips and speeds up investigation.
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Serena MCP Patterns Reference
|
|
2
|
+
|
|
3
|
+
Detailed patterns and examples for Serena MCP tools in code investigation.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Name Path Patterns
|
|
8
|
+
|
|
9
|
+
Serena's `find_symbol` uses name paths to identify symbols within files.
|
|
10
|
+
|
|
11
|
+
### Pattern Syntax
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
[ParentSymbol/]SymbolName[/ChildSymbol]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Examples
|
|
18
|
+
|
|
19
|
+
| Pattern | Matches |
|
|
20
|
+
|---------|---------|
|
|
21
|
+
| `"MyClass"` | Class named MyClass |
|
|
22
|
+
| `"MyClass/method"` | Method `method` in `MyClass` |
|
|
23
|
+
| `"MyClass/__init__"` | Constructor of `MyClass` (Python) |
|
|
24
|
+
| `"*/render"` | Any `render` method in any class |
|
|
25
|
+
| `"validate"` + `substring_matching: true` | validateInput, validateUser, isValid, etc. |
|
|
26
|
+
|
|
27
|
+
### Overloaded Methods (Java/C++)
|
|
28
|
+
|
|
29
|
+
When methods are overloaded, append index:
|
|
30
|
+
- `"MyClass/method[0]"` - First overload
|
|
31
|
+
- `"MyClass/method[1]"` - Second overload
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## get_symbols_overview Patterns
|
|
36
|
+
|
|
37
|
+
### Pattern 1: First Contact with File
|
|
38
|
+
|
|
39
|
+
Always use this before reading a new file.
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
Tool: mcp__serena__get_symbols_overview
|
|
43
|
+
Parameters:
|
|
44
|
+
relative_path: "src/auth/middleware.ts"
|
|
45
|
+
depth: 0 # Top-level only for overview
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Output structure:**
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"classes": ["AuthMiddleware", "TokenValidator"],
|
|
52
|
+
"functions": ["authenticate", "authorize"],
|
|
53
|
+
"interfaces": ["AuthConfig", "UserContext"]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Pattern 2: Class Exploration
|
|
58
|
+
|
|
59
|
+
Get class with all its methods.
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
Tool: mcp__serena__get_symbols_overview
|
|
63
|
+
Parameters:
|
|
64
|
+
relative_path: "src/services/UserService.ts"
|
|
65
|
+
depth: 1 # Include class methods
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## find_symbol Patterns
|
|
71
|
+
|
|
72
|
+
### Pattern 1: Exact Symbol Lookup
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
Tool: mcp__serena__find_symbol
|
|
76
|
+
Parameters:
|
|
77
|
+
name_path_pattern: "AuthService/validateToken"
|
|
78
|
+
include_body: true # Get implementation
|
|
79
|
+
include_info: true # Get type signature
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Pattern 2: Find All Methods of a Class
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
Tool: mcp__serena__find_symbol
|
|
86
|
+
Parameters:
|
|
87
|
+
name_path_pattern: "UserRepository"
|
|
88
|
+
depth: 1 # Get all methods
|
|
89
|
+
include_body: false # Just names, not code
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Pattern 3: Fuzzy Symbol Search
|
|
93
|
+
|
|
94
|
+
When you know partial name:
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
Tool: mcp__serena__find_symbol
|
|
98
|
+
Parameters:
|
|
99
|
+
name_path_pattern: "handle"
|
|
100
|
+
substring_matching: true
|
|
101
|
+
relative_path: "src/handlers/" # Narrow scope
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Matches: handleRequest, handleError, errorHandler, etc.
|
|
105
|
+
|
|
106
|
+
### Pattern 4: Find All Implementations
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
Tool: mcp__serena__find_symbol
|
|
110
|
+
Parameters:
|
|
111
|
+
name_path_pattern: "*/process" # Any class with process method
|
|
112
|
+
include_info: true
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Pattern 5: Scoped Search
|
|
116
|
+
|
|
117
|
+
Limit search to specific directory:
|
|
118
|
+
|
|
119
|
+
```yaml
|
|
120
|
+
Tool: mcp__serena__find_symbol
|
|
121
|
+
Parameters:
|
|
122
|
+
name_path_pattern: "Controller"
|
|
123
|
+
substring_matching: true
|
|
124
|
+
relative_path: "src/api/"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## find_referencing_symbols Patterns
|
|
130
|
+
|
|
131
|
+
### Pattern 1: Who Calls This Function?
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
Tool: mcp__serena__find_referencing_symbols
|
|
135
|
+
Parameters:
|
|
136
|
+
name_path: "utils/logger"
|
|
137
|
+
relative_path: "src/utils/logger.ts"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Returns code snippets around each call site.
|
|
141
|
+
|
|
142
|
+
### Pattern 2: Track Interface Usage
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
Tool: mcp__serena__find_referencing_symbols
|
|
146
|
+
Parameters:
|
|
147
|
+
name_path: "IUserRepository"
|
|
148
|
+
relative_path: "src/interfaces/repository.ts"
|
|
149
|
+
include_info: true # Get type info at each site
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Pattern 3: Find All Instantiations
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
Tool: mcp__serena__find_referencing_symbols
|
|
156
|
+
Parameters:
|
|
157
|
+
name_path: "DatabaseConnection"
|
|
158
|
+
relative_path: "src/db/connection.ts"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## search_for_pattern Patterns
|
|
164
|
+
|
|
165
|
+
### Pattern 1: TODO Comments in Code Only
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
Tool: mcp__serena__search_for_pattern
|
|
169
|
+
Parameters:
|
|
170
|
+
substring_pattern: "TODO|FIXME|HACK|XXX"
|
|
171
|
+
restrict_search_to_code_files: true
|
|
172
|
+
paths_exclude_glob: "**/*.test.*"
|
|
173
|
+
context_lines_after: 1
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Pattern 2: Error Handling Patterns
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
Tool: mcp__serena__search_for_pattern
|
|
180
|
+
Parameters:
|
|
181
|
+
substring_pattern: "catch\\s*\\([^)]*Error"
|
|
182
|
+
paths_include_glob: "**/*.ts"
|
|
183
|
+
context_lines_before: 2
|
|
184
|
+
context_lines_after: 5
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Pattern 3: API Endpoints
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
Tool: mcp__serena__search_for_pattern
|
|
191
|
+
Parameters:
|
|
192
|
+
substring_pattern: "@(Get|Post|Put|Delete|Patch)Mapping"
|
|
193
|
+
paths_include_glob: "**/*Controller.java"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Pattern 4: Environment Variables
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
Tool: mcp__serena__search_for_pattern
|
|
200
|
+
Parameters:
|
|
201
|
+
substring_pattern: "process\\.env\\."
|
|
202
|
+
restrict_search_to_code_files: true
|
|
203
|
+
paths_exclude_glob: "**/*.test.*"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Pattern 5: SQL Queries
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
Tool: mcp__serena__search_for_pattern
|
|
210
|
+
Parameters:
|
|
211
|
+
substring_pattern: "(SELECT|INSERT|UPDATE|DELETE).*FROM"
|
|
212
|
+
restrict_search_to_code_files: true
|
|
213
|
+
context_lines_before: 3
|
|
214
|
+
context_lines_after: 3
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Memory Patterns
|
|
220
|
+
|
|
221
|
+
### Pattern 1: Architecture Documentation
|
|
222
|
+
|
|
223
|
+
```yaml
|
|
224
|
+
Tool: mcp__serena__write_memory
|
|
225
|
+
Parameters:
|
|
226
|
+
memory_file_name: "api-architecture"
|
|
227
|
+
content: |
|
|
228
|
+
# API Architecture
|
|
229
|
+
|
|
230
|
+
## Entry Points
|
|
231
|
+
- src/api/router.ts - Main router
|
|
232
|
+
- src/api/middleware/ - Auth, logging, validation
|
|
233
|
+
|
|
234
|
+
## Layers
|
|
235
|
+
- Controllers: src/api/controllers/
|
|
236
|
+
- Services: src/services/
|
|
237
|
+
- Repositories: src/repositories/
|
|
238
|
+
|
|
239
|
+
## Key Patterns
|
|
240
|
+
- All controllers extend BaseController
|
|
241
|
+
- Services use dependency injection
|
|
242
|
+
- Repositories implement IRepository interface
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Pattern 2: Bug Investigation Notes
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
Tool: mcp__serena__write_memory
|
|
249
|
+
Parameters:
|
|
250
|
+
memory_file_name: "auth-timeout-bug"
|
|
251
|
+
content: |
|
|
252
|
+
# Auth Timeout Bug Investigation
|
|
253
|
+
|
|
254
|
+
## Symptoms
|
|
255
|
+
- Users logged out after 5 minutes
|
|
256
|
+
- Only on production
|
|
257
|
+
|
|
258
|
+
## Root Cause
|
|
259
|
+
- Token refresh race condition in src/auth/refresh.ts:45
|
|
260
|
+
- Concurrent requests cause token invalidation
|
|
261
|
+
|
|
262
|
+
## Fix
|
|
263
|
+
- Add mutex lock around token refresh
|
|
264
|
+
- See PR #234
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Pattern 3: Retrieving Context
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
# Start of investigation
|
|
271
|
+
Tool: mcp__serena__list_memories
|
|
272
|
+
|
|
273
|
+
# If relevant memory exists
|
|
274
|
+
Tool: mcp__serena__read_memory
|
|
275
|
+
Parameters:
|
|
276
|
+
memory_file_name: "api-architecture"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Investigation Workflows
|
|
282
|
+
|
|
283
|
+
For complete investigation workflows with Serena patterns, see `references/investigation-workflows.md`.
|
|
284
|
+
|
|
285
|
+
**Quick workflow summary:**
|
|
286
|
+
|
|
287
|
+
1. **Debug Error:** `search_for_pattern` → `find_symbol` → `find_referencing_symbols` → `think_about_collected_information`
|
|
288
|
+
|
|
289
|
+
2. **Trace Code Path:** `find_symbol` → `find_referencing_symbols` (recursive) → `write_memory`
|
|
290
|
+
|
|
291
|
+
3. **Understand Feature:** `list_dir` → `get_symbols_overview` → `find_symbol` → `find_referencing_symbols` → `write_memory`
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Error Handling
|
|
296
|
+
|
|
297
|
+
### Symbol Not Found
|
|
298
|
+
|
|
299
|
+
```yaml
|
|
300
|
+
Symptom: find_symbol returns empty
|
|
301
|
+
Actions:
|
|
302
|
+
1. Enable substring_matching: true
|
|
303
|
+
2. Broaden name_path_pattern (remove parent path)
|
|
304
|
+
3. Check relative_path scope
|
|
305
|
+
4. Fall back to search_for_pattern
|
|
306
|
+
5. Fall back to LSP workspaceSymbol
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Language Not Supported
|
|
310
|
+
|
|
311
|
+
```yaml
|
|
312
|
+
Symptom: "Unsupported language" error
|
|
313
|
+
Actions:
|
|
314
|
+
1. Fall back to LSP if available
|
|
315
|
+
2. Fall back to Grep patterns
|
|
316
|
+
3. Use language-specific patterns from language-specific.md
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Too Many Results
|
|
320
|
+
|
|
321
|
+
```yaml
|
|
322
|
+
Symptom: Output truncated or overwhelming
|
|
323
|
+
Actions:
|
|
324
|
+
1. Narrow relative_path scope
|
|
325
|
+
2. Use paths_include_glob to filter
|
|
326
|
+
3. Use paths_exclude_glob to exclude tests/generated
|
|
327
|
+
4. Add depth: 0 to reduce nesting
|
|
328
|
+
```
|