Generate Frappe Test Data with Faker

VerifiedCaution

Generates realistic, correctly-linked Frappe/ERPNext test records via the bench faker CLI, then rolls them back.

Sby Skills Guide Bot
TestingIntermediate
9/21/2026
Claude CodeCursorCodex
#frappe#erpnext#test-data#cli#seeding

Recommended for

Automated summary

Generates realistic, correctly linked Frappe/ERPNext test records through the `bench faker` CLI inside a tracked batch that can be rolled back afterwards.

Strengths

  • Resolves and inserts the DocType's full dependency graph in foreign-key-safe order, reusing existing records instead of duplicating them.
  • `faker plan` previews the dependency tree and flags DocTypes that already have data before anything is written to the database.
  • The `--instructions` option accepts free-text constraints such as locations, salary ranges, roles and inter-record relationships that the LLM applies.
  • Every run returns a batch ID, and `cleanup --batch` deletes the records in reverse dependency order, even after a mid-run crash.

Limitations

  • Requires the Frappe Faker app installed on the site and an AI provider configured in Faker Settings; without both, nothing can be generated.
  • Output quality depends on the LLM: per-record failures can occur and may force a lower count or simpler instructions.
  • Rollback works only from the batch ID printed at generation time, so that ID has to be kept around to clean up.
When to use it

Use it when a test, demo or local repro needs seed data for a Frappe/ERPNext DocType the site does not yet have.

When not to use it

Avoid it on production sites, or when you need deterministic fixtures that must be identical across every run.

Security analysis

Caution
Quality score88/100

The skill uses the bench CLI to generate and clean up test data in a Frappe/ERPNext site. While the actions are legitimate and scoped to a batch rollback, they still modify database state and should be used only on test/demo environments, not production.

Findings
  • •Commands insert and delete database records via the bench CLI, which could affect a live site if misused.
  • •The skill assumes the agent has access to run bench commands, which are not declared as allowed tools.
How this analysis is made

Examples

Seed and roll back Sales Orders
I need some Sales Orders on demo.localhost to test an API — inspect the dependency plan, generate 5 with realistic Indian customers, then clean up the batch when I'm done.
Employees in Chennai
Create test Employees in Chennai so I can test our payroll endpoint: first run bench --site demo.localhost faker plan --doctype "Employee", then generate 10 with plausible engineering roles and salaries.
Plan before generating
Run bench --site staging.localhost faker plan --doctype "Salary Slip" and tell me which dependencies already have data and which ones faker will create before I generate anything.

name: faker-data description: Generate realistic, correctly-linked Frappe/ERPNext test records for any DocType using the bench faker CLI, then roll them back when done. Use when a test, demo, or local repro needs seed data and the site is missing it — e.g. "I need some Sales Orders", "seed data so I can test this API", "create test Employees in Chennai", or "populate the database to test this endpoint".

Frappe Faker — Generate Test Data from the CLI

Use this skill when you need realistic, linked Frappe/ERPNext test records for a specific DocType. Faker resolves the full dependency graph, generates all linked records via LLM, and inserts them in FK-safe order. Every run produces a Faker Batch ID that you can use to delete all generated records when testing is done.

Prerequisites

  • The Frappe Faker app must be installed on the site
  • Faker Settings must have a configured AI provider (check /app/faker-settings)
  • The RQ background worker is not needed — CLI runs synchronously in the terminal

Workflow

1. Inspect dependencies first

bench --site <site> faker plan --doctype "<DocType>"

This shows the full dependency tree without generating anything. Look for:

  • [Has data — will skip] — existing records will be reused; no generation needed
  • [Cyclic] — cycle detected; generation will still proceed
  • [Target] — the DocType you requested

Example output:

Dependency plan for: Salary Slip

Salary Slip  [Target]
  Salary Structure Assignment
    Employee
      Department  [Has data — will skip]
    Company  [Has data — will skip]
  Salary Structure

2. Generate records

bench --site <site> faker generate \
  --doctype "<DocType>" \
  --count <N> \
  --instructions "<free-text requirements>"

Options:

  • --count / -n — number of target doctype records (dependencies get min(count, 5))
  • --skip — comma-separated list of DocTypes to skip (e.g. --skip "Employee,Company")
  • --instructions — natural language constraints passed to the LLM
  • --no-fast-insert — use standard doc.insert() path (runs Python hooks; slower)

Example:

bench --site demo.localhost faker generate \
  --doctype "Salary Slip" --count 3 \
  --instructions "Employees are software engineers in Bangalore, monthly salary 80k-120k INR, use existing company"

Output:

Generating 3 record(s) for Salary Slip...

Batch: abc123def456  |  Created: 12  |  Failed: 0
  Department: 0 created  (skipped — has data)
  Employee: 3 created
  Salary Structure: 3 created
  Salary Structure Assignment: 3 created
  Salary Slip: 3 created

3. Run your tests

Use the generated records for whatever testing or API calls you need.

4. Clean up

bench --site <site> faker cleanup --batch <batch_id>

This deletes all records from the batch in reverse dependency order (FK-safe). Use the batch ID printed by faker generate.

bench --site demo.localhost faker cleanup --batch abc123def456
# → Deleted 12 record(s). Status: Rolled Back

Tips

  • Use --instructions liberally — the LLM respects free-text constraints like dates, locations, salary ranges, roles, and relationships between records
  • Skip doctypes with existing data — if your site already has Employees, use --skip "Employee" to reuse them and avoid duplication
  • Check for errors — if Failed > 0, re-run with a lower count or simpler instructions; per-record errors are logged in the output
  • Batch rollback is partial-crash-safe — if generation crashes mid-way, the batch still tracks all successfully inserted records; cleanup will roll back only what was tracked

Rollback from the UI

Open the Frappe Faker web app at /faker, go to History, click a run row, and use the Rollback button in the detail dialog to delete that batch's records without touching the terminal.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/generate-frappe-test-data-with-faker-muar2z0h/download' --output '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md.part' && mv '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md.part' '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Prerequisites
  • The Frappe Faker app must be installed on the site
  • Faker Settings must have a configured AI provider (check /app/faker-settings)
  • The RQ background worker is not needed — CLI runs synchronously in the terminal

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md' && test -s '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/faker-data' && cp -R '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h' '.claude/skills/faker-data'

Cursor
test -f '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md' && test -s '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/faker-data' && cp -R '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h' '.cursor/skills/faker-data'

Codex
test -f '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md' && test -s '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/faker-data' && cp -R '.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h' '.agents/skills/faker-data'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/generate-frappe-test-data-with-faker-muar2z0h'

openskills read 'generate-frappe-test-data-with-faker-muar2z0h'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/generate-frappe-test-data-with-faker-muar2z0h/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills