Stored Procedures
Reusable database routines and triggers for business logic, validation, and audit trails across PostgreSQL and MySQL.
- CCM score
- 35 of 100
- skills.sh installs
- 458
- GitHub stars
- 396
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers scalar functions, stored procedures, simple procedures, and procedures with error handling
- Includes PostgreSQL and MySQL trigger guides alongside six reference documents in
references/ - Provides a PostgreSQL scalar function example that rounds totals to two decimal places and is marked IMMUTABLE
- Designed for encapsulating multi-step operations, enforcing data constraints, and moving calculations server-side
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill stored-procedures -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Stored Procedures & Functions
Table of Contents
Overview
Implement stored procedures, functions, and triggers for business logic, data validation, and performance optimization. Covers procedure design, error handling, and performance considerations.
When to Use
- Business logic encapsulation
- Complex multi-step operations
- Data validation and constraints
- Audit trail maintenance
- Performance optimization
- Code reusability across applications
- Trigger-based automation
Quick Start
PostgreSQL - Scalar Function:
-- Create function returning single value
CREATE OR REPLACE FUNCTION calculate_order_total(
p_subtotal DECIMAL,
p_tax_rate DECIMAL,
p_shipping DECIMAL
)
RETURNS DECIMAL AS $$
BEGIN
RETURN ROUND((p_subtotal * (1 + p_tax_rate) + p_shipping)::NUMERIC, 2);
END;
$$ LANGUAGE plpgsql IMMUTABLE;
-- Use in queries
SELECT id, subtotal, calculate_order_total(subtotal, 0.08, 10) as total
FROM orders;
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Databases, Backend & APIs
- First seen
- Jun 3, 2026
Questions
What does the stored-procedures skill do?
The stored-procedures skill helps an agent implement stored procedures, functions and triggers for database logic, such as business rules, data validation and audit trails. It covers procedure design, error handling and performance considerations. It is meant for reusable database routines, complex queries and server-side calculations.
How do I install the stored-procedures skill?
Run npx -y skills add aj-geddes/useful-ai-prompts --skill stored-procedures -y in your project. Once installed, the agent can write database routines for you when a task calls for them.
Which databases does the stored-procedures skill cover?
The skill includes reference guides for PostgreSQL and MySQL, covering scalar functions, procedures with error handling and triggers. Its PostgreSQL quick start shows a scalar function used both in queries and in application code.
Where does the stored-procedures skill stand in the Databases category?
The skill sits in the Databases category on Claude Marketplaces, alongside skills such as supabase-postgres-best-practices and several Prisma skills. Unlike those, it focuses on writing server-side routines and triggers rather than client APIs or database setup.
More from aj-geddes/useful-ai-prompts
All 258- Profiling Optimization457
- Property Based Testing457
- Cpu Profiling456
- Frontend Routing456
- Load Balancer Setup456
- Aws Rds Database455
- Log Aggregation455
- Documentation Site Setup454
- Recommendation System454
- Retrospective Facilitation453
- Git Hooks Setup452
- Monorepo Management452
- Secrets Management452
- Survival Analysis452
- Api Filtering Sorting451
- Cloud Migration Planning451
- Cloud Storage Optimization451
- Configuration Management451
- Design Handoff451
- Performance Regression Debugging451
- Correlation Analysis450
- Alert Management449
- Cloud Cost Management449
- Network Security Groups449
Similar to Stored Procedures
More Databasesdatabase-backup-restoreaj-geddes/useful-ai-prompts593 installsBackup and restore guide for PostgreSQL and MySQL covering disaster recovery planning, retention, and restore testing.
sql-injection-preventionaj-geddes/useful-ai-prompts538 installsPrevention guide for SQL injection covering prepared statements, parameterized queries, ORM use, and input validation.
drizzle-orm-patternsgiuseppe-trisciuoglio/developer-kit6K installsComprehensive Drizzle ORM guide for type-safe schemas, queries, relations, transactions, and migrations across five databases.
sql-code-reviewgithub/awesome-copilot15.8K installsUniversal SQL code review guide covering injection prevention, access control, performance, and anti-pattern detection across databases.