Skip to content

Commit 14937d7

Browse files
docs: add architectural documentation in arch-doc directory (#3955)
Co-authored-by: Claude <[email protected]>
1 parent 38b8d24 commit 14937d7

12 files changed

+15702
-27
lines changed

CLAUDE.md

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Claude Task Parallelization Guidelines
1+
# Claude Task Parallelization & Development Guidelines
22

33
## Core Principles
44

@@ -44,7 +44,7 @@ Analyze the request and immediately split into parallel tasks based on:
4444
- Task 6: Type definitions (if typed language)
4545
- Task 7: Remaining changes and coordination
4646

47-
#### Example 2: Bug Investigation (3-5 parallel tasks)
47+
#### Example 2: Bug Investigation (3-10 parallel tasks)
4848
- Task 1: Search for error patterns in logs/code
4949
- Task 2: Analyze related test files
5050
- Task 3: Check recent commits/changes
@@ -107,6 +107,10 @@ Always include a final review task that:
107107
2. **FOLLOW CONVENTIONS**: Match existing naming, file organization, and code style
108108
3. **REUSE COMPONENTS**: Use existing utilities, hooks, and components before creating new ones
109109
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
110114

111115
### Efficiency Practices
112116
- Launch all tasks in a single message using multiple tool invocations
@@ -117,6 +121,10 @@ Always include a final review task that:
117121
- Each task should handle its own errors gracefully
118122
- If a task encounters blockers, it should document them clearly
119123
- 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
120128

121129
## Parallelization Examples
122130

@@ -179,6 +187,10 @@ Claude: [Launches 5 parallel tasks immediately]
179187
- ✓ Use more tasks for complex or multi-file operations
180188
- ✓ Include a coordination/review task at the end
181189
- ✓ 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
182194

183195
### Don'ts
184196
- ✗ Use a single task when multiple would be faster
@@ -187,6 +199,10 @@ Claude: [Launches 5 parallel tasks immediately]
187199
- ✗ Load entire codebase into a single task
188200
- ✗ Create documentation unless specifically requested
189201
- ✗ 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
190206

191207
## Performance Optimization
192208

@@ -196,6 +212,9 @@ Claude: [Launches 5 parallel tasks immediately]
196212
- Focus on specific patterns/directories per task
197213
- Avoid redundant file reads across tasks
198214
- 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
199218

200219
### Parallel Execution Benefits
201220
- 3-10x faster execution through parallelization
@@ -214,44 +233,69 @@ Claude: [Launches 5 parallel tasks immediately]
214233
5. **Analysis requested** - Different angles of analysis
215234
6. **Performance issues** - Parallel investigation paths
216235
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
217241

218242
### Parallelization Mindset
219243
- Think "How can I split this?" not "Should I split this?"
220244
- Default to MORE tasks rather than fewer
221245
- Every request deserves parallel execution
222246
- Speed and thoroughness come from parallelization
223247
- 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
224251

225-
## Tool Preferences
252+
## Tool Usage Guidelines
226253

227254
### Package Manager
228255
- **ALWAYS use pnpm**: Never use npm, always use pnpm for all package operations
229256
- Commands: `pnpm install`, `pnpm add`, `pnpm run`, etc.
230257
- 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
255299

256300
Avaliable pnpm commands in workspace, can run with pnpm [script] -w
257301

0 commit comments

Comments
 (0)