Skip to content

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
View on GitHub

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 -y

Installs 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

Similar to Stored Procedures

More Databases