sql-expert

sql-expert is a skill for Claude Code from personamanagmentlayer/pcl. It costs 66 tokens per session (801 once invoked), scanned A, original, Apache-2.0.

SQL database guidance for designing, querying, optimizing, and administering PostgreSQL, MySQL, and SQL Server databases. SQL is the language used to work with structured data stored in tables.

In plain words
What is it for?
Creating database schemas, writing SQL queries, choosing indexes, improving query performance, and handling database administration.
Why use it?
It helps prevent poorly designed tables and slow or difficult-to-maintain database queries.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Creating database schemas, writing SQL queries, choosing indexes, improving query performance, and handling database administration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/personamanagmentlayer/pcl/sql-expert
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add personamanagmentlayer/pcl --skill sql-expert
Clone the repo
git clone --depth 1 https://github.com/personamanagmentlayer/pcl

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql-expert

README.md
[![agentmods](https://agentmods.dev/badge/skills/personamanagmentlayer/pcl/sql-expert/github.svg)](https://agentmods.dev/skills/personamanagmentlayer/pcl/sql-expert)
Your own site
<a href="https://agentmods.dev/skills/personamanagmentlayer/pcl/sql-expert"><img src="https://agentmods.dev/badge/skills/personamanagmentlayer/pcl/sql-expert/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-expert

Your own site · 80×15
<a href="https://agentmods.dev/skills/personamanagmentlayer/pcl/sql-expert"><img src="https://agentmods.dev/badge/skills/personamanagmentlayer/pcl/sql-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 801 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.00801
Opus 5.5 $0.00026 $0.00320
Sonnet 5.5 $0.00013 $0.00160
Haiku 4.5 $0.00007 $0.00080

Measured 1mo ago against content hash e1ceff53e1f0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

sql-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

stdlib/data/sql-expert/SKILL.md · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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)

5. Use Constraints

CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    age INTEGER CHECK (age >= 0 AND age <= 150),
    email VARCHAR(255) NOT NULL UNIQUE,
    status VARCHAR(20) DEFAULT 'active'
        CHECK (status IN ('active', 'inactive', 'banned'))
);

6. Batch Operations

-- Bad - multiple inserts
INSERT INTO users (name) VALUES ('Alice');
INSERT INTO users (name) VALUES ('Bob');
INSERT INTO users (name) VALUES ('Charlie');

-- Good - single insert
INSERT INTO users (name) VALUES
    ('Alice'),
    ('Bob'),
    ('Charlie');

Approach

When working with SQL:

  1. Design Schema Carefully: Normalize, use constraints, plan indexes
  2. Write Readable Queries: Format SQL, use aliases, add comments
  3. Optimize Performance: Analyze queries, add indexes, avoid N+1
  4. Use Transactions: Ensure data integrity for related operations
  5. Prevent SQL Injection: Always use prepared statements
  6. Monitor Performance: Track slow queries, optimize bottlenecks
  7. Backup Regularly: Plan disaster recovery
  8. Test Thoroughly: Test queries with production-like data volumes

Read the full file on GitHub · 125 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · -733 lines · +40 tokens per session e1ceff53e1f0
  2. 1mo ago First seen · 858 lines · 26 tokens per session scan A 506bdf099a7f

Subscribe to this mod's changes

sql-expert is a skill published in the GitHub repository personamanagmentlayer/pcl (44 stars, last pushed 7d ago), licensed Apache-2.0. It adds 66 tokens to every session and 801 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.