Agent skill

Query Optimization Catalog

by revfactory in revfactory/harness-100

SQL 쿼리 최적화 카탈로그. An agent skill from revfactory/harness-100.

Apache-2.0Auto-check passedDatabases

Install Query Optimization Catalog

skills CLI
$ npx skills add revfactory/harness-100 --skill query-optimization-catalog -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install revfactory/harness-100 query-optimization-catalog --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .claude/skills && cp -r skills-src/ko/19-database-architect/.claude/skills/query-optimization-catalog .claude/skills/query-optimization-catalog && rm -rf skills-src

Use ~/.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/

Facts

Skill name
query-optimization-catalog
GitHub stars
1.3k
Token cost
~1.3k tokens
SKILL.md length
445 words
Files
1
Skills in repo
464
Repo updated
First seen
Licence
Apache-2.0

At a glance

SQL 쿼리 최적화 카탈로그. An agent skill from revfactory/harness-100.

  • Works in 7 steps: N+1 문제 → SELECT * → 함수 사용으로 인덱스 무효화 → …
  • Tasks that involve Query optimization
  • SKILL.md covers 대상 에이전트, 인덱스 전략, 슬로우 쿼리 안티패턴 & 해결 and EXPLAIN 분석 가이드 (PostgreSQL), plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Query Optimization Catalog is an agent skill from revfactory/harness-100. SQL 쿼리 최적화 카탈로그. 인덱스 전략(B-Tree/Hash/GIN/GiST), 실행 계획 분석, N+1 문제 해결, 파티셔닝 전략, 슬로우 쿼리 패턴별 최적화 기법을 제공하는 performance-analyst 확장 스킬. '쿼리 최적화', '인덱스 설계', '실행 계획', 'N+1 문제', '파티셔닝', '슬로우 쿼리' 등 DB 성능 분석 시 사용한다. 단, 데이터 모델링이나 보안 설정은 이 스킬의 범위가 아니다.

Its SKILL.md is about 1.3k 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 and SQL. It works with SQL and PostgreSQL. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Query optimization
  • Tasks that involve SQL

Example prompts

  • “N+1 문제”
  • “/query-optimization-catalog”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. N+1 문제
  2. SELECT *
  3. 함수 사용으로 인덱스 무효화
  4. OR 조건의 인덱스 무효화
  5. 서브쿼리 vs JOIN
  6. OFFSET 페이지네이션
  7. 대량 IN 절

What it can do on your machine

Read from SKILL.md and the folder at commit 8e8d35c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    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.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Query Optimization Catalog loads about 1.3k tokens when it runs. Until then it costs about 66 tokens; SKILL.md has 445 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from revfactory/harness-100 at commit 8e8d35c, republished under its Apache-2.0 licence (© revfactory). 445 words, ~1,330 tokens.

Download SKILL.mdSave it as .claude/skills/query-optimization-catalog/SKILL.md (or your agent's skills folder).
name
query-optimization-catalog
description
SQL 쿼리 최적화 카탈로그. 인덱스 전략(B-Tree/Hash/GIN/GiST), 실행 계획 분석, N+1 문제 해결, 파티셔닝 전략, 슬로우 쿼리 패턴별 최적화 기법을 제공하는 performance-analyst 확장 스킬. '쿼리 최적화', '인덱스 설계', '실행 계획', 'N+1 문제', '파티셔닝', '슬로우 쿼리' 등 DB 성능 분석 시 사용한다. 단, 데이터 모델링이나 보안 설정은 이 스킬의 범위가 아니다.

Query Optimization Catalog — SQL 쿼리 최적화 카탈로그

performance-analyst 에이전트가 성능 최적화 시 활용하는 인덱스 전략, 실행 계획 분석, 쿼리 안티패턴 해결 레퍼런스.

대상 에이전트

performance-analyst — 이 스킬의 최적화 기법을 성능 분석과 인덱스 설계에 직접 적용한다.

인덱스 전략

인덱스 유형별 선택 가이드
인덱스 유형적합 쿼리DBMS특징
B-Tree=, <, >, BETWEEN, ORDER BY전체범용, 기본값
Hash= 동등 비교만PostgreSQL, MySQL범위 검색 불가
GIN배열, JSONB, 전문검색PostgreSQL다중값 인덱싱
GiST공간(geometry), 범위PostgreSQLPostGIS, 범위 타입
BRIN시계열, 자연 정렬 데이터PostgreSQL매우 작은 크기
Fulltext전문검색MySQL, PostgreSQLLIKE '%word%' 대체
복합 인덱스 설계 원칙
왼쪽 접두사 규칙 (Leftmost Prefix)
sql
INDEX idx_abc ON table(a, b, c)

-- 활용 가능:
WHERE a = 1                          -- O (a만)
WHERE a = 1 AND b = 2               -- O (a, b)
WHERE a = 1 AND b = 2 AND c = 3     -- O (전체)
WHERE a = 1 AND c = 3               -- 부분 (a만, c 건너뜀)

-- 활용 불가:
WHERE b = 2                          -- X (a 누락)
WHERE c = 3                          -- X (a, b 누락)
컬럼 순서 결정 규칙
  1. WHERE 등호(=) 조건 컬럼 먼저
  2. 정렬(ORDER BY) 컬럼 다음
  3. 범위(<, >, BETWEEN) 컬럼 마지막
  4. 카디널리티 높은 것 먼저 (단, 규칙 1~3 우선)
커버링 인덱스

인덱스만으로 쿼리 결과를 반환 (테이블 접근 불필요).

sql
-- 커버링 인덱스
CREATE INDEX idx_covering ON orders(user_id, status, created_at);

-- 이 쿼리는 인덱스만으로 응답 (Index Only Scan)
SELECT status, created_at FROM orders WHERE user_id = 123;
인덱스 생성/삭제 판단
상황인덱스 추가?이유
WHERE 절에 자주 사용되는 컬럼O검색 속도 향상
JOIN ON 절의 FK 컬럼OJOIN 성능
ORDER BY 자주 사용되는 컬럼O정렬 회피
매우 낮은 카디널리티 (boolean 등)X효과 미미
자주 UPDATE되는 컬럼신중히쓰기 성능 저하
작은 테이블 (1만 행 미만)X풀스캔이 더 빠름

슬로우 쿼리 안티패턴 & 해결

1. N+1 문제
sql
-- 안티패턴: 루프에서 개별 쿼리
SELECT * FROM users;
-- 각 user마다:
SELECT * FROM orders WHERE user_id = ?;  -- N번 반복!

-- 해결: JOIN 또는 IN
SELECT u.*, o.* FROM users u
LEFT JOIN orders o ON u.id = o.user_id;

-- 또는 배치 로딩
SELECT * FROM orders WHERE user_id IN (1, 2, 3, ...);
2. SELECT *
sql
-- 안티패턴
SELECT * FROM products WHERE category = 'electronics';

-- 해결: 필요한 컬럼만
SELECT id, name, price FROM products WHERE category = 'electronics';
-- 커버링 인덱스 활용 가능
3. 함수 사용으로 인덱스 무효화
sql
-- 안티패턴: 인덱스 컬럼에 함수 적용
WHERE YEAR(created_at) = 2025

-- 해결: 범위 조건으로 변환
WHERE created_at >= '2025-01-01' AND created_at < '2026-01-01'
4. OR 조건의 인덱스 무효화
sql
-- 안티패턴
WHERE status = 'active' OR category = 'books'

-- 해결: UNION ALL
SELECT * FROM products WHERE status = 'active'
UNION ALL
SELECT * FROM products WHERE category = 'books' AND status != 'active'
5. 서브쿼리 vs JOIN
sql
-- 안티패턴: 상관 서브쿼리
SELECT * FROM orders o
WHERE o.total > (SELECT AVG(total) FROM orders WHERE user_id = o.user_id);

-- 해결: JOIN + 집계
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;
6. OFFSET 페이지네이션
sql
-- 안티패턴: 깊은 OFFSET
SELECT * FROM products ORDER BY id LIMIT 20 OFFSET 100000;

-- 해결: 커서 기반 (Keyset)
SELECT * FROM products WHERE id > 100000 ORDER BY id LIMIT 20;
7. 대량 IN 절
sql
-- 안티패턴: 수천 개 ID
WHERE id IN (1, 2, 3, ..., 10000)

-- 해결: 임시 테이블 또는 JOIN
-- PostgreSQL: VALUES 또는 ANY(ARRAY[...])
-- 범용: 배치 처리 (500개씩)

EXPLAIN 분석 가이드 (PostgreSQL)

실행 계획 읽기
sql
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM orders WHERE user_id = 123 AND status = 'completed';
주요 노드 유형
노드의미성능
Seq Scan전체 테이블 스캔느림 (대량 데이터)
Index Scan인덱스 + 테이블 접근보통
Index Only Scan인덱스만으로 응답빠름
Bitmap Index Scan비트맵으로 인덱스 스캔보통
Nested Loop중첩 루프 조인소량 데이터에 적합
Hash Join해시 테이블 조인대량 동등 조인
Merge Join정렬 병합 조인대량 정렬 데이터
Sort정렬 연산메모리/디스크 주의
Show full SKILL.md (151 more words)Show less
경고 신호
  • Seq Scan on 대형 테이블 → 인덱스 필요
  • Sort with external merge Disk → work_mem 부족
  • actual rows >> estimated rows → 통계 오래됨 (ANALYZE 필요)
  • Nested Loop with 대형 테이블 → Hash Join 유도

파티셔닝 전략

파티셔닝 필요 신호
  • 테이블 크기 > 수억 행
  • 시계열 데이터 (로그, 이벤트, 메트릭)
  • 오래된 데이터 주기적 삭제/아카이빙
  • 특정 기간 쿼리가 대부분
파티셔닝 유형
유형분할 기준적합예시
Range값 범위시계열월별/연별 파티션
List값 목록카테고리지역별, 상태별
Hash해시값균등 분산user_id % N
Range 파티셔닝 예시 (PostgreSQL)
sql
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');

캐싱 전략

레벨도구적합 데이터TTL
쿼리 캐시Redis/Memcached자주 읽히는 조회 결과30초~5분
ORM 캐시Prisma/TypeORM 캐시엔티티 단위1~5분
집계 캐시Materialized View통계/대시보드1시간+
CDN 캐시CloudFront/CloudFlare정적 API 응답5~60분
캐시 무효화 전략
  • TTL 기반: 만료 시간 후 자동 갱신
  • 이벤트 기반: 데이터 변경 시 즉시 삭제
  • Write-Through: 쓰기 시 캐시도 함께 갱신
  • Cache-Aside: 읽기 시 캐시 없으면 DB 조회 후 캐시 저장

© 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

Files

Just SKILL.md in ko/19-database-architect/.claude/skills/query-optimization-catalog of revfactory/harness-100.

Open the folder on GitHubat commit 8e8d35c

Compare with similar skills

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.

Query Optimization Catalog compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Query Optimization Catalog this skillrevfactory/harness-1001.3k—~1.3kAutomated safety check: PassApache-2.0
PostgreSQL Documentation Reference2025Emma/vibe-coding-cn23k1 repos~19kAutomated safety check: PassMIT
Postgresql Best Practices CloudbaseTencentCloudBase/CloudBase-AI-Toolkit1.1k1 repos~1.3kAutomated safety check: PassMIT
SQL ProJeffallan/claude-skills12k—~1.3kAutomated safety check: PassMIT
SQL Insightzebbern/claude-code-guide4.6k—~2.1kAutomated safety check: PassMIT
Discover Databaserand/cc-polymath181—~2kAutomated safety check: PassMIT

Similar skills

  • 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…

    23k GitHub starsUsed in 1 repo~19k tokens
    DatabasesAuto-check passed
  • Postgresql Best Practices Cloudbase

    TencentCloudBase/CloudBase-AI-Toolkit

    CloudBase PostgreSQL access-pattern and slow-query quality guidance.

    1.1k GitHub starsUsed in 1 repo~1.3k tokens
    DatabasesAuto-check passed
  • SQL Pro

    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.

    12k GitHub stars~1.3k tokensUpdated 4 days ago
    DatabasesAuto-check passed
  • SQL Insight

    zebbern/claude-code-guide

    Translate natural language to SQL, optimize query performance, and interpret EXPLAIN plans for SQLite and PostgreSQL.

    4.6k GitHub stars~2.1k tokensUpdated today
    DatabasesAuto-check passed
  • Discover Database

    rand/cc-polymath

    Automatically discover database skills when working with SQL, PostgreSQL, MongoDB, Redis, database schema design, query optimization, migrations, connection pooling, ORMs, or database selection.

    181 GitHub stars~2k tokensUpdated 7 mo ago
    DatabasesAuto-check passed
  • SQL Optimization

    github/awesome-copilot

    Official

    Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server…

    40k GitHub starsUsed in 2 repos~2.3k tokens
    DatabasesAuto-check passed

More from revfactory/harness-100

All 464 skills in this repo
  • Anti Bot Analyzer

    revfactory/harness-100

    A skill for analyzing website anti-bot defense mechanisms and developing legitimate evasion strategies.

    1.3k GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • API Error Design Patterns

    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.

    1.3k GitHub stars~1.6k tokensUpdated 6 mo ago
    Auto-check passed
  • API Security Checklist

    revfactory/harness-100

    Walks a backend-dev agent through OWASP API Top 10 checks, authentication and authorization patterns, and defense code during API design.

    1.3k GitHub stars~1.7k tokensUpdated 6 mo ago
    Auto-check passed
  • Arg Parser Generator

    revfactory/harness-100

    Methodology for systematically designing and generating CLI tool argument parser structures.

    1.3k GitHub stars~1.2k tokensUpdated 6 mo ago
    Auto-check passed
  • Audience Segmentation

    revfactory/harness-100

    Audience segmentation skill used by the analyst and curator agents.

    1.3k GitHub stars~1.3k tokensUpdated 6 mo ago
    Auto-check passed
  • Audio Storytelling

    revfactory/harness-100

    Audio storytelling skill used by the podcast scriptwriter and show note editor.

    1.3k GitHub stars~1.6k tokensUpdated 6 mo ago
    Auto-check passed

Works with

Categories

Questions about Query Optimization Catalog

What does Query Optimization Catalog do?

SQL 쿼리 최적화 카탈로그. An agent skill from revfactory/harness-100. Query Optimization Catalog is an agent skill from revfactory/harness-100. SQL 쿼리 최적화 카탈로그.

When should I use Query Optimization Catalog?

Query Optimization Catalog fits situations like: tasks that involve Query optimization; tasks that involve SQL.

How do I install Query Optimization Catalog in Claude Code?

Run `npx skills add revfactory/harness-100 --skill query-optimization-catalog -a claude-code`. Or copy the skill folder (ko/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.

How do I install Query Optimization Catalog in Codex?

Run `npx skills add revfactory/harness-100 --skill query-optimization-catalog -a codex`. Or copy the skill folder (ko/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.

Can I use Query Optimization Catalog in Cursor, Gemini CLI or GitHub Copilot?

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.

What does Query Optimization Catalog need to run?

SKILL.md names no scripts, command-line tools or credentials: Query Optimization Catalog is instructions for the agent only.

Does Query Optimization Catalog access the network?

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.

Is Query Optimization Catalog safe to install?

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.

What licence does Query Optimization Catalog use?

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.

How many tokens does Query Optimization Catalog use?

About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Query Optimization Catalog?

Skills that share tags, products or a category with Query Optimization Catalog: PostgreSQL Documentation Reference (2025Emma/vibe-coding-cn, 23k stars), Postgresql Best Practices Cloudbase (TencentCloudBase/CloudBase-AI-Toolkit, 1.1k stars), SQL Pro (Jeffallan/claude-skills, 12k stars) and SQL Insight (zebbern/claude-code-guide, 4.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Query Optimization Catalog?

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.