agentleFS
aneja5aneja5/forge-skills/skills/seed-data-and-fixtures/SKILL.md

seed-data-and-fixtures

Skill3 starsChanged 7 months agoMITView on GitHub

Use when creating demo data, test fixtures, seed scripts, or factory functions, when preparing for a sales demo and the screenshots are full of "John Doe", when test data is missing edge cases, or when seed scripts crash on a second run.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test fixtures are inconsistent across the test suite — every test rebuilds its own data

    line 16
  2. Very specific:

    Every seeded user named "John Doe", "Test User", or user1 / user2

    line 40
  3. Distinctive:

    No edge-case scenarios: no empty states, no overflow, no missing-optional-field

    line 43
  4. Very specific:

    Read .forge/architecture.md and .forge/database-design.md.

    line 52
  5. Very specific:

    Every entity has a factory: createUser(overrides?: Partial<User>): User.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Seed Data and Fixtures

Overview

Produce realistic data for demos, dev environments, and tests — before lorem ipsum makes it to a screenshot. Output is .forge/seed-data.md (the entity inventory, distributions, demo scenarios, and the factory contract) plus the seed scripts themselves. Seeds must be realistic (real-feeling names, plausible timestamps, domain-appropriate content), comprehensive (edge cases included), reproducible (seeded RNG), and idempotent (re-runnable without dupes). Consumed by incremental-implementation (factories for tests), demo-narrative (demo scenes), and testing-strategy (golden-test fixtures).

When to Use

  • A new dev environment is being set up and there's no seed data
  • A demo is coming up and the screenshots have lorem ipsum or "Test User"
  • Test fixtures are inconsistent across the test suite — every test rebuilds its own data
  • A bug only reproduces with specific data and no seed covers that case
  • Multiple developers are stepping on each other's seed data in shared dev DB

When NOT to Use

  • Production data migration — that's database-design + a one-off backfill ADR
  • Schema design — that's database-design
  • Loading anonymized production data for analytics — separate concern, distinct safety rules

Common Rationalizations

ThoughtReality
"Lorem ipsum is fine for now"Lorem ipsum in a demo makes the product look fake. The buyer notices in 4 seconds and you've already lost the deal.
"Just use 'Test User'"Homogeneous seed data hides bugs that only appear with real-world variance — long names, accents, no last name, multi-byte chars, all-caps.
"Seeds don't need to be idempotent"Non-idempotent seeds crash on the second run and corrupt the dev DB. Every developer ends up with a different shape.
"Edge cases in seed data are overkill"The bug you ship is always in the edge case you didn't seed. Empty list, single item, 10k items, missing optional field, deleted-but-referenced.
"We can use production data, it's anonymized"Anonymization is not a checkbox. Re-identification from indirect identifiers is trivial. Use synthesized data.
"Timestamps don't matter, just use now()"All-now() timestamps hide ordering bugs, time-based logic bugs, and "what does this look like with a year of history" bugs.

Red Flags

  • Lorem ipsum visible in a screenshot, demo, or recording
  • Every seeded user named "John Doe", "Test User", or user1 / user2
  • All created_at timestamps within seconds of each other
  • A seed script that errors on a second run (unique constraint violation)
  • No edge-case scenarios: no empty states, no overflow, no missing-optional-field
  • Production PII (real emails, names, phone numbers) checked into the seed file
  • A demo that requires the demo-runner to "set up the data manually first"
  • Factories that don't allow overrides — every test gets the same default user

Core Process

Step 1: Inventory entities needing seed

Read .forge/architecture.md and .forge/database-design.md. List every entity that needs seed data, with the minimum count for a realistic dev environment (e.g., 50 users, 200 tasks per user, 20 organizations, 5k events).

Step 2: Define realistic distributions per field

For each entity, decide what "realistic" means:

FieldNaiveRealistic
Name"John Doe"A pool of 200+ first + last names spanning cultures, lengths (1 char to 30+), with hyphens, apostrophes, multi-byte chars
Emailuser1@test.comfirstname.lastname@<plausible-domain> with the same distribution as names
Timestampnow()Spread across the last 90 days with a realistic curve (more recent = denser)
StatusAll activeWeighted: 70% active, 15% pending, 10% archived, 5% suspended
Content"lorem ipsum"Domain-appropriate (e.g., task titles like "Review Q3 budget", "Onboard new hire", "Fix flaky integration test")
Count fieldsAll 0 or all 100Long-tail distribution: many users with 1-5 items, a few with 50+, one with 500+

Step 3: Write factories with overrides

Every entity has a factory: createUser(overrides?: Partial<User>): User. Defaults from the distribution; overrides allow tests and demos to pin specific fields.

const user = createUser({ email: "demo@example.com", status: "active" });
const power = createUser({ taskCount: 500 });  // edge case

Factories use a seeded RNG (e.g., seedrandom) so the same seed produces the same data — critical for reproducible demos.

Step 4: Write demo-specific scenarios

For each demo scene in .forge/demo-narrative.md (or for each test-needed shape):

  • Happy path scenario — the buyer-facing flow
  • Empty state scenario — fresh user, no data
  • Single-item scenario — one of everything
  • Overflow scenario — long names, long content, many items
  • Error state scenario — failed payment, expired card, locked account

Each scenario is a named function: seedDemoOnboardingScene(), seedDemoPowerUserScene(). The demo script runs the named scene.

Step 5: Make idempotent

Seeds upsert by a stable key — typically a slug or a UUIDv5 derived from a deterministic input. Re-running the script reconciles: missing rows are inserted, existing rows are updated, drift is corrected.

upsert("users", { stable_id: "demo:onboarding:alex" }, { ... });

The seed script can be run before every demo with confidence.

Step 6: Version + document in .forge/seed-data.md

  • Inventory of entities + counts
  • Distribution rules per field
  • Factory API summary
  • Named demo scenarios
  • The stable-key naming convention
  • The PII safety rule (no production data, ever)

Verification

  • .forge/seed-data.md written
  • Zero lorem ipsum anywhere in seed output (grep verified)
  • No John Doe, Test User, or user1 in any seeded user
  • Names span cultures, lengths, and character sets
  • Timestamps spread across a realistic window with a realistic curve
  • Every demo scene in .forge/demo-narrative.md has a corresponding seedDemo<Scene>() function
  • Edge cases seeded: empty list, single item, overflow, error state
  • Seed script runs twice without errors (idempotency tested in CI)
  • No production PII (real emails, names, phone numbers) checked into the seed file
  • Factories accept overrides for every field

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.