Skip to content

Commit 5c78f58

Browse files
committed
update claude
1 parent beebe7d commit 5c78f58

File tree

1 file changed

+224
-31
lines changed

1 file changed

+224
-31
lines changed

CLAUDE.md

Lines changed: 224 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,39 @@ The standardized deprecation utilities provide:
8787

8888
Claude Code includes specialized agents that should be used PROACTIVELY for specific development tasks. Each agent has specialized knowledge and tools optimized for their domain.
8989

90-
### When to Use Each Agent
90+
### Core Development Agents
9191

9292
#### **python-developer**
9393
Use for project-x-py SDK development tasks:
9494
- Writing async trading components (OrderManager, PositionManager, etc.)
9595
- Implementing financial indicators with Polars DataFrames
9696
- Optimizing real-time data processing and WebSocket connections
9797
- Creating new TradingSuite features
98-
- Ensuring 100% async architecture compliance
99-
- Handling Decimal price precision requirements
98+
- Performance profiling with memory_profiler and py-spy
99+
- Integration testing with mock market data generators
100+
- Benchmark suite management for performance tracking
101+
- WebSocket load testing and stress testing
100102

101103
Example scenarios:
102104
- "Implement a new technical indicator"
103105
- "Add WebSocket reconnection logic"
104106
- "Create async order placement methods"
107+
- "Profile memory usage in real-time data manager"
108+
109+
Enhanced capabilities:
110+
- Memory profiling: `mprof run ./test.sh examples/04_realtime_data.py`
111+
- Async profiling: `py-spy record -o profile.svg -- ./test.sh examples/00_trading_suite_demo.py`
112+
- Benchmark tests: `uv run pytest tests/benchmarks/ --benchmark-only`
105113

106114
#### **code-standards-enforcer**
107115
Use PROACTIVELY for maintaining SDK standards:
108116
- **ALWAYS check IDE diagnostics first** via `mcp__ide__getDiagnostics`
109-
- Before committing changes (enforce standards)
110-
- PR review checks
111-
- Release validation
117+
- Automated pre-commit hook setup and validation
118+
- Performance regression detection with benchmarks
119+
- Memory leak detection via tracemalloc
120+
- Security vulnerability scanning with bandit
121+
- Dependency audit with pip-audit
112122
- Verifying 100% async architecture
113-
- Checking TradingSuite patterns compliance
114-
- Ensuring Polars-only DataFrames usage
115-
- Validating deprecation compliance
116123
- Type safety with TypedDict/Protocol
117124

118125
Example scenarios:
@@ -121,27 +128,35 @@ Example scenarios:
121128
- When refactoring existing code
122129
- **After any code changes** - check IDE diagnostics immediately
123130

131+
Enhanced tools:
132+
- Security scanning: `uv run bandit -r src/`
133+
- Dependency audit: `uv run pip-audit`
134+
- Pre-commit validation: `pre-commit run --all-files`
135+
124136
#### **code-refactor**
125137
Use PROACTIVELY for architecture improvements:
138+
- AST-based code analysis for safe refactoring
139+
- Dependency graph visualization with pydeps
140+
- API migration script generation
141+
- Performance impact analysis
126142
- Migrating to TradingSuite patterns
127143
- Optimizing Polars operations
128144
- Consolidating WebSocket handling
129145
- Modernizing async patterns
130-
- Monolithic to modular transitions
131-
- Event system optimization
132-
- Memory management improvements
133146

134147
Example scenarios:
135148
- "Refactor OrderManager to use EventBus"
136149
- "Optimize DataFrame operations in indicators"
137150
- "Migrate legacy sync code to async"
151+
- "Visualize component dependencies"
138152

139153
#### **code-documenter**
140154
Use PROACTIVELY for documentation tasks:
141-
- Documenting new TradingSuite APIs
142-
- Writing indicator function docs
143-
- Explaining WebSocket events
144-
- Creating migration guides
155+
- Interactive API documentation with mkdocs-material
156+
- Automated changelog generation from commits
157+
- Example notebook generation with papermill
158+
- API reference auto-generation with mkdocstrings
159+
- Writing migration guides
145160
- Maintaining README and examples/
146161
- Writing deprecation notices
147162
- Updating docstrings
@@ -150,53 +165,231 @@ Example scenarios:
150165
- After adding new features
151166
- When changing APIs
152167
- Creating example scripts
168+
- Generating interactive documentation
169+
170+
Enhanced documentation:
171+
- Build docs: `mkdocs build`
172+
- Serve locally: `mkdocs serve`
173+
- Generate notebooks: `papermill template.ipynb output.ipynb`
153174

154175
#### **code-debugger**
155176
Use PROACTIVELY for troubleshooting:
156-
- WebSocket disconnection issues
177+
- Production log analysis with structured logging
178+
- Distributed tracing with OpenTelemetry
179+
- Async debugging with aiomonitor
180+
- Memory leak detection with objgraph and tracemalloc
181+
- WebSocket packet analysis and replay
157182
- Order lifecycle failures
158183
- Real-time data gaps
159184
- Event deadlocks
160-
- Price precision errors
161-
- Memory leaks
162-
- AsyncIO debugging
163-
- SignalR tracing
164185

165186
Example scenarios:
166187
- "Debug why orders aren't filling"
167188
- "Fix WebSocket reconnection issues"
168189
- "Trace event propagation problems"
190+
- "Analyze production memory leaks"
191+
192+
Enhanced debugging:
193+
- Async monitor: `aiomonitor` on port 50101
194+
- Memory analysis: `objgraph.show_growth()`
195+
- Distributed tracing with OpenTelemetry
169196

170197
#### **code-reviewer**
171198
Use PROACTIVELY for code review:
199+
- Security-focused review with semgrep
200+
- Complexity analysis with radon
201+
- Test coverage delta reporting
202+
- Breaking change detection
203+
- Performance benchmark comparison
172204
- Reviewing async patterns
173-
- Checking real-time performance
174205
- Validating financial data integrity
175206
- Ensuring API stability
176-
- Before releases
177-
- PR reviews
178207

179208
Example scenarios:
180209
- Before merging pull requests
181210
- After completing features
182211
- Before version releases
212+
- Security audit reviews
213+
214+
Enhanced review tools:
215+
- Complexity analysis: `radon cc src/ -s`
216+
- Security patterns: `semgrep --config=auto src/`
217+
- Coverage delta: `diff-cover coverage.xml`
218+
219+
### Specialized Performance & Testing Agents
220+
221+
#### **performance-optimizer**
222+
Use PROACTIVELY for performance tuning:
223+
- Memory profiling and optimization
224+
- Async performance tuning
225+
- Cache optimization strategies
226+
- WebSocket message batching
227+
- DataFrame operation optimization
228+
- Benchmark management and comparison
229+
- Resource utilization analysis
230+
231+
Example scenarios:
232+
- "Optimize tick processing latency"
233+
- "Reduce memory usage in orderbook"
234+
- "Improve DataFrame aggregation performance"
235+
- "Profile async event loop bottlenecks"
236+
237+
#### **integration-tester**
238+
Use for end-to-end testing with market simulation:
239+
- Mock market data generation
240+
- Order lifecycle simulation
241+
- WebSocket stress testing
242+
- Multi-timeframe backtesting
243+
- Paper trading validation
244+
- Market replay testing
245+
- Cross-component integration testing
246+
247+
Example scenarios:
248+
- "Test order execution under volatile conditions"
249+
- "Validate indicator calculations with real data"
250+
- "Stress test WebSocket with 1000+ ticks/second"
251+
- "Simulate market gaps and disconnections"
252+
253+
#### **security-auditor**
254+
Use PROACTIVELY for security and compliance:
255+
- API key security validation
256+
- WebSocket authentication audit
257+
- Data encryption verification
258+
- PII handling compliance
259+
- Dependency vulnerability scanning
260+
- Secret scanning in codebase
261+
- Input validation checks
262+
- Rate limiting verification
263+
264+
Example scenarios:
265+
- Before releases
266+
- After adding authentication features
267+
- When handling sensitive data
268+
- Regular security audits
269+
270+
#### **release-manager**
271+
Use for release preparation and deployment:
272+
- Semantic versioning validation
273+
- Breaking change detection
274+
- Migration script generation
275+
- Release notes compilation
276+
- PyPI deployment automation
277+
- Git tag management
278+
- Pre-release testing coordination
279+
- Rollback procedure planning
280+
281+
Example scenarios:
282+
- Preparing version releases
283+
- Creating migration guides
284+
- Automating deployment pipeline
285+
- Managing release branches
286+
287+
#### **data-analyst**
288+
Use for market data analysis and validation:
289+
- Indicator accuracy testing against TA-Lib
290+
- Market microstructure analysis
291+
- Order flow pattern detection
292+
- Statistical validation of calculations
293+
- Backtest result analysis
294+
- Performance attribution
295+
- Volume profile analysis
296+
- Data quality verification
297+
298+
Example scenarios:
299+
- "Validate MACD implementation"
300+
- "Analyze order flow imbalances"
301+
- "Compare indicator outputs with TA-Lib"
302+
- "Statistical validation of backtest results"
303+
304+
### Agent Collaboration Patterns
305+
306+
#### Pattern 1: Feature Development
307+
```
308+
1. data-analyst: Analyze requirements and validate approach
309+
2. python-developer: Implement the feature
310+
3. integration-tester: Create comprehensive tests
311+
4. code-standards-enforcer: Ensure compliance
312+
5. performance-optimizer: Optimize if needed
313+
6. code-documenter: Create documentation
314+
7. code-reviewer: Final review
315+
8. release-manager: Prepare for release
316+
```
317+
318+
#### Pattern 2: Bug Investigation
319+
```
320+
1. code-debugger: Investigate and identify root cause
321+
2. integration-tester: Reproduce with test case
322+
3. python-developer: Implement fix
323+
4. code-standards-enforcer: Verify fix quality
324+
5. code-reviewer: Review the fix
325+
```
326+
327+
#### Pattern 3: Performance Issue
328+
```
329+
1. performance-optimizer: Profile and identify bottlenecks
330+
2. code-refactor: Plan optimization strategy
331+
3. python-developer: Implement optimizations
332+
4. integration-tester: Verify performance improvements
333+
5. code-reviewer: Review changes
334+
```
335+
336+
#### Pattern 4: Security Audit
337+
```
338+
1. security-auditor: Comprehensive security scan
339+
2. code-debugger: Investigate vulnerabilities
340+
3. python-developer: Implement fixes
341+
4. code-standards-enforcer: Verify secure coding
342+
5. integration-tester: Test security measures
343+
```
344+
345+
#### Pattern 5: Release Preparation
346+
```
347+
1. code-standards-enforcer: Pre-release compliance check
348+
2. security-auditor: Security validation
349+
3. integration-tester: Full regression testing
350+
4. performance-optimizer: Performance regression check
351+
5. code-documenter: Update documentation
352+
6. release-manager: Coordinate release
353+
```
183354

184355
### Agent Selection Best Practices
185356

186357
1. **Use agents concurrently** when multiple tasks can be parallelized
187358
2. **Be specific** in task descriptions for agents
188359
3. **Choose the right agent** based on the task type, not just keywords
189360
4. **Use PROACTIVELY** - don't wait for user to request specific agents
190-
5. **Combine agents** for complex tasks (e.g., refactor → standards → review)
361+
5. **Combine agents** for complex tasks using collaboration patterns
362+
6. **Leverage specialized agents** for their unique capabilities
363+
7. **Follow patterns** for common workflows to ensure comprehensive coverage
364+
365+
### Example Multi-Agent Workflows
191366

192-
### Example Multi-Agent Workflow
367+
#### Implementing a New Trading Feature
368+
```python
369+
# Concurrent agent execution for new feature
370+
1. Launch simultaneously:
371+
- data-analyst: Validate market data requirements
372+
- performance-optimizer: Baseline current performance
373+
- security-auditor: Review security implications
374+
375+
2. python-developer: Implement based on analysis results
376+
377+
3. Launch simultaneously:
378+
- integration-tester: Create test suite
379+
- code-standards-enforcer: Check compliance
380+
- code-documenter: Write documentation
381+
382+
4. code-reviewer: Final review before merge
383+
```
193384

385+
#### Debugging Production Issue
194386
```python
195-
# When implementing a new feature:
196-
1. python-developer: Implement the feature
197-
2. code-standards-enforcer: Verify compliance
198-
3. code-documenter: Add documentation
199-
4. code-reviewer: Final review before commit
387+
# Sequential debugging workflow
388+
1. code-debugger: Analyze logs and identify issue
389+
2. performance-optimizer: Check for performance degradation
390+
3. python-developer: Implement fix
391+
4. integration-tester: Verify fix with reproduction test
392+
5. code-reviewer: Review and approve fix
200393
```
201394

202395
### Agent Command Requirements

0 commit comments

Comments
 (0)