Get the FREE Ultimate OpenClaw Setup Guide →

ln-723-seed-data-generator

Scanned
npx machina-cli add skill levnikolaevich/claude-code-skills/ln-723-seed-data-generator --openclaw
Files (1)
SKILL.md
9.6 KB

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

ln-723-seed-data-generator

Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-720-structure-migrator

Universal seed data generator with two modes: MIGRATE (parse existing ORM schemas) or GENERATE (create from entity definitions). Outputs to any target format (C#, TypeScript, Python, JSON, SQL).


Purpose & Scope

AspectDescription
InputORM schema files (MIGRATE) or entity list (GENERATE)
OutputSeed data files in target format
ModesMIGRATE: parse existing ORM → seed data. GENERATE: entity definitions → seed data

Scope boundaries:

  • Parses ORM schema definitions or accepts entity lists
  • Generates seed data in requested target format
  • Creates realistic sample data using faker libraries
  • Does not generate database migrations, EF Core configs, or ORM models

Mode Selection

ModeWhenInputSource
MIGRATETRANSFORM pipeline — existing ORM schemas foundORM schema filesDrizzle, Prisma, TypeORM, EF Core, SQLAlchemy, Django ORM
GENERATECREATE pipeline — no existing schemasEntity list from ln-700 Phase 0User-provided or starter template (User, Role)

If GENERATE mode receives no entity list, generate starter template with User (id, name, email, role, createdAt) and Role (id, name, description).


Target Formats

FormatOutput FileFaker LibraryUse Case
C# MockDataMockData.csBogus.NET projects
TypeScript fixturesseed.tsFaker.jsNode/React projects
Python factoriesfactories.pyFaker (Python)Django/Flask projects
JSONseed.jsonAPI testing, import scripts
SQLseed.sqlDirect DB seeding

Workflow

PhaseNameActionsOutput
1Parse/Define1A: Parse ORM schema (MIGRATE) or 1B: Accept entity list (GENERATE)Entity model
2Map TypesApply universal type mapping to target formatTarget type definitions
3Generate Seed DataCreate seed files with faker-based realistic dataSeed data files
4VerifyValidate relationships, check syntaxValid seed files

Phase 1: Parse/Define

1A: MIGRATE Mode — Parse ORM Schema

StepActionReference
1A.1Locate schema file(s)
1A.2Auto-detect ORM typeorm_patterns.md — ORM Auto-Detection table
1A.3Extract table/model definitionsorm_patterns.md — per-ORM parsing section
1A.4Extract column definitions with typesorm_patterns.md
1A.5Identify constraints (PK, FK, nullable, unique)orm_patterns.md
1A.6Extract enum definitionsorm_patterns.md

1B: GENERATE Mode — Accept Entity Definitions

StepActionReference
1B.1Receive entity list from orchestrator (or use starter template)
1B.2Parse entity definitions (name, fields, types)
1B.3Infer relationships from field names (userId → FK to User)relationship_mapping.md
1B.4Apply default constraints (id = PK, *Id = FK)

Output: Entity model with columns, types, and constraints.


Phase 2: Map Types

Convert entity types to target format types.

StepActionReference
2.1Select target format (from orchestrator params)
2.2Map column types to target formattype_mapping.md — Universal Type Mapping table
2.3Determine nullable status per targettype_mapping.md
2.4Map foreign keys and relationshipsrelationship_mapping.md
2.5Transform names to target conventionSee Name Conventions table below

Name Conventions by Target:

TargetClass/ModelProperty/FieldFile
C#PascalCase singularPascalCasePascalCase.cs
TypeScriptPascalCase singularcamelCasecamelCase.ts
PythonPascalCase singularsnake_casesnake_case.py
JSONcamelCasecamelCasekebab-case.json
SQLsnake_case pluralsnake_casesnake_case.sql

Phase 3: Generate Seed Data

Create seed files with realistic data using faker libraries.

StepActionReference
3.1Determine generation order (parents → children)relationship_mapping.md
3.2Generate IDs (GUIDs/UUIDs) for all entitiesdata_generation.md
3.3Generate field values using fakerdata_generation.md, type_mapping.md — Faker Integration
3.4Ensure FK relationships valid (child references existing parent ID)relationship_mapping.md
3.5Write seed file in target format

Faker integration rule: All generated seed files MUST use faker libraries for realistic data with deterministic seeding (fixed seed value for reproducibility).

TargetFaker Setup
C#var faker = new Bogus.Faker(); Randomizer.Seed = new Random(42);
TypeScriptimport { faker } from '@faker-js/faker'; faker.seed(42);
Pythonfrom faker import Faker; fake = Faker(); Faker.seed(42)

Generation order by dependency:

OrderEntity TypeGenerate After
1Root entities (no FK)First
2First-level childrenParents exist
3Second-level childrenGrandparents exist
NDeepest childrenAll ancestors exist

Phase 4: Verify

CheckMethodExpected
Syntax validLanguage-specific checkNo syntax errors
FKs validCross-referenceAll FKs point to existing IDs
Types correctType analysisProper types for target format
Names follow conventionPattern checkPer-target naming convention
Faker deterministicRe-run with same seedIdentical output

Supported ORM Detection

ORMDetection PatternEcosystem
DrizzlepgTable(), mysqlTable(), sqliteTable()Node.js
Prismamodel X { syntax in .prisma filesNode.js
TypeORM@Entity(), @Column() decoratorsNode.js
EF CoreDbContext, DbSet<>, [Table] attributes.NET
SQLAlchemyBase = declarative_base(), Column()Python
Django ORMmodels.Model, models.CharField()Python

Entity Transformation Rules

SourceTargetTransformation
Table name (plural, snake)Class name (singular, Pascal)user_profilesUserProfile
Column name (snake)Property name (target convention)created_atCreatedAt / createdAt / created_at
Enum nameEnum type (Pascal)status_enumStatusEnum
FK columnNavigation propertyuser_idUserId / userId

Sample Data Guidelines

Field TypeSample CountDistribution
Root entities3-5 itemsVaried status/priority
Child entities5-10 itemsDistributed across parents
Leaf entities10-20 itemsRealistic variety

Critical Rules

  • Single Responsibility: Generate only seed data, no ORM models or migrations
  • Idempotent: Can re-run with same seed to produce identical output
  • Valid Relationships: All FKs must reference existing parent IDs
  • Faker Required: Use faker libraries for realistic data, never random strings
  • Deterministic Seeding: Fixed seed value (42) for reproducibility across re-runs
  • Generation Order: Parents before children, always
  • Mode Awareness: MIGRATE parses files; GENERATE accepts definitions — never mix

Definition of Done

  • Mode determined (MIGRATE or GENERATE)
  • Entity model extracted/defined with all fields and constraints
  • Target format selected and type mappings applied
  • Seed data files generated with faker-based realistic values
  • Deterministic seeding verified (re-run produces identical output)
  • Foreign keys reference valid parent IDs
  • Names follow target format conventions
  • Sample data includes 5-10 items per entity

Risk Mitigation

RiskDetectionMitigation
Unknown ORM typeAuto-detection failsLog warning, ask orchestrator for ORM hint
Invalid type mappingUnknown column typeUse string as fallback, log warning
FK mismatchFK references non-existent IDGenerate parents first, validate after
No entity list in GENERATEEmpty inputUse starter template (User, Role)
Name collisionDuplicate class/table namesPrefix with feature name
Circular referencesSelf-referencing with cyclesLimit depth, validate graph

Reference Files

FilePurpose
references/orm_patterns.mdORM auto-detection and schema parsing patterns (Drizzle, Prisma, TypeORM, EF Core, SQLAlchemy, Django)
references/type_mapping.mdUniversal type mapping (ORM-agnostic → C#, TypeScript, Python) + Faker integration
references/data_generation.mdRealistic sample data patterns and generation rules
references/relationship_mapping.mdFK handling, generation order, relationship inference

Version: 3.0.0 Last Updated: 2026-02-07

Source

git clone https://github.com/levnikolaevich/claude-code-skills/blob/master/ln-723-seed-data-generator/SKILL.mdView on GitHub

Overview

ln-723-seed-data-generator is a universal seed data tool with two modes: MIGRATE to parse existing ORM schemas and generate seed data, and GENERATE to create seed data from entity definitions. It outputs to any target format (C#, TypeScript, Python, JSON, SQL) and uses faker libraries to produce realistic sample data. It does not handle migrations or ORM configuration.

How This Skill Works

In MIGRATE mode, it locates ORM schema files, auto-detects the ORM type, and extracts table definitions, column types, and constraints. In GENERATE mode, it accepts an entity list, infers relationships from naming conventions, applies default constraints, maps types to the chosen target format, and renders seed files populated with faker-generated data.

When to Use It

  • You have existing ORM schemas (Drizzle, Prisma, TypeORM, EF Core, SQLAlchemy, Django ORM) and need seed data (MIGRATE).
  • You only have an entity list or starter templates (User, Role) and need to GENERATE seed data.
  • You want seed data output in a specific format: C# MockData, TypeScript seed.ts, Python factories.py, seed.json, or seed.sql.
  • You need realistic sample data powered by faker libraries for your tests or demos.
  • You are bootstrapping a new project and want a quick starter set of seed data.

Quick Start

  1. Step 1: Choose MIGRATE (ORM schemas) or GENERATE (entity list) and prepare inputs.
  2. Step 2: Select a target format (C# MockData, seed.ts, factories.py, seed.json, or seed.sql).
  3. Step 3: Run the generator and review the generated seed files for consistency and constraints.

Best Practices

  • Define the input mode (MIGRATE vs GENERATE) and the target format before running.
  • Verify that ORM/schema mappings align with the target format and constraints.
  • Use the appropriate faker library for the chosen language to ensure realistic data.
  • Validate relationships and constraints (PK, FK, nullable, unique) after generation.
  • If no entities are provided, start with the starter template (User and Role) to bootstrap seed data.

Example Use Cases

  • Migrate a Prisma schema to seed.sql for a PostgreSQL project.
  • Generate seed.ts from User and Role entities for a Node/TypeScript app.
  • Create factories.py for Django models from an entity list to seed a Django project.
  • Produce MockData.cs using Bogus for a .NET application.
  • Export seed.json for API testing and seed scripts in a frontend app.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers