This is a comprehensive SQL reference that covers database design patterns, query optimization, and cross-platform syntax for PostgreSQL, MySQL, and SQL Server. You get normalized schema examples, complex join patterns, window functions, subqueries, and indexing strategies all in one place. The skill includes actual DDL examples showing proper foreign key constraints, check constraints, and index placement. Most useful when you're architecting a new database schema or debugging slow queries, since it demonstrates both the right way to structure relationships and how to write efficient queries with CTEs and window functions. The examples are production-ready, not toy datasets, which makes it easy to adapt patterns to real applications.

skills.sh installs
257
GitHub stars
44
last updated
Aug 21, 2026

Install

$ npx -y skills add personamanagmentlayer/pcl --skill sql-expert --agent claude-code

Installs into .claude/skills of the current project.

Files

SQL Expert

You are an expert in SQL databases with deep knowledge of database design, query optimization, indexing strategies, and administration. You write efficient, maintainable SQL queries and design robust database schemas.

Best Practices

1. Use Prepared Statements

-- Prevent SQL injection
-- Bad (vulnerable)
query = "SELECT * FROM users WHERE email = '" + userInput + "'";

-- Good (safe)
PREPARE stmt FROM 'SELECT * FROM users WHERE email = ?';
EXECUTE stmt USING @email;

2. Normalize Data Appropriately

1NF: Atomic values, no repeating groups
2NF: 1NF + no partial dependencies
3NF: 2NF + no transitive dependencies

Denormalize only for performance when needed

3. Use Foreign Keys

-- Enforce referential integrity
CREATE TABLE posts (
    id SERIAL PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    title VARCHAR(200) NOT NULL
);

4. Add Appropriate Indexes

-- Index foreign keys
CREATE INDEX idx_posts_user_id ON posts(user_id);

-- Index columns used in WHERE, JOIN, ORDER BY
CREATE INDEX idx_posts_created_at ON posts(created_at);

-- Don't over-index (slows writes)

Sponsors

Details

Repository
github.com/personamanagmentlayer/pcl
Categories
Backend & APIs, Design & UI/UX, Databases
First seen
Jun 3, 2026

More from personamanagmentlayer/pcl

All 99
1qodex-ai avatargenerate-swagger-docsqodex-ai/ai-agent-skillsGenerate OpenAPI documentation from source code. Analyzes repository to automatically discover API endpoints and create swagger.json and interactive HTML docume255skills.sh installs
2davila7 avatarshopify-appsdavila7/claude-code-templatesExpert patterns for Shopify app development including Remix/React Router apps, embedded apps with App Bridge, webhook handling, GraphQL Admin API, Polaris compo254skills.sh installs
3novotnyllc avatardotnet-uinovotnyllc/dotnet-artisanBuilds .NET UI apps across Blazor (Server, WASM, Hybrid, Auto), MAUI (XAML, MVVM, Shell, Native AOT), Uno Platform (MVUX, Extensions, Toolkit), WPF (.NET 8+, Fl254skills.sh installs
4phpstan avataranalyse-with-phpstanphpstan/phpstanAnalyse PHP code with PHPStan via the playground API. Tests across all PHP versions (7.2–8.5) and reports errors grouped by version. Supports configuring level,254skills.sh installs
5quiknode-labs avatarquicknode-skillquiknode-labs/blockchain-skillsQuicknode blockchain infrastructure for 80+ chains: Core RPC API, Streams, Webhooks, Blazar WSS, Solana gRPC, HyperCore gRPC, SQL Explorer, Metaplex DAS API, Bl254skills.sh installs
6patricio0312rev avatarmocking-assistantpatricio0312rev/skillsCreates stable mocks for APIs, services, and UI components using MSW (Mock Service Worker), fixture conventions, and example patterns. Use for "API mocking", "M253skills.sh installs