🔍 Copilot Critic
A powerful VS Code extension that critiques code generated by GitHub Copilot for bugs, performance issues, security vulnerabilities, and best practices violations.
✅ Implementation Status
Fully Implemented:
- ✅ Core code analysis with JSON/Markdown output
- ✅ Single file analysis via
/analyze command
- ✅ Multi-file analysis (folder & workspace)
- ✅ Git integration with changed files analysis
- ✅ Framework detection (React, Next.js, Vue, Angular, Express, Django, Flask, FastAPI, and more)
- ✅ Custom rule sets (pattern & prompt-based) with built-in presets
- ✅ Critique history with file-based storage and export (JSON/CSV)
- ✅ Custom prompt templates via
.copilot-critic-prompts.md
- ✅ Issues in VS Code Problems panel with hover information
- ✅ Configuration system with depth/severity/category controls
- ✅ Quick fixes - code actions with AI-generated fixes
In Progress:
- 🔄 Auto-analyze triggers (Configuration ready, event wiring pending)
- 🔄 History comparison UI (Data structures ready, command UI pending)
Planned:
- 📋
/history command with comparison visualization
- 📋 Context menu integration (right-click in explorer & editor for quick access)
- 📋 Auto-analyze event wiring (listen to chat participant events)
Features
🎯 Core Capabilities
Automatic Code Analysis: Analyzes code from Copilot or your current editor for:
- 🐛 Bugs & Logic Errors
- ⚡ Performance Issues
- 🔒 Security Vulnerabilities
- 📝 Type Safety Problems
- ✨ Best Practice Violations
Multi-Language Support: Specialized analysis for TypeScript, JavaScript, Python, GraphQL, Go, Rust, Java, and more
Framework Detection: Automatically detects and provides framework-specific guidance for:
- Frontend: React, Next.js, Vue, Angular, Svelte
- Backend: Express, NestJS, Django, Flask, FastAPI
- Other: GraphQL
- Includes framework-specific checks (e.g., React hooks rules, Next.js SSR patterns, Django ORM N+1 queries)
Language-Specific Checks: Deep analysis tailored to each language's patterns and best practices
📁 Multi-File Analysis
- Folder Analysis: Critique all files in a folder with
@critic /folder
- Workspace Analysis: Analyze your entire workspace with
@critic /workspace
- Configurable Limits: Set max files to analyze (default: 50)
- Smart Filtering: Include/exclude patterns for selective analysis
🔀 Git Integration
- Git-Aware Analysis: Analyze only changed files with
@critic /git
- Changed Lines Focus: Option to focus only on modified lines
- Exclude Patterns: Configure which files to skip
🤖 Auto-Analyze Mode (Planned)
- Optional Auto-Critique: Enable automatic analysis after Copilot generates code
- Configurable Triggers: Choose which participants trigger analysis
- Adjustable Delay: Set analysis delay to avoid conflicts
⚠️ Note: Configuration exists but event wiring is not yet complete. Will be available in an upcoming release.
📝 Custom Prompts
- Template Files: Create
.copilot-critic-prompts.md to customize critique prompts
- Settings-Based Customization: Override prompts via VS Code settings
- Per-Language Templates: Language-specific prompt customization
- Merge Strategy: File templates take priority, then settings, then defaults
⚡ Quick Fixes & Code Actions
- VS Code Integration: Issues appear in the Problems panel ✅
- Suggested Fixes: AI-powered quick fixes via code actions ✅
- Inline Recommendations: Hover for issue details ✅
- Apply Directly: Apply suggested or generate fixes ✅
📊 Critique History
- Persistent Storage: Track critique history across sessions
- File-Based Storage: Unlimited history with file persistence
- Comparison: Compare current vs. previous critiques
- Statistics: View trends and quality metrics
⚙️ Custom Rule Sets
- Pattern-Based Rules: Regex patterns to detect code issues
- Prompt-Based Rules: AI-powered custom rules
- Built-In Presets:
recommended, security, performance, strict
- Configuration File:
.copilot-critic.json for team-wide rules
- Markdown: Human-readable formatted output (default)
- JSON: Structured output for diagnostics integration
Quick Start
1. Install
Install from VS Code Extensions marketplace or clone and build locally.
2. Enable GitHub Copilot
Make sure GitHub Copilot is installed and active in your VS Code.
3. Use in Chat
Open the Copilot Chat panel and use @critic to analyze code:
@critic # Analyze current file or selection
@critic /analyze # Analyze current file or selection (explicit)
@critic /folder # Analyze all files in current folder
@critic /workspace # Analyze entire workspace
@critic /git # Analyze git-changed files (requires git integration enabled)
📝 Note: Additional commands (/history, context menus) are planned for a future release.
Configuration
Basic Settings
Add to your .vscode/settings.json:
{
"copilot-critic.critiqueDepth": "standard",
"copilot-critic.severityThreshold": "low",
"copilot-critic.enabledCategories": [
"bugs",
"performance",
"security",
"typeSafety",
"bestPractices"
]
}
Critique Depth
- quick: Fast scan for critical issues only
- standard: Balanced analysis (default)
- thorough: Deep analysis including style and optimization
{
"copilot-critic.outputFormat": "markdown" // or "json"
}
Multi-File Analysis
{
"copilot-critic.multiFile.maxFiles": 50,
"copilot-critic.multiFile.includePatterns": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx"
],
"copilot-critic.multiFile.excludePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/.git/**"
]
}
Git Integration
{
"copilot-critic.gitIntegration.enabled": true,
"copilot-critic.gitIntegration.analyzeOnlyChangedLines": true,
"copilot-critic.gitIntegration.excludePatterns": [
"*.min.js",
"*.min.css",
"dist/**"
]
}
Auto-Analyze
{
"copilot-critic.autoAnalyze.enabled": false,
"copilot-critic.autoAnalyze.delay": 1000,
"copilot-critic.autoAnalyze.participants": ["workspace", "agent"]
}
History
{
"copilot-critic.history.enabled": true,
"copilot-critic.history.maxRecords": 100
}
Custom Configuration Files
.copilot-critic-prompts.md
Customize critique prompts for your team:
# System Prompt
You are a senior code reviewer focused on clean code and maintainability.
## Additional Instructions
- Pay special attention to error handling
- Consider accessibility in UI code
- Flag hardcoded values that should be configurable
## Category: security
Focus on OWASP Top 10 and industry best practices.
# Language: typescript
## Additional Instructions
- Enforce strict TypeScript patterns
- Flag any use of 'any' type
- Check for proper async/await usage
.copilot-critic.json
Define custom rules and extend built-in presets:
{
"extends": ["recommended", "security"],
"rules": [
{
"id": "no-console-log",
"name": "No console.log",
"description": "Disallow console.log in production code",
"pattern": "console\\.log\\(",
"severity": "low",
"languages": ["typescript", "javascript"],
"enabled": true
},
{
"id": "require-error-handling",
"name": "Require Error Handling",
"description": "Check async functions have try-catch",
"prompt": "Verify all async functions have proper error handling",
"severity": "high",
"languages": ["typescript", "javascript"],
"enabled": true
}
]
}
Commands
All commands are accessible via:
- Chat with
@critic participant
- Command palette (
Cmd/Ctrl+Shift+P)
- File explorer context menu
- Editor context menu
| Command |
Status |
copilot-critic.analyzeFolder |
✅ |
copilot-critic.analyzeWorkspace |
✅ |
copilot-critic.analyzeGitChanges |
✅ |
copilot-critic.clearHistory |
✅ |
copilot-critic.exportHistoryJSON |
✅ |
copilot-critic.exportHistoryCSV |
✅ |
copilot-critic.toggleAutoAnalyze |
🔄 (Planned) |
copilot-critic.showHistory |
🔄 (Partial) |
Tips & Best Practices
1. Use Critique Depth
Start with "quick" mode during development, use "thorough" for code reviews:
{
"copilot-critic.critiqueDepth": "quick"
}
2. Custom Rules for Your Team
Create .copilot-critic.json in your repo root and commit it to share standards:
# Create example config
# (This command will be available in a future release)
3. Git Workflow
Enable git integration and use @critic /git before committing:
{
"copilot-critic.gitIntegration.enabled": true
}
4. Track Quality Over Time
Enable history to monitor code quality improvements:
{
"copilot-critic.history.enabled": true
}
Requirements
- VS Code: 1.106.1 or higher
- GitHub Copilot: Must be installed and active
- Git: (Optional) For git integration features
Extension Settings
This extension contributes the following settings:
Analysis Settings
copilot-critic.critiqueDepth - Depth of analysis (quick, standard, thorough)
copilot-critic.severityThreshold - Minimum severity to report
copilot-critic.enabledCategories - Categories to check
copilot-critic.outputFormat - Output format (markdown, json)
Multi-File Settings
copilot-critic.multiFile.maxFiles - Maximum files to analyze
copilot-critic.multiFile.includePatterns - File patterns to include
copilot-critic.multiFile.excludePatterns - File patterns to exclude
Auto-Analyze Settings
copilot-critic.autoAnalyze.enabled - Enable auto-analyze
copilot-critic.autoAnalyze.delay - Delay before analysis
copilot-critic.autoAnalyze.participants - Participants that trigger analysis
Git Settings
copilot-critic.gitIntegration.enabled - Enable git features
copilot-critic.gitIntegration.analyzeOnlyChangedLines - Focus on changed lines
copilot-critic.gitIntegration.excludePatterns - Exclude patterns
History Settings
copilot-critic.history.enabled - Enable history tracking
copilot-critic.history.maxRecords - Maximum history records
Prompt Settings
copilot-critic.promptTemplates.additionalInstructions - Extra instructions
copilot-critic.promptTemplates.categoryOverrides - Category overrides
Known Issues
- Large Files: Analysis may timeout on very large files (>50KB). Use selection for targeted analysis or switch to "quick" depth when prompted.
- Git Integration: Requires VS Code Git extension. If git is unavailable, you'll be prompted to analyze the workspace instead.
- Rate Limiting: Heavy use may hit Copilot's rate limits. Adjust
autoAnalyze.delay if needed.
Troubleshooting
/git command hangs or takes too long
- Fixed in v0.0.1: The command now analyzes only changed files (previously analyzed all workspace files then filtered)
- Ensure
copilot-critic.gitIntegration.enabled is set to true
- Check that you have git changes to analyze with
git status
- Look for a VS Code progress notification showing analysis progress
No progress indication in chat
- The
/git command shows a progress notification at bottom-right
- Chat will display a "⏳ Analyzing X files..." message
- Results appear after all files are analyzed
Commands not appearing
- Ensure GitHub Copilot extension is installed and active
- Restart VS Code after installing the extension
- Check that you're typing
@critic (not just "critic") in chat
Future Enhancements
See ENHANCEMENTS.md for planned features including:
- 📊 Critique Dashboard (WebView)
- 🌐 Team Sharing & Collaboration
- 🧪 Test Coverage Analysis
- 🔌 Plugin System
- And more!
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature)
- Commit changes (
git commit -m 'Add AmazingFeature')
- Push to branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
License
This extension is licensed under the MIT License. See LICENSE file for details.
Support
Acknowledgments
- Built with ❤️ for developers using GitHub Copilot
- Inspired by ESLint, Prettier, and other code quality tools
- Thanks to the VS Code extension community
Happy Critiquing! 🚀
Following extension guidelines
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
Working with Markdown
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
- Split the editor (
Cmd+\ on macOS or Ctrl+\ on Windows and Linux).
- Toggle preview (
Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux).
- Press
Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets.
Enjoy!