MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Sql-Sp-Generation

Sql-Sp-Generation是一款code方向的AI技能,核心价值是Guidelines for generating SQL statements and stored procedures,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Guidelines for generating SQL statements and stored procedures

Last verified on: 2026-05-30
mkdir -p ./skills/sql-sp-generation && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/sql-sp-generation/SKILL.md -o ./skills/sql-sp-generation/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# SQL Development


Database schema generation

- all table names should be in singular form

- all column names should be in singular form

- all tables should have a primary key column named `id`

- all tables should have a column named `created_at` to store the creation timestamp

- all tables should have a column named `updated_at` to store the last update timestamp


Database schema design

- all tables should have a primary key constraint

- all foreign key constraints should have a name

- all foreign key constraints should be defined inline

- all foreign key constraints should have `ON DELETE CASCADE` option

- all foreign key constraints should have `ON UPDATE CASCADE` option

- all foreign key constraints should reference the primary key of the parent table


SQL Coding Style

- use uppercase for SQL keywords (SELECT, FROM, WHERE)

- use consistent indentation for nested queries and conditions

- include comments to explain complex logic

- break long queries into multiple lines for readability

- organize clauses consistently (SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY)


SQL Query Structure

- use explicit column names in SELECT statements instead of SELECT *

- qualify column names with table name or alias when using multiple tables

- limit the use of subqueries when joins can be used instead

- include LIMIT/TOP clauses to restrict result sets

- use appropriate indexing for frequently queried columns

- avoid using functions on indexed columns in WHERE clauses


Stored Procedure Naming Conventions

- prefix stored procedure names with 'usp_'

- use PascalCase for stored procedure names

- use descriptive names that indicate purpose (e.g., usp_GetCustomerOrders)

- include plural noun when returning multiple records (e.g., usp_GetProducts)

- include singular noun when returning single record (e.g., usp_GetProduct)


Parameter Handling

- prefix parameters with '@'

- use camelCase for parameter names

- provide default values for optional parameters

- validate parameter values before use

- document parameters with comments

- arrange parameters consistently (required first, optional later)



Stored Procedure Structure

- 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

🎯 Best For

  • UI designers
  • Product designers
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Generating component mockups
  • Creating design system tokens
  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Sql-Sp-Generation to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Does this work with Figma?

Some design skills integrate with Figma plugins. Check the Works With section for supported tools.

Is Sql-Sp-Generation compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Sql-Sp-Generation?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Sql-Sp-Generation?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/sql-sp-generation/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping usability testing

AI-generated designs should be validated with real users before development.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills