github/awesome-copilot/sql-code-review
Claude Code and agent skill by github/awesome-copilot
- community
Checking that the SKILL.md file is still in the repository.
Universal SQL code review assistant that performs comprehensive security, maintainability, and code quality analysis across all SQL databases (MySQL, PostgreSQL, SQL Server, Oracle). Focuses on SQL injection prevention, access control, code standards, and anti-pattern detection. Complements SQL optimization prompt for complete development coverage.
Install
npx vskill@latest install github/awesome-copilot/sql-code-reviewSKILL.md
SQL Code Review
Perform a thorough SQL code review of ${selection} (or entire project if no selection) focusing on security, performance, maintainability, and database best practices.
🔒 Security Analysis
SQL Injection Prevention
Access Control & Permissions
- Principle of Least Privilege: Grant minimum required permissions
- Role-Based Access: Use database roles instead of direct user permissions
- Schema Security: Proper schema ownership and access controls
- Function/Procedure Security: Review DEFINER vs INVOKER rights
Data Protection
- Sensitive Data Exposure: Avoid SELECT * on tables with sensitive columns
- Audit Logging: Ensure sensitive operations are logged
- Data Masking: Use views or functions to mask sensitive data
- Encryption: Verify encrypted storage for sensitive data
⚡ Performance Optimization
Query Structure Analysis
Index Strategy Review
- Missing Indexes: Identify columns that need indexing
- Over-Indexing: Find unused or redundant indexes
- Composite Indexes: Multi-column indexes for complex queries
- Index Maintenance: Check for fragmented or outdated indexes
Join Optimization
- Join Types: Verify appropriate join types (INNER vs LEFT vs EXISTS)
- Join Order: Optimize for smaller result sets first
- Cartesian Products: Identify and fix missing join conditions
- Subquery vs JOIN: Choose the most efficient approach
Aggregate and Window Functions
🛠️ Code Quality & Maintainability
SQL Style & Formatting
Naming Conventions
- Consistent Naming: Tables, columns, constraints follow consistent patterns
- Descriptive Names: Clear, meaningful names for database objects
- Reserved Words: Avoid using database reserved words as identifiers
- Case Sensitivity: Consistent case usage across schema
Schema Design Review
- Normalization: Appropriate normalization level (avoid over/under-normalization)
- Data Types: Optimal data type choices for storage and performance
- Constraints: Proper use of PRIMARY KEY, FOREIGN KEY, CHECK, NOT NULL
- Default Values: Appropriate default values for columns
🗄️ Database-Specific Best Practices
PostgreSQL
MySQL
SQL Server
Oracle
🧪 Testing & Validation
Data Integrity Checks
Performance Testing
- Execution Plans: Review query execution plans
- Load Testing: Test queries with realistic data volumes
- Stress Testing: Verify performance under concurrent load
- Regression Testing: Ensure optimizations don't break functionality
📊 Common Anti-Patterns
N+1 Query Problem
Overuse of DISTINCT
Function Misuse in WHERE Clauses
📋 SQL Review Checklist
Security
- [ ] All user inputs are parameterized
- [ ] No dynamic SQL construction with string concatenation
- [ ] Appropriate access controls and permissions
- [ ] Sensitive data is properly protected
- [ ] SQL injection attack vectors are eliminated
Performance
- [ ] Indexes exist for frequently queried columns
- [ ] No unnecessary SELECT * statements
- [ ] JOINs are optimized and use appropriate types
- [ ] WHERE clauses are selective and use indexes
- [ ] Subqueries are optimized or converted to JOINs
Code Quality
- [ ] Consistent naming conventions
- [ ] Proper formatting and indentation
- [ ] Meaningful comments for complex logic
- [ ] Appropriate data types are used
- [ ] Error handling is implemented
Schema Design
- [ ] Tables are properly normalized
- [ ] Constraints enforce data integrity
- [ ] Indexes support query patterns
- [ ] Foreign key relationships are defined
- [ ] Default values are appropriate
🎯 Review Output Format
Issue Template
-- Problematic SQL
-- Improved SQL
Summary Assessment
- Security Score: [1-10] - SQL injection protection, access controls
- Performance Score: [1-10] - Query efficiency, index usage
- Maintainability Score: [1-10] - Code quality, documentation
- Schema Quality Score: [1-10] - Design patterns, normalization
Top 3 Priority Actions
- [Critical Security Fix]: Address SQL injection vulnerabilities
- [Performance Optimization]: Add missing indexes or optimize queries
- [Code Quality]: Improve naming conventions and documentation
Focus on providing actionable, database-agnostic recommendations while highlighting platform-specific optimizations and best practices.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sql-code-review/SKILL.md
Popularity
- Repository stars
- 27,102
- Repository forks
- 3,143
- 7-day trend score
- 51
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/github/awesome-copilot/sql-code-review)