# Seed your dev database with fake data your coding agent can regenerate

- Author: RomanMotion (https://wurk.fun/user/RomanMotion)
- Published: 2026-11-10
- Canonical (HTML): https://wurk.fun/blog/seed-your-dev-database-with-fake-data-your-coding-agent-can-regenerate
- Cover image: https://ik.imagekit.io/wurk/browser-uploads/f1c626b5c17e7f0a61dfbbe7a20d85ae7b33a20527243aeec2ee1d0a8b87562a/6449a718-6d4b-4cec-b34a-3a5703850448/cover-seed-1110v.jpg?wurkUpload=v1.ojf-zKErTt-8W2rQ5vFLPM0-JJ5zj0DHKvjEB5_C7XI

---

You typed three fake rows into your dev database two weeks ago and called it testing. Every one of those rows has a short name, no accents, a filled-in email, and no neighbors, because nobody types 800 records by hand. So the app behaves perfectly when you poke it, then falls over the day a real user signs up with an empty bio and a very long name, or the list grows past one page.

A seed script fixes this in one pass. It's a small file that wipes your development database and rebuilds it with hundreds of realistic fake records: accented names, empty optional fields, duplicate emails, and enough rows to make your pagination actually scroll. Your coding agent writes it once, and every run after that is a single command. Here's what the script has to do, the prompt to give your agent, and a working example.

## Three rows hide every bug that matters

Hand-typed test data has one author: you. That makes it a mirror of your assumptions rather than a test of them. You filled in every field because leaving one blank felt like unfinished work, so the app ships with a crash waiting in the null email you never learned to render. You typed "Anna" because a name with diacritics is a pain to type, so your columns, search, and export code all get their first real test on launch day.

The failure modes stack up quietly. Three rows can't fill a page, so pagination, sorting, and "load more" go untested. Nothing is duplicated, so code that assumes unique emails ships alongside a database that allows duplicates. And because your three rows never change, a bug you see today is the bug you see in a month, and the ones you can't see are still invisible.

## What the seed script has to do

Ask your agent for four properties. Each one exists because a script missing it stops getting used.

**Deterministic.** A fixed random seed means every run produces the same records, so a bug you reproduce today is still reproducible tomorrow, and in a teammate's terminal. Both major Faker libraries support this: in JavaScript you call [faker.seed()](https://fakerjs.dev/api/faker.html#seed) with a fixed number. Its docs note that generated values depend on both the seed and the number of calls made since it was set, so seed once at the top of the script and generate in a fixed order.

**Safe.** The script must refuse to run against production. The simplest guard is an allow-list: it runs only when an environment variable says this is development (for example `APP_ENV=development`) and exits with a loud error otherwise. Guessing from the database URL is weaker, because production URLs don't always say "prod".

**Resettable.** One command should drop the existing dev data and reseed from scratch. If resetting takes five manual steps, you'll stop resetting, and stale data will quietly become your "test suite".

**Deliberately awkward.** The script must generate edge cases on purpose, not hope for them: empty optional fields, at least one very long string per text field, non-ASCII names, duplicates wherever your schema allows them, and hundreds of rows so pagination, sorting, and search have something to chew on.

## The prompt to paste into your agent

This is the whole ask. Adapt the file names at the bottom to your project.

```text
Write a seed script for this project:

- Deterministic: pin a fixed random seed at the top so every run
  produces identical data.
- Safe: refuse to run unless APP_ENV=development. Exit with a
  clear error otherwise, before touching any database.
- Resettable: one command drops the current dev data and reseeds.
- Realistic: use a fake-data library (Faker for Python,
  @faker-js/faker for Node) for names, emails, addresses, dates.
- Edge cases on purpose: empty optional fields, at least one very
  long string per text field, non-ASCII names, duplicate emails
  where the schema allows them, and at least 500 rows so pagination
  and sorting get exercised.

Save it as seed.py (or seed.mjs), wire the command into the README,
and show me the exact command to run it. Explain in one sentence
what each guard does.
```

If you don't have an agent set up yet, you can [try the zcode agent harness free](https://zcode.z.ai/invite/ALWM9JUA).

## A working example

Here's a Python version for a small SQLite app, trimmed to the parts that matter. [Faker](https://faker.readthedocs.io/en/master/) is the Python fake-data library, and seeding there is a class method, [Faker.seed()](https://faker.readthedocs.io/en/master/fakerclass.html), not a call on an instance. The Faker docs also warn that seeded results are not guaranteed to stay the same across versions, so pin the Faker version in your requirements file.

```python
# seed.py  (pip install faker, then pin the version)
import os, sys, sqlite3
from faker import Faker

DB_PATH = "app.db"      # your dev database file, not production
ROWS = 500
SEED = 4321

# Guard: only ever run in development
if os.environ.get("APP_ENV") != "development":
    sys.exit("Refusing to seed: set APP_ENV=development first.")

Faker.seed(SEED)                    # same records on every run
fake = Faker(["en_US", "de_DE", "es_ES"])  # accented names too

db = sqlite3.connect(DB_PATH)
db.execute("DROP TABLE IF EXISTS customers")    # reset
db.execute("""CREATE TABLE customers (
    id INTEGER PRIMARY KEY, name TEXT, email TEXT, notes TEXT)""")

rows = []
for i in range(ROWS):
    name = fake.name()
    if i % 7 == 0:                  # very long names
        name += " " + "X" * 80
    email = fake.email() if i % 5 else None      # every 5th email empty
    if i % 50 == 2:        # a few duplicate emails
        email = rows[-1][1]
    notes = fake.sentence() if i % 3 else None   # every 3rd notes empty
    rows.append((name, email, notes))

db.executemany(
    "INSERT INTO customers (name, email, notes) VALUES (?, ?, ?)", rows)
db.commit()
print(f"Seeded {ROWS} customers into {DB_PATH}")
```

On the Node side, the same three lines get you started:

```js
import { faker } from "@faker-js/faker";
faker.seed(4321);   // same records on every run
// faker.person.fullName(), faker.internet.email(), ...
```

The seed value itself is arbitrary; 4321 is just something memorable. Change it whenever you want a fresh but still reproducible dataset.

## Never seed with copies of real customer data

The obvious shortcut is tempting: export the production table, load it into dev, done. Don't. A dev database is a second copy of personal data living on your laptop, in a backup you forgot about, in a repo someone might commit, and every tool that can read it now has access to your customers' records. Fake data gives you the same shapes, lengths, and edge cases with none of the liability. If you want production-like volume or variety, seed fake data at volume, not real names.

## How to check the result

Run the script twice and compare the results (for example, dump the table to a file after each run and diff the two); that's the determinism test. Open the app with the fresh data and exercise everything you never tested: does page 50 load, does sorting survive duplicate emails, does the longest name in the list break a layout, do the accented names show up in search? Fix what breaks, reseed, repeat. If you run long agent sessions on a GLM coding plan, here's [10% off GLM coding plans](https://z.ai/subscribe?ic=R0K78RJKNW).

## The 60-second checklist

- Seed script exists; one command runs it.
- Fixed seed pinned at the top; two runs produce identical data.
- Guard: runs only when APP_ENV=development, exits loudly otherwise.
- One command resets and reseeds from scratch.
- Empty fields, long strings, non-ASCII names, and duplicates are all in there on purpose.
- 500+ rows, pagination and sorting actually exercised.
- No real customer data anywhere in the seed path.

There's [more on our blog](https://jackgross-five.vercel.app) on building with coding agents.

If this saved you an afternoon of hand-typing rows, a tip in $WURK helps us keep writing these.
