/db-postgres:postgres-codingfrom db-postgres
Use when writing or reviewing PostgreSQL PL/pgSQL code — enforces snake_case naming, function/trigger patterns, JSONB operations, partitioning, RLS policies, and PostgreSQL-specific type usage
Ships in db-postgres. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| Element | Convention | Example |
|---|---|---|
| Table | snake_case, plural | orders, order_items |
| Column | snake_case, singular | first_name, created_at |
| Function | snake_case, verb_noun | get_order_by_id, calculate_total |
| Trigger | trg_<table>_<event> | trg_orders_before_insert |
| Index | idx_<table>_<column(s)> | idx_orders_customer_id |
| Primary Key | pk_<table> | pk_orders |
| Foreign Key | fk_<child>_<parent> | fk_order_items_orders |
| Enum Type | snake_case, singular | order_status, payment_method |
CREATE OR REPLACE FUNCTION get_order_by_id(p_order_id INTEGER)
RETURNS TABLE (
id INTEGER,
customer_name TEXT,
total NUMERIC(18,2),
created_at TIMESTAMPTZ
)
LANGUAGE plpgsql
STABLE
AS $function$
BEGIN
RETURN QUERY
SELECT o.id, o.customer_name, o.total, o.created_at
FROM orders o
WHERE o.id = p_order_id;
END;
$function$;
CREATE OR REPLACE FUNCTION trg_set_modified_at()
RETURNS TRIGGER
LANGUAGE plpgsql
AS $trigger$
BEGIN
NEW.modified_at = NOW();
RETURN NEW;
END;
$trigger$;
CREATE TRIGGER trg_orders_before_update
BEFORE UPDATE ON orders
FOR EACH ROW
EXECUTE FUNCTION trg_set_modified_at();
CREATE TABLE IF NOT EXISTS orders (
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
customer_name TEXT NOT NULL,
total NUMERIC(18,2) NOT NULL DEFAULT 0,
status order_status NOT NULL DEFAULT 'pending',
metadata JSONB,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
created_by TEXT NOT NULL,
modified_at TIMESTAMPTZ,
modified_by TEXT,
CONSTRAINT ck_orders_total CHECK (total >= 0)
);
CREATE INDEX IF NOT EXISTS idx_orders_customer_id ON orders (customer_id);
CREATE INDEX IF NOT EXISTS idx_orders_metadata ON orders USING GIN (metadata);
-- Query JSONB field
SELECT * FROM orders WHERE metadata->>'priority' = 'high';
-- JSONB containment
SELECT * FROM orders WHERE metadata @> '{"tags": ["urgent"]}';
-- Update JSONB field
UPDATE orders SET metadata = metadata || '{"reviewed": true}' WHERE id = 1;
-- Index for JSONB queries
CREATE INDEX idx_orders_metadata_priority ON orders ((metadata->>'priority'));
CREATE TABLE events (
id INTEGER GENERATED ALWAYS AS IDENTITY,
event_date DATE NOT NULL,
payload JSONB
) PARTITION BY RANGE (event_date);
CREATE TABLE events_2026_q1 PARTITION OF events
FOR VALUES FROM ('2026-01-01') TO ('2026-04-01');
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON orders
USING (tenant_id = current_setting('app.tenant_id')::INTEGER);
WITH monthly_totals AS (
SELECT
customer_id,
DATE_TRUNC('month', created_at) AS month,
SUM(total) AS monthly_total
FROM orders
GROUP BY customer_id, DATE_TRUNC('month', created_at)
)
SELECT
customer_id,
month,
monthly_total,
LAG(monthly_total) OVER (PARTITION BY customer_id ORDER BY month) AS prev_month
FROM monthly_totals;
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
4 skills in this plugin
/postgres-frameworksUse when implementing PostgreSQL database code with frameworks — enforces patterns for EF Core/Npgsql (JSONB, enums, identity), SQLAlchemy/Alembic (models, revisions), Flyway, and Dapper with Npgsql/postgres-project-structureUse when scaffolding or reviewing PostgreSQL project layout — migration folder conventions, schema separation, extension management, seed data organization, and pgTAP test layout/postgres-testingUse when writing tests for PostgreSQL database code — pgTAP for in-database tests, pytest with psycopg for integration tests, EF Core integration tests, and test database lifecycle managementnpx claudepluginhub gagandeepp/software-agent-teams --plugin db-postgres