Sql Best Practices
Provides best practices guidance and assistance for working with databases and data persistence.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add sql-best-practices npx -- -y @trustedskills/sql-best-practices
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"sql-best-practices": {
"command": "npx",
"args": [
"-y",
"@trustedskills/sql-best-practices"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill provides guidance and assistance for writing SQL code that adheres to best practices. It focuses on improving query readability, performance, security, and data integrity through consistent formatting, optimized indexing, and secure coding techniques. The skill offers advice on structuring queries, selecting columns effectively, filtering data efficiently, and using joins appropriately.
When to use it
- When you need help writing clear and readable SQL code for database interactions.
- When optimizing existing SQL queries for better performance.
- When ensuring your SQL code is secure against potential vulnerabilities like SQL injection.
- When working with complex queries that require documentation and explanation.
- To ensure consistent formatting and style across a codebase of SQL scripts.
Key capabilities
- Provides guidance on formatting and styling SQL code (uppercase keywords, newlines, aliases).
- Offers advice for optimizing query performance through indexing and avoiding functions on indexed columns.
- Emphasizes security best practices to prevent SQL injection using parameterized queries.
- Suggests appropriate use of transactions for data integrity.
- Promotes explicit JOIN syntax over implicit joins.
Example prompts
- "Can you review this SQL query for readability and suggest improvements?" (followed by providing the query)
- "How can I optimize this query to improve performance?" (followed by providing the query)
- "What are some best practices for preventing SQL injection in this code snippet?" (followed by providing a relevant code section)
Tips & gotchas
- The skill focuses on general SQL best practices and may not be specific to any particular database system.
- Pay attention to the formatting guidelines, as consistent style significantly improves readability.
- Remember to explicitly list required columns instead of using
SELECT *in production code.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.