Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Arete-Consortium/ai-skills --skill sql명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
Intelligent CI failure diagnosis and guided remediation for GitHub Actions, GitLab CI, and local builds
Pre-execution mapping of codebases, document collections, or problem spaces. Runs BEFORE any Gorgon workflow to give all agents shared situational awareness
Investigative methodology for analyzing document collections — provenance analysis, anomaly detection, redaction detection, and cross-document validation
| name | sql |
| description | SQL Query Optimization |
| lifecycle | experimental |
Analyze and optimize SQL queries.
/sql "SELECT * FROM users..." # Analyze query
/sql --explain # Generate EXPLAIN plan
/sql --index # Suggest indexes
/sql --rewrite # Rewrite for performance
# SQL Analysis
## Original Query
```sql
SELECT u.*, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2024-01-01'
GROUP BY u.id
ORDER BY order_count DESC
LIMIT 100;
Problem: Selects all columns, may fetch unnecessary data Impact: More memory, slower network transfer Fix: Specify only needed columns
Problem: No index on users.created_at
Impact: Full table scan for date filter
Fix: CREATE INDEX idx_users_created_at ON users(created_at);
Problem: No index on orders.user_id
Impact: Slow JOIN operation
Fix: CREATE INDEX idx_orders_user_id ON orders(user_id);
SELECT
u.id,
u.username,
u.email,
COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2024-01-01'
GROUP BY u.id, u.username, u.email
ORDER BY order_count DESC
LIMIT 100;
-- For WHERE clause filtering
CREATE INDEX idx_users_created_at ON users(created_at);
-- For JOIN performance
CREATE INDEX idx_orders_user_id ON orders(user_id);
-- Composite index for common query pattern
CREATE INDEX idx_users_created_at_id ON users(created_at, id);
## Common Anti-Patterns
### SELECT *
```sql
-- Bad
SELECT * FROM users WHERE id = 1;
-- Good
SELECT id, username, email FROM users WHERE id = 1;
-- Bad: N+1 (1 query + N queries)
SELECT * FROM users;
-- Then for each user:
SELECT * FROM orders WHERE user_id = ?;
-- Good: Single query with JOIN
SELECT u.*, o.*
FROM users u
LEFT JOIN orders o ON o.user_id = u.id;
-- Bad: May return millions of rows
SELECT * FROM logs WHERE level = 'ERROR';
-- Good: Bounded result set
SELECT * FROM logs WHERE level = 'ERROR' LIMIT 1000;
-- Bad: Can't use indexes efficiently
SELECT * FROM users WHERE email = 'x' OR username = 'y';
-- Good: Use UNION
SELECT * FROM users WHERE email = 'x'
UNION
SELECT * FROM users WHERE username = 'y';
-- Bad: Can't use index
SELECT * FROM products WHERE name LIKE '%phone%';
-- Good: Use full-text search
SELECT * FROM products WHERE MATCH(name) AGAINST('phone');
-- Index on (a, b, c) can be used for:
WHERE a = ?
WHERE a = ? AND b = ?
WHERE a = ? AND b = ? AND c = ?
-- But NOT for:
WHERE b = ?
WHERE c = ?
WHERE b = ? AND c = ?
EXPLAIN ANALYZE SELECT ...;
| Metric | Good | Bad |
|---|---|---|
| Seq Scan | Small tables | Large tables |
| Index Scan | Large tables | - |
| Rows | Low estimate | High estimate |
| Cost | Low | High |
When /sql is invoked: