vm-data-model-extractor
Skill detail with category, linked agents, and source metadata.
vm-data-model-extractor
Extracts data models from ORMs, migrations, schemas, raw SQL, API payloads, client-side storage, and configuration objects. Generates Mermaid ER diagrams with cardinality annotations. Documents entity relationships, field constraints (including validation-derived constraints), access patterns, and schema health issues. Supports Django, SQLAlchemy, Entity Framework, JPA/Hibernate, Prisma, TypeORM, Active Record, Sequelize, raw SQL, and non-ORM codebases (React/Angular SPAs with API-driven data shapes).
Source: .github/skills/code-generation/vm-data-model-extractor/SKILL.md
Used By Agents
Preview
View source preview (first 3000 chars)
# vm-data-model-extractor
## When to Use This Skill
- Reverse engineering database schema from ORM models, migrations, or raw SQL
- Extracting API request/response payload shapes from service files in non-ORM codebases
- Extracting client-side storage shapes (localStorage, sessionStorage, cookies, Redux/MobX stores)
- Extracting configuration shapes from environment files
- Generating ER diagrams from code-defined data models
- Documenting entity relationships, field constraints, and access patterns
- Extracting field-level constraints (required, min/max length, pattern, enum, defaults, nullable, sensitive) for downstream Test Data Generation
- Identifying schema health issues (missing indexes, orphaned models, constraint gaps)
- Understanding how business logic interacts with the data layer
## Unitary Function
**ONE responsibility:** Extract all data model definitions from a codebase, map their relationships, and produce a structured JSON report with Mermaid ER diagrams.
## NOT RESPONSIBLE FOR
- Deep per-file analysis of non-model files (that is `vm-file-deep-analyzer`)
- User flow tracing (that is `vm-flow-mapper`)
- Database performance tuning or query optimization
- Running database migrations or connecting to live databases
- HTML report generation (that is `vm-reverse-engineering-reporter`)
## Input
```json
{
"data_model_files": [
{"file_id": "F012", "path": "src/models/user.py", "language": "python"},
{"file_id": "F013", "path": "src/models/order.py", "language": "python"}
],
"migration_dirs": ["src/migrations/"],
"language": "python",
"orm": "django",
"repo_root": "/absolute/path/to/repo",
"file_analysis_results": []
}
```
| Parameter | Required | Description |
|-----------|----------|-------------|
| `data_model_files` | Yes | List of identified data model files from checklist |
| `migration_dirs` | No | Directories containing migration files |
| `language` | Yes | Primary language |
| `orm` | No | Detected ORM (auto-detected if not provided) |
| `repo_root` | Yes | Repository root for path resolution |
| `file_analysis_results` | No | Phase 2 results for cross-referencing access patterns |
## Output
```json
{
"generated_by": {
"skill": "vm-data-model-extractor",
"version": "1.0.0"
},
"database_type": "PostgreSQL",
"orm": "Django ORM",
"orm_version": "4.2",
"total_entities": 15,
"total_relationships": 22,
"entities": [
{
"name": "User",
"table_name": "auth_user",
"file_path": "src/models/user.py",
"line_start": 10,
"line_end": 45,
"abstract": false,
"inherits_from": "AbstractBaseUser",
"fields": [
{
"name": "id",
"column_name": "id",
"type": "BigAutoField",
"primary_key": true,
"nullable": false,
"unique": true,
"indexed": true,
"default": "auto-increment"
},
{
"name": "email",
"column_name": "email",