PostgreSQL Documentation Reference
2025Emma/vibe-coding-cn
PostgreSQL database documentation - SQL queries, database design, administration, performance tuning, and advanced features. Use when working with PostgreSQL…
SQL query optimization catalog. An agent skill from revfactory/harness-100.
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install revfactory/harness-100 query-optimization-catalog --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .claude/skills && cp -r skills-src/en/19-database-architect/.claude/skills/query-optimization-catalog .claude/skills/query-optimization-catalog && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "query-optimization-catalog" agent skill from https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalog into .claude/skills/query-optimization-catalog/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-catalog", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalogType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install revfactory/harness-100 query-optimization-catalog --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .agents/skills && cp -r skills-src/en/19-database-architect/.claude/skills/query-optimization-catalog .agents/skills/query-optimization-catalog && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "query-optimization-catalog" agent skill from https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalog into .agents/skills/query-optimization-catalog/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-catalog", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install revfactory/harness-100 query-optimization-catalog --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/en/19-database-architect/.claude/skills/query-optimization-catalog .cursor/skills/query-optimization-catalog && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "query-optimization-catalog" agent skill from https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalog into .cursor/skills/query-optimization-catalog/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-catalog", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/revfactory/harness-100.git --path en/19-database-architect/.claude/skills/query-optimization-catalog--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install revfactory/harness-100 query-optimization-catalog --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/en/19-database-architect/.claude/skills/query-optimization-catalog .gemini/skills/query-optimization-catalog && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "query-optimization-catalog" agent skill from https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalog into .gemini/skills/query-optimization-catalog/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-catalog", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install revfactory/harness-100 query-optimization-catalogInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .github/skills && cp -r skills-src/en/19-database-architect/.claude/skills/query-optimization-catalog .github/skills/query-optimization-catalog && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "query-optimization-catalog" agent skill from https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalog into .github/skills/query-optimization-catalog/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-catalog", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install revfactory/harness-100 query-optimization-catalog --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/en/19-database-architect/.claude/skills/query-optimization-catalog .opencode/skills/query-optimization-catalog && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "query-optimization-catalog" agent skill from https://github.com/revfactory/harness-100/tree/main/en/19-database-architect/.claude/skills/query-optimization-catalog into .opencode/skills/query-optimization-catalog/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "query-optimization-catalog", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
query-optimization-catalogSQL query optimization catalog. An agent skill from revfactory/harness-100.
Query Optimization Catalog is an agent skill from revfactory/harness-100. SQL query optimization catalog. An extension skill for performance-analyst that provides index strategies (B-Tree/Hash/GIN/GiST), execution plan analysis, N+1 problem resolution, partitioning strategies, and per-pattern optimization techniques for slow queries. Use when performing DB performance analysis involving 'query optimization', 'index design', 'execution plans', 'N+1 problems', 'partitioning', 'slow queries', etc. Note: data modeling and security configuration are outside the scope of this skill.
Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Databases, covering Query optimization. It works with SQL and PostgreSQL. The licence is Apache-2.0.
7 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 8e8d35c. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Query Optimization Catalog loads about 1.9k tokens when it runs. Until then it costs about 134 tokens; SKILL.md has 475 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from revfactory/harness-100 at commit 8e8d35c, republished under its Apache-2.0 licence (© revfactory). 475 words, ~1,860 tokens.
.claude/skills/query-optimization-catalog/SKILL.md (or your agent's skills folder).A reference of index strategies, execution plan analysis, and query anti-pattern resolution used by the performance-analyst agent during performance optimization.
performance-analyst — Directly applies the optimization techniques from this skill to performance analysis and index design.
| Index Type | Suitable Queries | DBMS | Characteristics |
|---|---|---|---|
| B-Tree | =, <, >, BETWEEN, ORDER BY | All | General purpose, default |
| Hash | = equality only | PostgreSQL, MySQL | No range searches |
| GIN | Arrays, JSONB, full-text search | PostgreSQL | Multi-value indexing |
| GiST | Spatial (geometry), ranges | PostgreSQL | PostGIS, range types |
| BRIN | Time-series, naturally sorted data | PostgreSQL | Very small size |
| Fulltext | Full-text search | MySQL, PostgreSQL | Replaces LIKE '%word%' |
INDEX idx_abc ON table(a, b, c)
-- Usable:
WHERE a = 1 -- O (a only)
WHERE a = 1 AND b = 2 -- O (a, b)
WHERE a = 1 AND b = 2 AND c = 3 -- O (all columns)
WHERE a = 1 AND c = 3 -- Partial (a only, c skipped)
-- Not usable:
WHERE b = 2 -- X (a missing)
WHERE c = 3 -- X (a, b missing)Return query results using only the index (no table access needed).
-- Covering index
CREATE INDEX idx_covering ON orders(user_id, status, created_at);
-- This query responds from the index only (Index Only Scan)
SELECT status, created_at FROM orders WHERE user_id = 123;| Scenario | Add Index? | Reason |
|---|---|---|
| Column frequently used in WHERE clause | Yes | Improves search speed |
| FK column in JOIN ON clause | Yes | JOIN performance |
| Column frequently used in ORDER BY | Yes | Avoids sorting |
| Very low cardinality (boolean, etc.) | No | Minimal benefit |
| Frequently UPDATEd column | Carefully | Write performance degradation |
| Small table (under 10K rows) | No | Full scan is faster |
-- Anti-pattern: Individual queries in a loop
SELECT * FROM users;
-- For each user:
SELECT * FROM orders WHERE user_id = ?; -- Repeated N times!
-- Solution: JOIN or IN
SELECT u.*, o.* FROM users u
LEFT JOIN orders o ON u.id = o.user_id;
-- Or batch loading
SELECT * FROM orders WHERE user_id IN (1, 2, 3, ...);-- Anti-pattern
SELECT * FROM products WHERE category = 'electronics';
-- Solution: Only needed columns
SELECT id, name, price FROM products WHERE category = 'electronics';
-- Enables covering index usage-- Anti-pattern: Applying function to indexed column
WHERE YEAR(created_at) = 2025
-- Solution: Convert to range condition
WHERE created_at >= '2025-01-01' AND created_at < '2026-01-01'-- Anti-pattern
WHERE status = 'active' OR category = 'books'
-- Solution: UNION ALL
SELECT * FROM products WHERE status = 'active'
UNION ALL
SELECT * FROM products WHERE category = 'books' AND status != 'active'-- Anti-pattern: Correlated subquery
SELECT * FROM orders o
WHERE o.total > (SELECT AVG(total) FROM orders WHERE user_id = o.user_id);
-- Solution: JOIN + aggregate
SELECT o.* FROM orders o
JOIN (SELECT user_id, AVG(total) as avg_total FROM orders GROUP BY user_id) a
ON o.user_id = a.user_id
WHERE o.total > a.avg_total;-- Anti-pattern: Deep OFFSET
SELECT * FROM products ORDER BY id LIMIT 20 OFFSET 100000;
-- Solution: Cursor-based (Keyset)
SELECT * FROM products WHERE id > 100000 ORDER BY id LIMIT 20;-- Anti-pattern: Thousands of IDs
WHERE id IN (1, 2, 3, ..., 10000)
-- Solution: Temporary table or JOIN
-- PostgreSQL: VALUES or ANY(ARRAY[...])
-- General: Batch processing (500 at a time)EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM orders WHERE user_id = 123 AND status = 'completed';| Node | Meaning | Performance |
|---|---|---|
| Seq Scan | Full table scan | Slow (large data) |
| Index Scan | Index + table access | Moderate |
| Index Only Scan | Response from index only | Fast |
| Bitmap Index Scan | Bitmap-based index scan | Moderate |
| Nested Loop | Nested loop join | Suitable for small datasets |
| Hash Join | Hash table join | Large equality joins |
| Merge Join | Sort-merge join | Large sorted data |
| Sort | Sort operation | Watch memory/disk |
Seq Scan on a large table -> Index neededSort with external merge Disk -> Insufficient work_memactual rows >> estimated rows -> Stale statistics (ANALYZE needed)Nested Loop with a large table -> Encourage Hash Join| Type | Split Criterion | Suitable For | Example |
|---|---|---|---|
| Range | Value range | Time-series | Monthly/yearly partitions |
| List | Value list | Categories | By region, by status |
| Hash | Hash value | Even distribution | user_id % N |
CREATE TABLE events (
id BIGINT,
event_time TIMESTAMPTZ,
data JSONB
) PARTITION BY RANGE (event_time);
CREATE TABLE events_2025_q1 PARTITION OF events
FOR VALUES FROM ('2025-01-01') TO ('2025-04-01');| Level | Tool | Suitable Data | TTL |
|---|---|---|---|
| Query cache | Redis/Memcached | Frequently read query results | 30s-5min |
| ORM cache | Prisma/TypeORM cache | Entity-level | 1-5min |
| Aggregation cache | Materialized View | Statistics/dashboards | 1hr+ |
| CDN cache | CloudFront/CloudFlare | Static API responses | 5-60min |
© revfactory, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in en/19-database-architect/.claude/skills/query-optimization-catalog of revfactory/harness-100.
Open the folder on GitHubat commit 8e8d35c
Query Optimization Catalog next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Query Optimization Catalog this skillrevfactory/harness-100 | 1.3k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| PostgreSQL Documentation Reference2025Emma/vibe-coding-cn | 23k | 1 repos | ~19k | Automated safety check: Pass | MIT | |
| Paro Optimizerzunor/paro | 105 | — | ~957 | Automated safety check: Pass | Apache-2.0 | |
| DB SculptorEliasOulkadi/shokunin | 114 | — | ~3.1k | Automated safety check: Notes | MIT | |
| Postgresql Best Practices CloudbaseTencentCloudBase/CloudBase-AI-Toolkit | 1.1k | 1 repos | ~1.3k | Automated safety check: Pass | MIT | |
| Database OptimizerJeffallan/claude-skills | 12k | — | ~1.6k | Automated safety check: Pass | MIT |
2025Emma/vibe-coding-cn
PostgreSQL database documentation - SQL queries, database design, administration, performance tuning, and advanced features. Use when working with PostgreSQL…
zunor/paro
Design, refactor and diagnose Paro's staged optimizer, using EXPLAIN COMPILE for planning and EXPLAIN ANALYZE for execution.
EliasOulkadi/shokunin
Design database schemas with Prisma/Drizzle, PostgreSQL index strategy (B-tree, GIN, GiST, BRIN, Hash), query optimization (EXPLAIN ANALYZE), migration safety (expand/contract, zero-downtime), and…
TencentCloudBase/CloudBase-AI-Toolkit
CloudBase PostgreSQL access-pattern and slow-query quality guidance.
Jeffallan/claude-skills
Tunes PostgreSQL and MySQL performance by analyzing slow queries and execution plans, designing indexes, rewriting queries and adjusting configuration, one validated change at a time.
Jeffallan/claude-skills
Optimizes SQL queries and designs schemas using CTEs, window functions, covering indexes and EXPLAIN ANALYZE, with notes on dialect differences between major databases.
revfactory/harness-100
A skill for analyzing website anti-bot defense mechanisms and developing legitimate evasion strategies.
revfactory/harness-100
Reference for designing how an API reports failures: structured error codes, response shapes, client-friendly messages, an error catalog and retry or fallback advice.
revfactory/harness-100
Walks a backend-dev agent through OWASP API Top 10 checks, authentication and authorization patterns, and defense code during API design.
revfactory/harness-100
Methodology for systematically designing and generating CLI tool argument parser structures.
revfactory/harness-100
Audience segmentation skill used by the analyst and curator agents.
revfactory/harness-100
Audio storytelling skill used by the podcast scriptwriter and show note editor.
Works with
Categories
SQL query optimization catalog. An agent skill from revfactory/harness-100. Query Optimization Catalog is an agent skill from revfactory/harness-100. SQL query optimization catalog.
Query Optimization Catalog fits situations like: performing DB performance analysis involving query optimization; execution plans.
Run `npx skills add revfactory/harness-100 --skill query-optimization-catalog -a claude-code`. Or copy the skill folder (en/19-database-architect/.claude/skills/query-optimization-catalog in revfactory/harness-100) into .claude/skills/query-optimization-catalog in your project. Claude Code loads it when a task matches its description.
Run `npx skills add revfactory/harness-100 --skill query-optimization-catalog -a codex`. Or copy the skill folder (en/19-database-architect/.claude/skills/query-optimization-catalog in revfactory/harness-100) into .agents/skills/query-optimization-catalog in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add revfactory/harness-100 --skill query-optimization-catalog -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/query-optimization-catalog, .gemini/skills/query-optimization-catalog, .github/skills/query-optimization-catalog and .opencode/skills/query-optimization-catalog in your project.
SKILL.md names no scripts, command-line tools or credentials: Query Optimization Catalog is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Query Optimization Catalog is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.9k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Query Optimization Catalog: PostgreSQL Documentation Reference (2025Emma/vibe-coding-cn, 23k stars), Paro Optimizer (zunor/paro, 105 stars), DB Sculptor (EliasOulkadi/shokunin, 114 stars) and Postgresql Best Practices Cloudbase (TencentCloudBase/CloudBase-AI-Toolkit, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
revfactory (a GitHub user) maintains it in revfactory/harness-100, which has 1,290 GitHub stars. The repository holds 464 skills in this directory. The repository was last updated on March 22, 2026.
Source: revfactory/harness-100 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.