include header comment block with description, parameters, and return values
return standardized error codes/messages
return result sets with consistent column order
use OUTPUT parameters for returning status information
prefix temporary tables with 'tmp_'
SQL Security Best Practices
parameterize all queries to prevent SQL injection
use prepared statements when executing dynamic SQL
avoid embedding credentials in SQL scripts
implement proper error handling without exposing system details
avoid using dynamic SQL within stored procedures
Transaction Management
explicitly begin and commit transactions
use appropriate isolation levels based on requirements
avoid long-running transactions that lock tables
use batch processing for large data operations
include SET NOCOUNT ON for stored procedures that modify data
1---2name: sql-sp-generation3description: SQL Development4---5# SQL Development67## Database schema generation8- all table names should be in singular form9- all column names should be in singular form10- all tables should have a primary key column named `id`11- all tables should have a column named `created_at` to store the creation timestamp12- all tables should have a column named `updated_at` to store the last update timestamp1314## Database schema design15- all tables should have a primary key constraint16- all foreign key constraints should have a name17- all foreign key constraints should be defined inline18- all foreign key constraints should have `ON DELETE CASCADE` option19- all foreign key constraints should have `ON UPDATE CASCADE` option20- all foreign key constraints should reference the primary key of the parent table2122## SQL Coding Style23- use uppercase for SQL keywords (SELECT, FROM, WHERE)24- use consistent indentation for nested queries and conditions25- include comments to explain complex logic26- break long queries into multiple lines for readability27- organize clauses consistently (SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY)2829## SQL Query Structure30- use explicit column names in SELECT statements instead of SELECT *31- qualify column names with table name or alias when using multiple tables32- limit the use of subqueries when joins can be used instead33- include LIMIT/TOP clauses to restrict result sets34- use appropriate indexing for frequently queried columns35- avoid using functions on indexed columns in WHERE clauses3637## Stored Procedure Naming Conventions38- prefix stored procedure names with 'usp_'39- use PascalCase for stored procedure names40- use descriptive names that indicate purpose (e.g., usp_GetCustomerOrders)41- include plural noun when returning multiple records (e.g., usp_GetProducts)42- include singular noun when returning single record (e.g., usp_GetProduct)4344## Parameter Handling45- prefix parameters with '@'46- use camelCase for parameter names47- provide default values for optional parameters48- validate parameter values before use49- document parameters with comments50- arrange parameters consistently (required first, optional later)515253## Stored Procedure Structure54- include header comment block with description, parameters, and return values55- return standardized error codes/messages56- return result sets with consistent column order57- use OUTPUT parameters for returning status information58- prefix temporary tables with 'tmp_'596061## SQL Security Best Practices62- parameterize all queries to prevent SQL injection63- use prepared statements when executing dynamic SQL64- avoid embedding credentials in SQL scripts65- implement proper error handling without exposing system details66- avoid using dynamic SQL within stored procedures6768## Transaction Management69- explicitly begin and commit transactions70- use appropriate isolation levels based on requirements71- avoid long-running transactions that lock tables72- use batch processing for large data operations73- include SET NOCOUNT ON for stored procedures that modify data
Run npx skillmds@latest add pingqlin/sql-sp-generation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
SQL Development It is listed under Data & Analytics on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
pingqLIN (@pingqlin) published this skill. Their other Agent Skills are listed on their SkillMD profile.