1
- # Claude Task Parallelization Guidelines
1
+ # Claude Task Parallelization & Development Guidelines
2
2
3
3
## Core Principles
4
4
@@ -44,7 +44,7 @@ Analyze the request and immediately split into parallel tasks based on:
44
44
- Task 6: Type definitions (if typed language)
45
45
- Task 7: Remaining changes and coordination
46
46
47
- #### Example 2: Bug Investigation (3-5 parallel tasks)
47
+ #### Example 2: Bug Investigation (3-10 parallel tasks)
48
48
- Task 1: Search for error patterns in logs/code
49
49
- Task 2: Analyze related test files
50
50
- Task 3: Check recent commits/changes
@@ -107,6 +107,10 @@ Always include a final review task that:
107
107
2 . ** FOLLOW CONVENTIONS** : Match existing naming, file organization, and code style
108
108
3 . ** REUSE COMPONENTS** : Use existing utilities, hooks, and components before creating new ones
109
109
4 . ** ATOMIC CHANGES** : Each task makes self-contained, non-conflicting modifications
110
+ 5 . ** TEST COVERAGE** : Maintain or improve test coverage with changes
111
+ 6 . ** BACKWARDS COMPATIBILITY** : Ensure changes don't break existing functionality
112
+ 7 . ** PERFORMANCE AWARE** : Consider performance implications of changes
113
+ 8 . ** SECURITY CONSCIOUS** : Never introduce security vulnerabilities
110
114
111
115
### Efficiency Practices
112
116
- Launch all tasks in a single message using multiple tool invocations
@@ -117,6 +121,10 @@ Always include a final review task that:
117
121
- Each task should handle its own errors gracefully
118
122
- If a task encounters blockers, it should document them clearly
119
123
- The review task should identify and resolve integration issues
124
+ - Always provide actionable error messages
125
+ - Suggest fixes for common errors encountered
126
+ - Log errors with context for debugging
127
+ - Fail fast but provide recovery options
120
128
121
129
## Parallelization Examples
122
130
@@ -179,6 +187,10 @@ Claude: [Launches 5 parallel tasks immediately]
179
187
- ✓ Use more tasks for complex or multi-file operations
180
188
- ✓ Include a coordination/review task at the end
181
189
- ✓ Adapt task count based on request complexity
190
+ - ✓ Verify changes with tests and linting
191
+ - ✓ Follow existing code patterns and conventions
192
+ - ✓ Provide clear summaries of changes made
193
+ - ✓ Use TodoWrite to track progress on complex tasks
182
194
183
195
### Don'ts
184
196
- ✗ Use a single task when multiple would be faster
@@ -187,6 +199,10 @@ Claude: [Launches 5 parallel tasks immediately]
187
199
- ✗ Load entire codebase into a single task
188
200
- ✗ Create documentation unless specifically requested
189
201
- ✗ Limit parallelization to specific languages/frameworks
202
+ - ✗ Make breaking changes without user consent
203
+ - ✗ Ignore existing architectural patterns
204
+ - ✗ Skip running tests after changes
205
+ - ✗ Create new files when existing ones can be modified
190
206
191
207
## Performance Optimization
192
208
@@ -196,6 +212,9 @@ Claude: [Launches 5 parallel tasks immediately]
196
212
- Focus on specific patterns/directories per task
197
213
- Avoid redundant file reads across tasks
198
214
- Use glob patterns to efficiently find relevant files
215
+ - Prioritize reading only the sections of files needed
216
+ - Use line offset/limit for large files
217
+ - Cache file structure understanding across tasks
199
218
200
219
### Parallel Execution Benefits
201
220
- 3-10x faster execution through parallelization
@@ -214,44 +233,69 @@ Claude: [Launches 5 parallel tasks immediately]
214
233
5 . ** Analysis requested** - Different angles of analysis
215
234
6 . ** Performance issues** - Parallel investigation paths
216
235
7 . ** Refactoring** - Separate tasks for finding and updating
236
+ 8 . ** Debugging** - Multiple hypotheses to investigate simultaneously
237
+ 9 . ** Feature implementation** - Core logic, tests, integration, configuration
238
+ 10 . ** Code review** - Architecture, performance, security, maintainability
239
+ 11 . ** Migration tasks** - Old code analysis, new implementation, testing
240
+ 12 . ** Optimization** - Identify bottlenecks, implement fixes, verify improvements
217
241
218
242
### Parallelization Mindset
219
243
- Think "How can I split this?" not "Should I split this?"
220
244
- Default to MORE tasks rather than fewer
221
245
- Every request deserves parallel execution
222
246
- Speed and thoroughness come from parallelization
223
247
- Independent tasks = maximum efficiency
248
+ - Each task should complete in under 30 seconds ideally
249
+ - Tasks should have clear, measurable outcomes
250
+ - Consider task dependencies only in the review phase
224
251
225
- ## Tool Preferences
252
+ ## Tool Usage Guidelines
226
253
227
254
### Package Manager
228
255
- ** ALWAYS use pnpm** : Never use npm, always use pnpm for all package operations
229
256
- Commands: ` pnpm install ` , ` pnpm add ` , ` pnpm run ` , etc.
230
257
- If pnpm is not available, inform the user to install it
231
-
232
- ### Code Search Optimization
233
- - ** Prefer ast-grep** : Use ` mcp__ast-grep__ast_grep_search ` for structural code searches
234
- - ast-grep is superior for finding code patterns, function definitions, and structural elements
235
- - Use ast-grep when searching for:
236
- - Function/class definitions
237
- - Specific code patterns
238
- - Variable usage across files
239
- - Structural code elements
240
- - Refactoring targets
241
- - Fall back to Grep only for simple text searches or when ast-grep isn't suitable
242
-
243
- ### Example ast-grep Usage
244
- ```
245
- # Instead of using Grep for finding function definitions:
246
- # Bad: Grep for "function getUserData"
247
- # Good: ast-grep search for function definition pattern
248
-
249
- # Finding all React components:
250
- pattern: "const $COMPONENT = () => { $$$ }"
251
-
252
- # Finding specific function calls:
253
- pattern: "getUserData($$$)"
254
- ```
258
+ - Check package.json for existing scripts before creating new ones
259
+
260
+ ### Testing & Quality
261
+ - ** Run tests after changes** : Always run the project's test suite after making modifications
262
+ - ** Lint & Format** : Run linting and formatting tools (eslint, prettier, etc.) to ensure code quality
263
+ - ** Build verification** : Verify the project builds successfully after changes
264
+ - ** Type checking** : Run TypeScript compiler or type checker if applicable
265
+
266
+ ### Git Best Practices
267
+ - ** Small, focused commits** : Make atomic commits with clear messages
268
+ - ** Branch management** : Create feature branches for significant changes
269
+ - ** Review changes** : Always review git diff before committing
270
+ - ** Commit message format** : Follow project's commit message conventions
271
+
272
+ ## Development Best Practices
273
+
274
+ ### Code Quality Standards
275
+ - ** Clean Code** : Write self-documenting code with meaningful variable names
276
+ - ** DRY Principle** : Don't Repeat Yourself - extract common logic
277
+ - ** SOLID Principles** : Follow when applicable to the language/framework
278
+ - ** Comments** : Only add when code intent isn't clear from reading
279
+
280
+ ### Performance Considerations
281
+ - ** Lazy Loading** : Implement where appropriate for better initial load
282
+ - ** Memoization** : Use for expensive computations
283
+ - ** Bundle Size** : Be mindful of import sizes and tree-shaking
284
+ - ** Async Operations** : Properly handle promises and avoid blocking
285
+
286
+ ### Security Guidelines
287
+ - ** Input Validation** : Always validate user inputs
288
+ - ** Sanitization** : Sanitize data before rendering or storing
289
+ - ** Dependencies** : Keep dependencies up to date
290
+ - ** Secrets** : Never commit secrets or API keys
291
+
292
+ ## Communication Guidelines
293
+
294
+ ### Progress Updates
295
+ - Provide concise updates after each major step
296
+ - Use TodoWrite for complex multi-step tasks
297
+ - Summarize findings clearly at the end
298
+ - Highlight any blockers or issues encountered
255
299
256
300
Avaliable pnpm commands in workspace, can run with pnpm [ script] -w
257
301
0 commit comments