본문으로 건너뛰기
cccskills
무료GitHub에 공개

database

Use when working with database architecture, MariaDB/MySQL tuning, indexing strategies, slow queries, or multi-connection patterns — even when the user just says 'this query is slow'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구PostgreSQLMySQL
설치 방법 보기

포함된 파일(4)

  • SKILL.md5.8 KB
  • data/manifest.json865 B
  • data/query-tuning.csv5.0 KB
  • evals/triggers.json3.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

database

Grounded corpus (Tier-1 consultation): symptom → index/strategy decisions come grounded — node <skills-root>/corpus-grounding/scripts/ground.mjs search --manifest <skills-root>/database/data/manifest.json "<symptom>" returns root cause, strategy, good-code sketch, anti-pattern, and the verification probe (EXPLAIN expectation). Corpus: data/query-tuning.csv; its engine versions and their date live in data/manifest.json upstream. Repeating them here is how this line fell two majors behind.

When to use

Use when designing schemas, optimizing queries, adding indexes, or troubleshooting database performance.

Do NOT use when:

  • Writing framework-specific ORM models (use the matching skill — e.g. eloquent for Laravel, symfony-workflow for Doctrine, framework-native skill for Prisma / TypeORM / SQLAlchemy / GORM / Diesel)
  • Creating migrations only — use the framework-specific migration skill (laravel-migration for Laravel, framework-native for others)

Procedure: Optimize a query

Step 0: Inspect

  1. Read project docs in agents/reference/docs/ for database architecture.
  2. Check config/database.php for connection definitions.
  3. Detect engine: check .env driver and docker-compose.yml.

Step 1: Diagnose

Run EXPLAIN / EXPLAIN ANALYZE:

EXPLAIN ANALYZE SELECT * FROM projects WHERE customer_id = 42 AND status = 'active';

Check for: full table scans (type=ALL), missing indexes (key=NULL), filesort, temporary tables.

Step 2: Fix

  • Add missing indexes (most selective column first in composites)
  • Rewrite anti-patterns (subquery → JOIN, OFFSET → cursor, SELECT * → specific columns)
  • Add eager loading for N+1 queries
  • Always paginate list endpoints

Step 3: Verify

Re-run EXPLAIN and confirm improved plan.

Schema awareness (anti-hallucination)

Never guess table or column names. Verify before writing queries/migrations:

  1. Read migrations — source of truth
  2. Read models — $table, $connection, $fillable, $casts, relationships
  3. Run schema queries — use the project's REPL or a raw introspection query:
    • Laravel: php artisan tinker --execute="Schema::getColumnListing('table')"
    • Symfony / Doctrine: bin/console doctrine:mapping:info
    • Rails: bin/rails runner "p ActiveRecord::Base.connection.columns('table').map(&:name)"
    • Prisma: npx prisma db pull --print | grep -A20 "model Table"
    • Generic SQL: psql -d mydb -c "\d table" / mysql -e "DESCRIBE table"
  4. Check project docs — agents/reference/docs/ for conventions
TrapReality
Assuming column existsCheck migration/model first
Wrong table prefixCustomer tables may have prefixes
Wrong connectionapi_database vs customer_database — verify
Inventing pivot tablesCheck if they actually exist

Dump to the Evidence Report (source-discovery)

When the task touches schema-driven work, this dump is the DB surface of the source-discovery discipline. Record it to the gitignored session cache with provenance, framework-neutral (MySQL / Postgres / SQLite; ORM-agnostic):

  • Capture tables, columns, types, primary/foreign/unique keys, indexes, relations, and the derived filter/sort/group-ability — each with observed_at / source (migration:line or the introspection command).
  • In-codebase = local, read fresh, no card. A schema defined by repo migrations / models / ORM / app code (including schemaless stores the app controls — Mongoose / Prisma / Firestore rules) is always resolved locally and re-read each task. The migration is intended truth, the live DB is actual — surface any divergence as a drift signal.
  • Only negative facts graduate to a committed card (agents/knowledge/): "searched, column/table does not exist" after an exhausted search. Positive structure stays in the session Evidence Report, re-read fresh — never a card.
  • A DB-not-in-codebase (vendor SaaS / partner / legacy, schema not in the repo and not app-controlled) is the only DB that may be card-worthy.

Conventions

→ See guideline php/database.md for indexing, transactions, migrations, multi-connection patterns.

Output format

  1. Migration file or query change with EXPLAIN analysis
  2. Index recommendations with rationale

Gotcha

MySQL and MariaDB share a query-syntax world. They never share a migration one. Treat them as one engine for writing a SELECT, and as two engines for everything that changes a schema or reports on a plan: online-DDL semantics, lock behavior under ALTER, feature availability, and EXPLAIN output all diverge. Read the engine and its version from the project before making any claim in that second group; where the project does not declare one, say the engine is unknown rather than assuming.

  • Check existing indexes before adding — duplicates waste write performance.
  • Consider multi-tenant implications — queries may need customer DB scoping.
  • EXPLAIN output varies between MariaDB and MySQL.
  • Don't use TEXT in WHERE without prefix index.

Do NOT

  • Do NOT guess table/column names — verify against migrations or models first.
  • Do NOT add indexes without checking existing ones — duplicates waste write performance.
  • Do NOT use float for money — use decimal.

Auto-trigger keywords

  • database
  • MariaDB
  • MySQL
  • migration
  • indexing
  • query optimization

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when reviewing UI for accessibility — WCAG 2.2 AA, keyboard nav, focus, ARIA, contrast, screen-reader semantics — even on 'is this a11y-OK?' or 'mach das barrierefrei'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

event4u-app/agent-config122026년 10월 20일 업데이트

Use when defining or auditing the activation event — aha-moment selection, retention correlation, falsifiable definition. Triggers on 'what is our aha moment', 'redefine activation'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

event4u-app/agent-config122026년 10월 20일 업데이트

Use when capturing an architectural decision — file naming, next ADR number, Status / Context / Decision / Consequences, index regen; fires even without saying 'ADR'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

event4u-app/agent-config122026년 10월 20일 업데이트

Adversarial critique — devil's advocate, stress-test, honest teardown ('poke holes', 'be brutal', 'was hältst du davon'); explicit request only. Routine code or design review → code-review.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

event4u-app/agent-config122026년 10월 20일 업데이트

Use when reading, creating, or updating agent documentation, module docs, roadmaps, or AGENTS.md. Understands the full .augment/, agents/, and copilot-instructions structure.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

event4u-app/agent-config122026년 10월 20일 업데이트

Use for an adversarial red-team / blue-team / auditor review of an AI agent's CONFIG + behaviour (rules, skills, MCP, hooks, permissions) — attack-chain → defensive-gap list, not a code audit.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

event4u-app/agent-config122026년 10월 20일 업데이트

event4u-app의 스킬 모두 보기

이 스킬의 문제 신고