agentsclimarketplace

Mk database

Skill ngocsangyem/MeowKit/packages/mewkit/src/migrate/modules/cursor/root/.cursor/skills/mk-database

Production ready. AI Agent Workflow System for Claude Code

Install
npx -y skills add ngocsangyem/MeowKit --skill mk-database

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 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

Database patterns: schema design, migrations, query optimization, indexing. PostgreSQL primary. Use for 'database schema', 'migration', 'SQL optimization'.

SKILL.md

5.4 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Database — Schema, Migrations, Query Optimization

Provides reference-backed guidance for database design tasks. PostgreSQL is the primary target; most patterns apply to MySQL and SQLite with minor syntax differences.

When to Use

  • Designing a new schema or adding tables/columns
  • Writing migration files (up + down)
  • Optimizing slow queries
  • Adding indexes
  • Triggers: "database schema", "migration", "query optimization", "indexing", "SQL", "N+1"

Phase Anchor

Phase: 1 (Plan) for schema design and migration planning Phase: 3 (Build) for implementation and query writing Handoff: Developer implements, reviewer validates per references/migration-patterns.md safety checklist

Process

Step 1: Identify Task Type

Determine which task is being requested:

TaskLoad Reference
Schema design (new tables, relationships)references/schema-design.md
Migration (up/down, rollback, zero-downtime)references/migration-patterns.md
Query writing or optimizationreferences/query-optimization.md
Multiple tasksLoad all relevant references

Step 2: Identify Database Type

Check the project for database markers:

MarkerDatabase
postgres:// or postgresql:// in env/configPostgreSQL
mysql:// or mysql2 packageMySQL
sqlite3 package or .sqlite fileSQLite
mongodb:// or mongooseMongoDB

If PostgreSQL or unknown → use PostgreSQL syntax (most complete). If MySQL/SQLite → note any syntax differences in the response. MongoDB → schema-design and query-optimization references apply conceptually; migrations differ.

Step 3: Apply Patterns

Load the relevant reference file(s) and apply the patterns to the specific task.

Always validate the output against these checks:

Schema checklist:

  • All tables use snake_case plural naming
  • Primary key declared (UUID or BIGINT serial)
  • Foreign keys declared with explicit ON DELETE/ON UPDATE rules
  • created_at and updated_at timestamps present
  • No EAV (entity-attribute-value) anti-pattern

Migration checklist:

  • Both up (apply) and down (rollback) provided
  • No table-locking operations in production migration (see migration-patterns.md)
  • Data migrations separated from schema migrations
  • Filename is timestamp-based

Query checklist:

  • No N+1 (no queries inside loops)
  • EXPLAIN ANALYZE recommended for complex queries
  • Indexes proposed where needed
  • No SELECT * in production queries
  • LIMIT present on unbounded queries

Step 4: Deliver

Return:

  1. The SQL/migration code
  2. Which patterns were applied (brief reference)
  3. Any risks flagged (missing rollback, potential lock, N+1 risk)
  4. Suggested indexes if not already present

Security Constraint

NEVER write SQL with string interpolation or template literals — parameterized queries only. See security-rules.md — SQL injection is a blocked pattern.

-- BLOCKED: string interpolation
WHERE id = ${userId}

-- CORRECT: parameterized
WHERE id = $1   -- PostgreSQL
WHERE id = ?    -- MySQL/SQLite

Reference Files

  • references/schema-design.md — naming, normalization, common patterns, anti-patterns
  • references/migration-patterns.md — safe migrations, zero-downtime, rollback
  • references/query-optimization.md — indexing, N+1, EXPLAIN, pagination

Gotchas

  • Adding a NOT NULL column without a default locks the table on Postgres < 12ALTER TABLE users ADD COLUMN verified BOOLEAN NOT NULL acquires an exclusive lock for the full backfill; add the column as nullable first, backfill in batches, then add the NOT NULL constraint with ALTER TABLE ... SET NOT NULL (uses constraint scan, not rewrite, on PG 12+).
  • CREATE INDEX without CONCURRENTLY blocks all writes — a standard index build holds ShareLock; on a table with high write throughput this causes queue buildup in pg_stat_activity; always use CREATE INDEX CONCURRENTLY in production, noting it cannot run inside a transaction block.
  • CASCADE DELETE on a foreign key silently removes child rows across migrations — if a parent row is deleted during a data migration, all FK-cascaded children are gone with no error; audit every FK with ON DELETE CASCADE before batch-deleting seed or test data in production.
  • EXPLAIN ANALYZE executes the query; EXPLAIN does not — running EXPLAIN ANALYZE DELETE FROM ... will delete rows; always wrap in a transaction and rollback, or use EXPLAIN (ANALYZE, BUFFERS) only on SELECT queries unless you understand the side effect.
  • Connection pool exhaustion shows as intermittent timeouts, not pool errors — when all pool slots are taken, new queries wait silently until pool_timeout fires; the symptom looks like a slow query but pg_stat_activity shows dozens of idle in transaction connections from callers that forgot to release; always release connections in a finally block.
  • Transaction isolation default (READ COMMITTED) allows non-repeatable reads — two SELECTs in the same transaction can return different rows if another transaction commits between them; use REPEATABLE READ or SERIALIZABLE for financial or inventory operations where consistency across reads matters.

Gives 2 of the 12 instructions most databases sql skills give in ~1.2k tokens

Counted across 589 of the 662 authors here whose files we hold, read 2026-08-06

  • use parameterized querieshere, and in 36 of 589, across 32 files
  • use timestamptz for timestampsin 30 of 589, across 12 files
  • create indexes concurrentlyhere, and in 29 of 589, across 23 files
  • index foreign keysin 28 of 589, across 17 files
  • use numeric type for moneyin 25 of 589, across 8 files
  • select only required columnsin 24 of 589, across 19 files
  • use cursor pagination instead of OFFSETin 23 of 589, across 15 files
  • add indexes manually on foreign key columnsin 22 of 589, across 11 files
  • read individual rule files for detailed explanationsin 18 of 589, across 4 files
  • configure connection poolingin 18 of 589, across 16 files
  • put equality columns before range columns in indexesin 17 of 589, across 9 files
  • normalize to third normal formin 17 of 589, across 8 files

Said here and by no other author read

  • Declare primary keys using UUID or BIGINT serial
  • Use timestamp-based filenames for migrations
  • Use REPEATABLE READ or SERIALIZABLE for financial operations
  • Release database connections in a finally block
  • Avoid the entity-attribute-value anti-pattern

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.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.