agentleFS
leaf76leaf76/agent-skills/database-analysis/SKILL.md

database-analysis

Skill0 starsChanged 3 months agoMITView on GitHub

Analyze relational database artifacts such as DDL, migrations, ORM models, SQL queries, EXPLAIN plans, and sample result sets. Use when Codex needs cross-database, read-only review of schema design, query behavior, indexing, migration safety, data integrity risk, or evidence-driven next checks without defaulting to live production access.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 17 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to review database-related artifacts without assuming direct database access.

    line 10
  2. Distinctive:

    Use schema analysis for DDL, migrations, ORM models, table definitions, indexes, or relationship questions.

    line 16
  3. Distinctive:

    Use query analysis for SQL text, performance complaints, EXPLAIN output, or indexing suggestions.

    line 17
  4. Distinctive:

    Use migration and data checks for backfills, type changes, renames, constraint changes, or data repair plans.

    line 18
  5. Distinctive:

    If a missing fact changes the conclusion, state the gap explicitly.

    line 40
  6. Distinctive:

    Prefer one primary lane:

    line 44
  7. Distinctive:

    Avoid broad “optimize the whole database” advice when the evidence only supports one area.

    line 50
  8. Distinctive:

    Do not rely on vendor-specific behavior unless the engine is known.

    line 61
  9. Distinctive:

    Keep recommendations actionable.

    line 72
  10. Distinctive:

    Default to artifact-first, read-only analysis.

    line 76
  11. Distinctive:

    Do not assume direct database access.

    line 77
  12. Distinctive:

    Do not run write statements, destructive checks, or production experiments by default.

    line 78
  13. Distinctive:

    If the user explicitly requests live investigation, confirm that the access is read-only and avoid production-impacting queries.

    line 79
  14. Distinctive:

    Prefer parameterized SQL and allowlisted identifier mappings in all examples.

    line 81
  15. Distinctive:

    Check join cardinality, filter selectivity, sorting, grouping, and pagination before suggesting indexes.

    line 86
  16. Distinctive:

    Treat missing constraints, weak nullability, or inconsistent naming as integrity risks, not just style issues.

    line 87
  17. Distinctive:

    When sample sizes or statistics are absent, avoid claiming exact performance outcomes.

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Database Analysis

Overview

Use this skill to review database-related artifacts without assuming direct database access. Start from evidence, keep recommendations reversible, and highlight unknowns instead of guessing.

Quick Triage

Classify the request before going deep:

  • Use schema analysis for DDL, migrations, ORM models, table definitions, indexes, or relationship questions.
  • Use query analysis for SQL text, performance complaints, EXPLAIN output, or indexing suggestions.
  • Use migration and data checks for backfills, type changes, renames, constraint changes, or data repair plans.
  • Combine paths only when the artifacts clearly overlap.

Load only the references that match the task:

  • references/schema-analysis.md
  • references/query-analysis.md
  • references/migration-and-data-checks.md

Default Workflow

1. Inventory the evidence

List what is available and what is missing:

  • Database engine and version
  • DDL, migration files, or ORM models
  • SQL text and bound parameters
  • EXPLAIN or execution-plan output
  • Table sizes, cardinality hints, or sample result sets
  • Existing incidents, error messages, or latency symptoms

If a missing fact changes the conclusion, state the gap explicitly. Ask only for the smallest artifact that unlocks the next step.

2. Pick the narrowest analysis lane

Prefer one primary lane:

  • Structure and consistency
  • Query correctness and performance
  • Migration safety and data integrity

Avoid broad “optimize the whole database” advice when the evidence only supports one area.

3. Analyze from artifact to conclusion

Work from observable evidence:

  • Quote or summarize the relevant schema, SQL fragment, or plan node.
  • Explain why it matters.
  • Distinguish confirmed findings from informed hypotheses.
  • Name the smallest safe next check when proof is incomplete.

Do not rely on vendor-specific behavior unless the engine is known.

4. Produce findings-first output

Order the response like this:

  1. Findings, ordered by severity or likely impact
  2. Supporting evidence
  3. Evidence gaps or assumptions
  4. Safe next checks or validation steps

Keep recommendations actionable. Prefer “add or verify an index matching these predicates” over generic tuning advice.

Safety Rules

  • Default to artifact-first, read-only analysis.
  • Do not assume direct database access.
  • Do not run write statements, destructive checks, or production experiments by default.
  • If the user explicitly requests live investigation, confirm that the access is read-only and avoid production-impacting queries.
  • Flag any SQL injection risk, unsafe dynamic identifiers, or missing input validation immediately.
  • Prefer parameterized SQL and allowlisted identifier mappings in all examples.

Analysis Heuristics

  • Separate correctness problems from performance problems. A fast wrong query is still wrong.
  • Check join cardinality, filter selectivity, sorting, grouping, and pagination before suggesting indexes.
  • Treat missing constraints, weak nullability, or inconsistent naming as integrity risks, not just style issues.
  • For migration work, prefer expand/contract thinking and call out rollback difficulty.
  • When sample sizes or statistics are absent, avoid claiming exact performance outcomes.

Output Expectations

When responding, include:

  • A short statement of what was analyzed
  • Findings first, with concrete evidence
  • Cross-database-safe guidance unless the engine is known
  • Explicit assumptions and unknowns
  • A validation or follow-up checklist when relevant

Example Triggers

  • “Review this schema dump and tell me what is risky.”
  • “Analyze this SQL query and EXPLAIN output.”
  • “Check whether this migration plan is backward compatible.”
  • “Look at these ORM models and infer database design problems.”

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.