Database
Agent Skills 오픈 표준 기반 AI 코딩 에이전트용 스킬 컬렉션 (Java, Kotlin, Spring, NestJS, K8s, Terraform, GraphQL, gRPC, OpenTelemetry, a11y, i18n 등 60개)
npx -y skills add iceflower/agent-skills --skill databaseAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Framework-agnostic database rules including migration conventions, query performance, transaction management, concurrency control (optimistic/pessimistic locking), backup strategies, replication patterns, connection pool tuning, and CDC. Includes MySQL and PostgreSQL specific guides. Use when writing SQL or designing database access.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
8.2 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it
Database Rules
1. Migration File Conventions
Naming Format
V{version}__{description}.sql
| Element | Rule | Example |
|---|---|---|
| Version | Sequential number or timestamp | V1, V20240115 |
| Separator | Double underscore __ | V1__ |
| Description | Snake_case, descriptive | create_users_table |
Migration Examples
V1__create_users_table.sql
V2__add_email_index_to_users.sql
V3__create_orders_table.sql
V4__add_status_column_to_orders.sql
Migration Rules
- Never modify a migration that has been applied to any environment
- Each migration must be idempotent where possible (use
IF NOT EXISTS,IF EXISTS) - Include both schema and essential seed data in migrations
- Test migrations against a copy of production data before applying
Migration Safety Checklist
| Operation | Risk | Precaution |
|---|---|---|
| Add column (nullable) | Low | Safe — no data rewrite needed |
| Add column (NOT NULL) | Medium | Requires default value or backfill |
| Drop column | High | Ensure no application code references it |
| Rename column | High | Use two-phase: add new → migrate → drop old |
| Add index | Medium | Use CONCURRENTLY on large tables (Postgres) |
| Drop table | High | Verify no foreign keys or application refs |
| Change column type | High | May require full table rewrite |
Rollback Strategy
- Write corresponding rollback scripts for each migration
- For irreversible changes (drop column), document the decision and ensure backups exist
- Test rollback scripts in staging before production deployment
2. Query Performance
Index Guidelines
- Add indexes on columns used in
WHERE,JOIN,ORDER BY - Use composite indexes for multi-column queries (column order matters)
- Avoid over-indexing — each index slows down writes
- Monitor slow query logs to identify missing indexes
Composite Index Column Order
Index (a, b, c) supports:
✅ WHERE a = ?
✅ WHERE a = ? AND b = ?
✅ WHERE a = ? AND b = ? AND c = ?
✅ WHERE a = ? ORDER BY b
❌ WHERE b = ? (leftmost prefix not satisfied)
❌ WHERE b = ? AND c = ? (leftmost prefix not satisfied)
- Place equality columns before range columns
- Place high-selectivity columns first
Query Best Practices
- Use pagination for list queries — never fetch unbounded result sets
- Avoid
SELECT *— specify only needed columns for large tables - Use
EXISTSinstead ofCOUNTfor existence checks - Avoid complex subqueries — prefer
JOINfor readability and performance
Pagination Patterns
| Pattern | Pros | Cons | Best For |
|---|---|---|---|
| Offset-based | Simple, page navigation | Slow on large offsets | Small datasets |
| Cursor-based | Consistent, fast | No random page access | Large datasets |
| Keyset-based | Fast, no offset overhead | Requires unique sort key | Fixed sort order |
-- Offset-based (simple but slow for large offsets)
SELECT * FROM users ORDER BY id LIMIT 20 OFFSET 100;
-- Cursor-based (fast and consistent)
SELECT * FROM users WHERE id > :last_seen_id ORDER BY id LIMIT 20;
N+1 Query Detection
Symptom: N similar queries in logs for a single operation
-- 1 query to fetch users
SELECT * FROM users WHERE status = 'ACTIVE';
-- N queries to fetch each user's orders (BAD)
SELECT * FROM orders WHERE user_id = 1;
SELECT * FROM orders WHERE user_id = 2;
...
-- Fix: single join query
SELECT u.*, o.* FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.status = 'ACTIVE';
3. Transaction Management Principles
General Rules
| Rule | Reason |
|---|---|
| Keep transactions as short as possible | Reduces lock contention |
| No external API calls inside transactions | Prevents long-held locks on timeout |
| Use read-only transactions for reads | Enables query optimizations |
| Default to reusing existing transaction | Avoids unnecessary overhead |
| Use independent transactions sparingly | Can cause deadlocks |
Scope Example
1. Read data (inside transaction or read-only)
2. Call external API (outside transaction)
3. Write result (separate transaction)
Isolation Levels
| Level | Dirty Read | Non-Repeatable Read | Phantom Read | Use Case |
|---|---|---|---|---|
| READ UNCOMMITTED | Possible | Possible | Possible | Almost never appropriate |
| READ COMMITTED | No | Possible | Possible | Default for most databases |
| REPEATABLE READ | No | No | Possible | Financial calculations |
| SERIALIZABLE | No | No | No | Critical consistency needs |
- Default to database's built-in isolation level (usually READ COMMITTED)
- Only increase isolation when business logic requires stronger guarantees
- Higher isolation = more locking = lower concurrency
Deadlock Prevention
- Always acquire locks in a consistent, predictable order
- Keep lock scope as small as possible
- Set statement/query timeouts to avoid indefinite waits
- Log and monitor deadlock occurrences
4. Data Integrity
Constraints
| Constraint | Purpose | When to Use |
|---|---|---|
| PRIMARY KEY | Unique row identity | Every table |
| FOREIGN KEY | Referential integrity | Related tables |
| UNIQUE | Prevent duplicate values | Business-unique columns (email, etc.) |
| NOT NULL | Prevent missing values | Required fields |
| CHECK | Validate value range/format | Enum-like or bounded values |
| DEFAULT | Provide fallback value | Optional fields with sensible default |
Rules
- Enforce data integrity at the database level, not just application level
- Application validations may be bypassed; database constraints are the last line of defense
- Use
ON DELETE CASCADEcautiously — prefer explicit application-level deletion
5. Anti-Patterns
- Unbounded queries without pagination
SELECT *on large tables- N+1 query patterns (loop of individual queries)
- Long-running transactions with external calls
- Missing indexes on frequently queried columns
- Modifying applied migration files
- No slow query monitoring
- Using database as a message queue
- Storing large blobs in relational tables without evaluating object storage
- Missing foreign key constraints on related tables
- Using
FLOAT/DOUBLEfor monetary values (useDECIMAL/NUMERIC)
Additional References
- For MySQL-specific rules, see references/mysql.md
- For PostgreSQL-specific rules, see references/postgresql.md
- For concurrency control and reliability patterns, see references/concurrency-and-reliability.md
What ships with it: 5 files
35.5 KB alongside SKILL.md, 1 of them executable
references/
- concurrency-and-reliability.md10.0 KB
- mysql.md7.7 KB
- postgresql.md9.0 KB
scripts/
- detect_migration_issues.pyruns7.9 KB
- README.md867 B
Gives 0 of the 12 instructions most databases sql skills give in ~1.6k tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07
- Use parameterized queriesin 37 of 589, across 34 files
- Use timestamptz for timestampsin 30 of 589, across 14 files
- Index foreign keysin 29 of 589, across 18 files
- Create indexes concurrentlyin 29 of 589, across 24 files
- Use numeric type for moneyin 25 of 589, across 8 files
- Use cursor pagination instead of offsetin 24 of 589, across 17 files
- Select only required columnsin 24 of 589, across 20 files
- Add indexes manually on foreign key columnsin 22 of 589, across 12 files
- Normalize to third normal formin 19 of 589, across 10 files
- Configure connection poolingin 19 of 589, across 17 files
- Put equality columns before range columns in indexesin 18 of 589, across 10 files
- Read individual rule files for detailed explanationsin 18 of 589, across 4 files
Said here and by no other author read
- paginate list queries
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.