database-documentation-gen
БесплатноЗапускает вложенные скриптыНе проверенProcess use when you need to work with database documentation. This skill provides automated documentation generation with comprehensive guidance and…
от jeremylongshore★ 2 961 звезда на GitHubОб этом скилле
Database Documentation Generator
Overview
Generate comprehensive database documentation by introspecting live PostgreSQL or MySQL schemas, extracting table structures, column descriptions, relationships, indexes, constraints, stored procedures, and views. Produces human-readable documentation in Markdown format including entity-relationship descriptions, data dictionary, and column-level metadata.
Prerequisites
- Database credentials with read access to
information_schema,pg_catalog(PostgreSQL), or system tables (MySQL) psqlormysqlCLI for executing introspection queries- Target output directory for generated documentation files
- Existing column comments (
COMMENT ON COLUMN) enhance output quality significantly - Knowledge of the business domain for meaningful table/column descriptions
Instructions
Extract the complete table inventory:
SELECT table_name, obj_description((table_schema || '.' || table_name)::regclass) AS table_comment FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE' ORDER BY table_name(PostgreSQL). For MySQL:SELECT TABLE_NAME, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE().For each table, extract column details:
SELECT c.column_name, c.data_type, c.character_maximum_length, c.is_nullable, c.column_default, pgd.description AS column_comment FROM information_schema.columns c LEFT JOIN pg_catalog.pg_description pgd ON pgd.objsubid = c.ordinal_position AND pgd.objoid = (c.table_schema || '.' || c.table_name)::regclass WHERE c.table_name = 'target_table' ORDER BY c.ordinal_position.Extract primary key and unique constraint definitions:
SELECT tc.constraint_name, tc.constraint_type, kcu.column_name FROM information_schema.table_constraints tc JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name WHERE tc.table_name = 'target_table' AND tc.constraint_type IN ('PRIMARY KEY', 'UNIQUE').Extract foreign key relationships to build the relationship map:
SELECT tc.table_name AS child_table, kcu.column_name AS child_column, ccu.table_name AS parent_table, ccu.column_name AS parent_column, rc.delete_rule, rc.update_rule FROM information_schema.table_constraints tc JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.referential_constraints rc ON tc.constraint_name = rc.constraint_name JOIN information_schema.constraint_column_usage ccu ON rc.unique_constraint_name = ccu.constraint_name WHERE tc.constraint_type = 'FOREIGN KEY'.Extract index definitions:
SELECT indexname, indexdef FROM pg_indexes WHERE schemaname = 'public' ORDER BY tablename, indexname(PostgreSQL). For MySQL:SELECT TABLE_NAME, INDEX_NAME, COLUMN_NAME, NON_UNIQUE, SEQ_IN_INDEX FROM information_schema.STATISTICS WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX.Extract views and their definitions:
SELECT viewname, definition FROM pg_views WHERE schemaname = 'public'. Document each view with its purpose, source tables, and any filtering logic.Extract functions and stored procedures:
SELECT routine_name, routine_type, data_type AS return_type FROM information_schema.routines WHERE routine_schema = 'public'. Include function signatures and parameter descriptions.Generate the data dictionary in Markdown format with one section per table containing: table description, column table (name, type, nullable, default, description), primary key, foreign keys with referenced table, indexes, and any check constraints.
Generate an entity-relationship summary listing all relationships:
parent_table (parent_column) -> child_table (child_column)with cardinality (one-to-many, many-to-many via junction tables).Generate table statistics for context:
SELECT relname, n_live_tup AS row_count, pg_size_pretty(pg_total_relation_size(relid)) AS total_size FROM pg_stat_user_tables ORDER BY n_live_tup DESC. Include approximate row counts and table sizes in the documentation.
Output
- Data dictionary (Markdown) with complete column-level documentation for every table
- Entity-relationship description listing all foreign key relationships with cardinality
- Index catalog documenting all indexes with their columns and purpose
- View definitions with source table references and business logic descriptions
- Schema statistics including table sizes, row counts, and index sizes
Error Handling
| Error | Cause | Solution |
|---|---|---|
| Missing column comments | COMMENT ON COLUMN not used in the database |
Generate inferred descriptions based on column name patterns; flag columns needing manual description |
| Permission denied on pg_catalog | Restricted database user without catalog access | Request pg_read_all_settings role; or use pg_dump --schema-only as an alternative schema source |
| Large schema with 500+ tables | Documentati |
Установить database-documentation-gen в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditGrepGlobBash(psql:*)Bash(mysql:*)Bash(mongosh:*)Вложенные файлы
FAQ
Что делает скилл database-documentation-gen?
Process use when you need to work with database documentation. This skill provides automated documentation generation with comprehensive guidance and automation. Trigger with phrases like "generate docs", "document schema", or "create database documentation".
Как установить скилл database-documentation-gen?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл database-documentation-gen запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
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…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic