analyze
The analyze command performs comprehensive evaluation of code against multiple quality dimensions including code quality, architecture, security, performance, and maintainability. Use this command when conducting thorough code reviews, assessing new modules before integration, or evaluating whether code adheres to established project standards documented in the repository.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/huangjia2019/claude-code-engineering/HEAD/05-Commands/projects/02-advanced-commands/.claude/commands/analyze.md -o ~/.claude/commands/analyze.mdanalyze.md
Perform deep analysis on: $ARGUMENTS ## Analysis Context Use our project's coding standards as reference: @.claude/rules/coding-standards.md ## Analysis Dimensions ### 1. Code Quality - Complexity (cyclomatic, cognitive) - Duplication - Dead code - Naming conventions ### 2. Architecture - Separation of concerns - Dependency direction - Module boundaries ### 3. Security - Input validation - Authentication/authorization - Sensitive data handling ### 4. Performance - Obvious inefficiencies - Resource management - Caching opportunities ### 5. Maintainability - Documentation coverage - Test coverage indicators - Code readability ## Steps 1. Read the target file(s) 2. If a directory, identify key files 3. Analyze against each dimension 4. Compare with project standards (if available) 5. Generate report ## Output Format ```markdown ## Analysis Report: [target] ### Overview [One paragraph summary] ### Scores | Dimension | Score | Notes | |-----------|-------|-------| | Quality | ⭐⭐⭐⭐☆ | [brief] | | Architecture | ⭐⭐⭐☆☆ | [brief] | | Security | ⭐⭐⭐⭐⭐ | [brief] | | Performance | ⭐⭐⭐☆☆ | [brief] | | Maintainability | ⭐⭐⭐⭐☆ | [brief] | ### Key Findings #### Strengths - [positive points] #### Areas for Improvement - [issues with suggested fixes] ### Recommendations 1. [Prioritized action items] ```
Review code changes for quality, security, and best practices. Proactively use this after code modifications.
Run tests and report results concisely. Use this after code changes to verify everything works.
Analyze log files and extract actionable insights. Use when troubleshooting issues or investigating incidents.
Explore and analyze API-related code. Use when investigating endpoints, routing, or HTTP handling.
Explore and analyze authentication-related code. Use when investigating auth flows, session management, or security.
Explore and analyze database-related code. Use when investigating data models, queries, or persistence.
Analyze root cause of bugs after location is identified. Second step in bug investigation.
Implement bug fixes after analysis is complete. Third step in bug fix pipeline.