home / skills / venkateshvenki404224 / frappe-apps-manager / frappe-fixture-creator

This skill generates Frappe fixture JSONs for test, master, and initial site data to enable repeatable site setups.

npx playbooks add skill venkateshvenki404224/frappe-apps-manager --skill frappe-fixture-creator

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.2 KB
---
name: frappe-fixture-creator
description: Generate fixture files for Frappe test data and master data. Use when creating test fixtures, setup data, or master data for new sites.
---

# Frappe Fixture Creator

Generate fixture JSON files for test data, master data, and initial site configuration in Frappe applications.

## When to Use This Skill

Claude should invoke this skill when:
- User wants to create test fixtures
- User needs master data setup
- User mentions fixtures, test data, or setup data
- User wants repeatable site setup
- User needs demo or sample data

## Capabilities

### 1. Test Fixture Generation

**Item Fixtures:**
```json
[
  {
    "doctype": "Item",
    "item_code": "_Test Item",
    "item_name": "Test Item",
    "item_group": "Products",
    "stock_uom": "Nos",
    "is_stock_item": 1,
    "is_purchase_item": 1,
    "is_sales_item": 1,
    "opening_stock": 100,
    "valuation_rate": 100,
    "standard_rate": 150
  },
  {
    "doctype": "Item",
    "item_code": "_Test Service Item",
    "item_name": "Test Service",
    "item_group": "Services",
    "stock_uom": "Nos",
    "is_stock_item": 0,
    "is_sales_item": 1,
    "standard_rate": 500
  }
]
```

### 2. Hierarchical Fixtures

**Customer Group Tree:**
```json
[
  {
    "doctype": "Customer Group",
    "customer_group_name": "All Customer Groups",
    "is_group": 1
  },
  {
    "doctype": "Customer Group",
    "customer_group_name": "Commercial",
    "parent_customer_group": "All Customer Groups",
    "is_group": 0
  },
  {
    "doctype": "Customer Group",
    "customer_group_name": "Individual",
    "parent_customer_group": "All Customer Groups",
    "is_group": 0
  }
]
```

### 3. Import Fixture

**Load Fixture in App:**
```python
# In app setup
def before_install():
    """Install fixtures before site setup"""
    from frappe.core.page.data_import_tool.data_import_tool import import_doc

    import_doc('my_app/fixtures/item_groups.json')
    import_doc('my_app/fixtures/territories.json')
```

## References

**Frappe Fixture Patterns:**
- Install Fixtures: https://github.com/frappe/frappe/blob/develop/frappe/core/page/data_import_tool/data_import_tool.py
- ERPNext Fixtures: https://github.com/frappe/erpnext/tree/develop/erpnext/setup/fixtures

Overview

This skill generates fixture JSON files for Frappe test data, master data, and initial site configuration. It helps create repeatable, versioned fixtures for automated tests, demo sites, or fresh installations. Use it to produce item records, hierarchical trees (customer groups, territories), and other doctypes ready for import.

How this skill works

The skill inspects requested doctypes and field values, then composes valid Frappe fixture arrays in JSON that match common patterns (flat records, parent/child trees, and importable lists). It can produce sample values, required fields, and optional metadata so fixtures load cleanly with Frappe's import tools. The output is ready to be dropped into app fixtures and invoked during setup or tests.

When to use it

  • Creating repeatable test fixtures for automated unit or integration tests
  • Seeding master data (items, customer groups, territories) for new sites
  • Preparing demo or sample data for demos and user training
  • Automating site setup steps in before_install or site provisioning
  • Converting manual setup steps into version-controlled fixtures

Best practices

  • Include only the minimal required fields for each doctype to avoid validation errors
  • Use stable, descriptive keys (e.g., _Test Item) to avoid collisions with real data
  • Model hierarchical doctypes with explicit parent references and is_group flags
  • Keep fixtures idempotent: avoid changing primary keys or names that tests rely on
  • Store fixtures under your app's fixtures/ folder and load them in before_install

Example use cases

  • Generate a set of Item fixtures with stock and pricing for inventory tests
  • Create a Customer Group tree that mirrors production segmentation for reports
  • Produce territory and company fixtures to run full accounting flows in CI
  • Build simple service and product records for sales order and billing tests
  • Export curated master data from a sandbox into app fixtures for deployment

FAQ

Can fixtures include hierarchical relationships?

Yes. The skill emits parent references and is_group flags so trees like customer groups or territories import in the correct hierarchy.

How do I load the generated fixtures into a site?

Place the JSON in your app's fixtures folder and call Frappe's import utilities or load them in before_install using import_doc.