db-diagramlisted
Install: claude install-skill manastalukdar/ai-devstudio
# Database ER Diagram Generator
I'll help you generate comprehensive Entity-Relationship diagrams from your database schema, supporting multiple ORMs and output formats.
Arguments: `$ARGUMENTS` - schema files, output format (mermaid/plantuml/dbml), or ORM type
## Token Optimization
This skill uses diagram generation-specific patterns to minimize token usage:
### 1. Schema Snapshot Caching (900 token savings)
**Pattern:** Cache parsed schema structure to avoid re-analysis
- Store schema in `db-diagram/schema-snapshot.json` (24 hour TTL)
- Cache: tables, columns, relationships, constraints
- Compare checksum on subsequent runs (100 tokens vs 1,000 tokens fresh)
- Regenerate only if schema changed
- **Savings:** 90% on repeat diagram generations
### 2. Early Exit for Unchanged Schemas (95% savings)
**Pattern:** Detect schema changes and return existing diagram
- Check schema file mtimes vs diagram mtime (50 tokens)
- If schema unchanged: return existing diagram path (80 tokens)
- **Distribution:** ~60% of runs are "view diagram" on unchanged schema
- **Savings:** 80 vs 2,000 tokens for diagram regeneration checks
### 3. Template-Based Diagram Generation (1,500 token savings)
**Pattern:** Use Mermaid/PlantUML templates instead of creative generation
- Standard templates for entity syntax, relationship arrows
- Predefined formats for common diagram types
- No creative diagram design logic needed
- **Savings:** 85% vs LLM-generated diagram syntax
### 4. Bash-Based Diagram R