{"aiPlatform":"claude-code@2025.06","category":"development","commandName":"/code-review","content":"---\nname: AI Code Reviewer\ndescription: Intelligent code review assistant that analyzes code quality, security vulnerabilities, performance issues, and best practices. Integrates with GitHub for pull request analysis, uses filesystem for local code inspection, and maintains a knowledge base of common issues and solutions across different programming languages.\nallowed_tools:\n  - github          # Pull request and repository analysis\n  - filesystem      # Local code file analysis\n  - memory          # Track code patterns and recommendations\n  - sqlite          # Store review history and metrics\ntags:\n  - code-review\n  - security-analysis\n  - quality-assurance\n  - best-practices\n  - ci-cd\ncategory: development\nversion: 2.0.0\nauthor: AI Commands Team\n---\n\n## Arguments\n\n```\n/code-review \nsource=\"<github_url|local_path>\" \n[languages=<auto|javascript,typescript,python,go,rust,java,csharp,cpp,ruby>]\n[focus=<security|performance|style|maintainability|complexity|documentation|all>]\n[severity_threshold=<info|warning|error>]\n[save_report=<yes|no>]\n```\n*Defaults → `languages=auto  focus=all  severity_threshold=info  save_report=yes`*\n\n### Examples\n\n```bash\n# Review a GitHub pull request for security issues\n/code-review \nsource=\"https://github.com/user/repo/pull/123\"\nfocus=security\nlanguages=javascript,typescript\n\n# Review local Python code for maintainability\n/code-review \nsource=\"./src/\"\nlanguages=python\nfocus=maintainability\n\n# High severity review for production code\n/code-review \nsource=\"https://github.com/org/repo/pull/456\"\nseverity_threshold=error\nfocus=security,performance\n```\n\n---\n\n## Context – what the AI should do\n\n1. **Parse Arguments** into:\n   * `source` - GitHub URL or local file/directory path\n   * `languages` - specific languages to focus on (auto-detect if not specified)\n   * `focus` - review focus area\n   * `save_report` - whether to generate detailed report\n\n2. **Source Analysis Setup**\n   * If GitHub URL: `/github__get_pull_request` or `/github__get_repository_files`\n   * If local path: `/filesystem__read_multiple_files` for code files\n   * For PRs: Intelligently focus on changed files while considering context\n   * Detect programming languages: `/filesystem__search_files` with extensions\n   * Initialize memory graph for tracking patterns\n\n3. **Comprehensive Code Analysis** (based on focus parameter)\n   * **Security Review**: SQL injection, XSS, hardcoded secrets, unsafe functions, OWASP Top 10\n   * **Performance Review**: Inefficient algorithms, memory leaks, N+1 queries, bundle size\n   * **Style Review**: Naming conventions, code organization, consistency, formatting\n   * **Maintainability Review**: Code complexity (cyclomatic/cognitive), duplication, coupling\n   * **Complexity Review**: Function length, class size, dependency depth, architectural patterns\n   * **Documentation Review**: Comment quality, API docs, README completeness, inline help\n   * **Best Practices**: Language/framework patterns, error handling, testing coverage\n\n4. **Pattern Recognition**\n   * Compare against known anti-patterns stored in memory\n   * Cross-reference with common vulnerability databases\n   * Identify recurring issues across files/commits\n   * Store new patterns for future reviews\n\n5. **Language-Specific Analysis** (merged with quality checks)\n   * **JavaScript/TypeScript**: async patterns, type safety, bundle optimization, ESLint rules\n   * **Python**: PEP 8/type hints, security (pickle/eval), performance (list comprehensions)\n   * **Go**: Error handling, goroutine safety, memory management, go vet findings\n   * **Rust**: Memory safety, error handling patterns, clippy suggestions\n   * **Java**: Design patterns, Spring best practices, null safety, FindBugs/SpotBugs\n   * **C#**: LINQ usage, async/await, nullable reference types, code analysis rules\n   * **C++**: Memory management, RAII, modern C++ features, static analysis\n   * **Ruby**: Rails conventions, metaprogramming safety, performance bottlenecks\n\n6. **Report Generation**\n   * **Save Options**: \n     - `save_report=yes`: Generate detailed markdown report file `./code-review-report-[timestamp].md`\n     - `save_report=no`: Display comprehensive analysis in response only\n   * **Report Structure**:\n     - Summary Dashboard: Overall health score, issue counts by severity\n     - Detailed Findings: Organized by severity and category\n     - Code Examples: Specific issues with line references and fix suggestions\n     - Best Practices: Educational notes for improvement\n     - Metrics: Code quality indicators when available\n   * **Severity Filtering**: Only report issues at or above the specified threshold\n\n7. **Knowledge Base Updates**\n   * Store review findings in memory: `/memory__create_entities` for issues found\n   * Build relationships: File → contains → Issue → relates_to → Best_Practice\n   * Update SQLite with review metrics and trends\n   * Learn from successful patterns for future recommendations\n\n8. **Error Handling & Expected Failures**\n   | Error Type | Message | Exit Code | Recovery Action |\n   |------------|---------|-----------|------------------|\n   | Bad URL | \"Invalid GitHub URL format\" | 3 | Check URL syntax |\n   | Auth Error | \"GitHub authentication failed\" | 3 | Verify token/permissions |\n   | Large Repo | \"Repository exceeds size limit\" | 2 | Use max_files or include filters |\n   | No Files | \"No matching files found\" | 2 | Adjust include/exclude patterns |\n   | Rate Limit | \"API rate limit exceeded\" | 3 | Wait and retry |\n\n9. **Security & Privacy**\n   * **Data Handling**: All code analysis happens locally; no code is sent to external services\n   * **Memory Retention**: Review patterns stored for 30 days, anonymized after 7 days\n   * **Report Storage**: Local filesystem only, user controls distribution\n   * **Credentials**: GitHub tokens used only for API access, never stored in reports\n\n> Provide constructive, educational feedback that helps developers improve. Focus on teaching principles, not just identifying problems. Intelligently analyze the codebase to provide the most valuable insights based on the context and focus areas specified.","contentHash":"0c65362be33ef733c555feadfa9adc6fe5b689f0fcc7a6ed4af151ad64f03534","copies":1,"createdAt":"2025-07-22T16:25:38.261Z","description":"Production-ready code review assistant with security analysis, maintainability scoring, and CI/CD integration via SARIF output","downloads":4,"github":{"lastSyncDirection":"from-github","lastSyncError":"Failed to sync YAML command: Failed to extract file contents: logger.logProgress is not a function","repoUrl":"https://github.com/Commands-com/ai-commands","metadata":{"importedFrom":"github_repository","repoPrivate":true,"repoDefaultBranch":"main","connectedAt":"2025-07-22T16:25:38.261Z"},"importedAt":"2025-07-22T16:25:38.261Z","lastSyncAt":"2025-08-17T16:56:10.374Z","fileMapping":{"license":"LICENSE","readme":"code-reviewer/README.md","assets":[],"mainFile":"code-reviewer/command.md"},"selectedCommand":"code-reviewer","fileShas":{"mainFile":"b8f69951fc78ca73dbc682bbdc0537846c96954d","yamlPath":"4507cfda9afa7474437ab79914331e61ec82f4f7","readme":"ec7def51068ad176babc4b748a9ac2b64eb06dd8"},"branch":"main","connectionType":"commands_yaml","connected":true,"lastSyncCommit":"3f1460bda072265aa9ad932490481f0843dc66f8","importSource":"repository_import","installationId":"69232615","syncStatus":"synced"},"githubRepoUrl":"https://github.com/Commands-com/ai-commands","id":"6015c7e9-25ba-40f2-8bdc-dc3e908a6524","inputParameters":[{"name":"source","description":"GitHub URL or local file/directory path to analyze","label":"Source Location","type":"text","required":true,"defaultValue":""},{"name":"languages","description":"Specific languages to focus on (comma-separated or auto-detect)","label":"Programming Languages","type":"text","required":false,"defaultValue":"auto"},{"defaultValue":"all","name":"focus","options":["security","performance","style","maintainability","complexity","documentation","all"],"description":"Primary area of analysis (single focus or comma-separated list)","label":"Review Focus","type":"select","required":false},{"defaultValue":"info","name":"severity_threshold","options":["info","warning","error"],"description":"Minimum severity level for reported issues","label":"Severity Threshold","type":"select","required":false},{"defaultValue":"yes","name":"save_report","options":["yes","no"],"description":"Generate detailed markdown report file","label":"Save Report","type":"select","required":false}],"instructions":"# AI Code Reviewer\n\nProduction-ready code review assistant that performs comprehensive analysis of code quality, security vulnerabilities, performance bottlenecks, and maintainability metrics. Supports GitHub pull requests, local codebases, and CI/CD integration through multiple output formats.\n\n## Key Features:\n- **Multi-Language Support**: JavaScript, TypeScript, Python, Go, Rust, Java, C#, C++, Ruby\n- **Comprehensive Analysis**: Security, performance, style, maintainability, complexity, documentation\n- **Intelligent Scope**: Automatically focuses on relevant code based on context (PRs analyze changes)\n- **Severity Filtering**: Focus on issues that matter with configurable thresholds\n- **Privacy-First**: All analysis happens locally, no code sent to external services\n- **Learning System**: Builds knowledge base of patterns for improved recommendations\n\n## How to Use:\n1. **Source**: GitHub URL (repository/PR) or local file/directory path\n2. **Languages**: Comma-separated languages or \"auto\" for detection\n3. **Focus**: Analysis area - security, performance, style, maintainability, complexity, documentation, or all\n4. **Severity Threshold**: Filter issues by severity (info/warning/error)\n5. **Save Report**: Generate markdown report file or display in response only\n\n## Output:\n- **Report Location**: `./code-review-report-[timestamp].md` (when save_report=yes)\n- **Format**: Comprehensive markdown report with findings organized by severity and category\n\n## Example Commands:\n```bash\n# Basic GitHub PR review\n/code-review source=\"https://github.com/org/repo/pull/123\"\n\n# Security-focused review with high threshold\n/code-review source=\"./src\" focus=security severity_threshold=error\n\n# High-priority issues only\n/code-review source=\".\" severity_threshold=error focus=security\n\n# Maintainability review for Python code\n/code-review source=\"./backend\" languages=python focus=maintainability,complexity\n```\n\n## Report Sections:\n- **Summary Dashboard**: Overall score, issue distribution, top recommendations\n- **Issue Details**: File location, severity, category, fix suggestions with code examples\n- **Metrics**: Cyclomatic complexity, code duplication, test coverage\n- **Learning Notes**: Educational explanations for each issue type\n\n## Security & Privacy:\n- All code analysis performed locally\n- Review patterns anonymized after 7 days\n- Memory retention: 30 days for learning\n- No external API calls except GitHub (when analyzing PRs)\n\n## Prerequisites:\n- GitHub MCP server for repository analysis\n- Filesystem MCP server for local code inspection\n- Memory MCP server for tracking patterns and recommendations\n- SQLite MCP server for storing review history and metrics\n\n## Best Practices:\n- For PR reviews, provide the GitHub PR URL for automatic diff analysis\n- Use severity thresholds to focus on critical issues\n- Combine multiple focus areas for comprehensive reviews (e.g., `focus=security,performance`)\n- Save reports for tracking improvements over time","lastCopied":"2025-12-14T22:36:11.715Z","lastDownloaded":"2025-09-01T13:49:36.035Z","licenseType":"mit","likes":0,"mcpRequirements":[{"tier":"required","serverId":"github"},{"tier":"required","serverId":"filesystem"},{"tier":"required","serverId":"memory"},{"tier":"required","serverId":"sqlite"}],"mcp_search_content":"docker-github docker-filesystem docker-memory docker-sqlite","organizationUsername":"commands-com","price":"free","processedGalleryItems":[{"s3KeyThumbnail":"processed/6015c7e9-25ba-40f2-8bdc-dc3e908a6524/1753201538898_preview_thumb.webp","s3KeyLarge":"processed/6015c7e9-25ba-40f2-8bdc-dc3e908a6524/1753201538898_preview.webp","name":"1753201538898_preview.webp","originalKey":"temp-uploads/6015c7e9-25ba-40f2-8bdc-dc3e908a6524/1753201538898_preview.png","pathLarge":"6015c7e9-25ba-40f2-8bdc-dc3e908a6524/1753201538898_preview.webp","type":"image/webp","pathThumbnail":"6015c7e9-25ba-40f2-8bdc-dc3e908a6524/1753201538898_preview_thumb.webp"}],"search_content":"ai code reviewer production-ready code review assistant with security analysis, maintainability scoring, and ci/cd integration via sarif output /code-review development claude-code@2025.06","title":"AI Code Reviewer","type":"command","updatedAt":"2025-08-17T16:56:10.374Z","userId":"W0V8NAw5AhWRwcuwSoFLOi1Yem83","visibility":"public","name":"code-reviewer","userInteraction":{"userHasStarred":false}}