skills/dev-ops/database-schema-analyzer/SKILL.md
analyze postgresql or mysql database schemas from ddl files, schema-only dumps, migration sql, or read-only database metadata. use when the user wants table structure summaries, primary keys, foreign keys, indexes, inferred table relationships, er diagrams, dbml, mermaid erd, schema documentation, or database relationship analysis for postgres/mysql schemas.
npx skillsauth add escapewu/skills database-schema-analyzerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze PostgreSQL and MySQL schemas from DDL, schema-only dumps, migration SQL, or explicit read-only metadata exports. Produce concise schema documentation, table relationship analysis, inferred associations, ER diagrams, Mermaid ERD, and DBML.
Prefer analyzing a schema-only dump or uploaded .sql file. Treat direct database connection strings as sensitive and use them only for read-only schema introspection when the user explicitly provides them and the runtime has the required client tools.
scripts/analyze_schema.py.references/introspection-guide.md, save the extracted DDL/metadata locally, then run scripts/analyze_schema.py..sql file and run the script.python scripts/analyze_schema.py input_schema.sql --out schema_analysis
schema_analysis/report.mdschema_analysis/schema.dbmlschema_analysis/schema.mmdschema_analysis/schema.json_id columns, many-to-many join tables, and high-degree hub tables.Use scripts/analyze_schema.py for repeatable parsing and artifact generation.
python scripts/analyze_schema.py path/to/schema.sql --out out_dir
Optional flags:
python scripts/analyze_schema.py path/to/schema.sql --out out_dir --dialect postgres
python scripts/analyze_schema.py path/to/schema.sql --out out_dir --no-infer
Supported inputs:
CREATE TABLE, ALTER TABLE ... FOREIGN KEY, CREATE INDEX statements.CREATE TABLE, inline keys, KEY / INDEX, CONSTRAINT, ENGINE=... table endings.pg_dump --schema-only and mysqldump --no-data.The parser is intentionally dependency-free and conservative. If it cannot parse a construct, do not invent facts; report that the relevant statement needs manual review.
Use this final response structure unless the user asks for a different format:
# Database schema analysis
## Executive summary
[database size, key domains, relationship density, major caveats]
## Table overview
| table | purpose guess | primary key | important columns | notes |
## Relationships
### Explicit foreign keys
| from | to | columns | cardinality guess |
### Inferred relationships
| from | likely to | evidence | confidence |
## ER diagram
[Mermaid ERD code block or link to generated .mmd]
## DBML
[DBML code block or link to generated .dbml]
## Data-model observations
- [missing indexes, missing FKs, join tables, naming inconsistencies, soft-delete columns, audit columns]
## Next steps
- [concrete follow-up checks]
Keep relationship confidence explicit:
orders.user_id -> users.id.Infer relationships only after listing explicit constraints.
Use these heuristics:
table.user_id likely references users.id, user.id, or a table whose primary key is id and whose normalized name matches user.created_by, updated_by, deleted_by, owner_id, assignee_id often reference a user/account table; label as inferred unless explicit._id, *_uuid, *_key, or strong semantic evidence.parent_id, manager_id, referrer_id.ANALYZE, VACUUM, DROP, ALTER, or any write operation.references/report-template.md for the expected report format and review checklist.references/introspection-guide.md for safe schema extraction from PostgreSQL/MySQL connections.development
Use when working with the news fetcher REST API at <news-fetcher-host> for supported-site lookup, domain article discovery, URL fetching, batch fetch/crawl workflows, fetch history queries, and Bearer-authenticated integration examples.
development
create and refresh repository-specific development standards for an existing local codebase. use when the user wants to analyze a local repository, extract coding conventions from real files, generate docs/ai-dev-standards, create code review checklists, or update existing agents.md or claude.md files so future coding agents load the right standards before development. do not use for generic programming advice detached from a repository.
tools
Replace with description of the skill and when Claude should use it.
development
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.