# How the dummy-dataset Skill Generates Realistic Test Data

> Discover how the dummy-dataset skill creates realistic test data using custom parameters, constraints, and rules. Generate CSV, JSON, SQL, or script outputs.

- Repository: [Pawel Huryn/pm-skills](https://github.com/phuryn/pm-skills)
- Tags: how-to-guide
- Published: 2026-06-23

---

**The dummy-dataset skill synthesizes realistic test data by accepting domain-specific parameters, applying weighted constraints and conditional rules, and emitting self-contained Python scripts that generate CSV, JSON, SQL, or reusable code outputs.**

The `dummy-dataset` skill is a command-line utility defined in the `phuryn/pm-skills` repository that product managers and developers use to create production-like datasets for testing and prototyping. Unlike simple random data generators, this skill implements a structured eight-step pipeline that respects business rules, statistical distributions, and domain logic to ensure synthetic data behaves like real-world records.

## Parameterized Input Arguments

The skill accepts a concise set of variables that define the data shape and semantics. In [`pm-execution/skills/dummy-dataset/SKILL.md`](https://github.com/phuryn/pm-skills/blob/main/pm-execution/skills/dummy-dataset/SKILL.md), the **Arguments** section specifies six key inputs:

- **`$PRODUCT`** – Name of the product or system the data belongs to
- **`$DATASET_TYPE`** – Logical domain such as *customer-feedback* or *transactions*
- **`$ROWS`** – Number of records to generate (defaults to 100)
- **`$COLUMNS`** – Explicit column list or inferred defaults based on dataset type
- **`$FORMAT`** – Output type: `CSV`, `JSON`, `SQL`, or `Python`
- **`$CONSTRAINTS`** – Business rules governing distributions (e.g., rating skews, email domain mixes)

These parameters drive the generation logic and determine which realism patterns the skill applies to the synthetic dataset.

## The Eight-Step Generation Process

According to the skill definition in [`SKILL.md`](https://github.com/phuryn/pm-skills/blob/main/SKILL.md), the dummy-dataset skill follows a rigorous eight-step workflow:

1. **Identify dataset type** – Map `$DATASET_TYPE` to predefined schemas
2. **Define column specifications** – Determine data types and generator mappings
3. **Decide row count** – Validate `$ROWS` against practical limits
4. **Choose output format** – Branch logic based on `$FORMAT` selection
5. **Apply realistic patterns** – Inject domain-appropriate value distributions
6. **Add constraints** – Enforce business rules specified in `$CONSTRAINTS`
7. **Generate data or script** – Produce either the final dataset or a reusable Python file
8. **Validate output** – Confirm row counts and file integrity before delivery

This structured approach ensures that generated data maintains referential consistency and statistical realism across different export formats.

## Template-Driven Python Script Generation

When users select the **Python** format, the skill emits a self-contained executable script rather than static data. The template defined in [`pm-execution/skills/dummy-dataset/SKILL.md`](https://github.com/phuryn/pm-skills/blob/main/pm-execution/skills/dummy-dataset/SKILL.md) includes several standardized components:

### Standard Library Imports

```python
import csv
import json
import datetime
import random

```

### Column Definitions Dictionary

The script initializes a `columns` dictionary that maps column names to generator types:

```python
columns = {
    "id": "auto-increment",
    "name": "first_last_name",
    "email": "email",
    "created_at": "timestamp",
    "rating": "rating_distribution",
    "category": "category_rules",
    "text": "sentence",
    "product": "product_name"
}

```

### Core Generation Function

The `generate_dataset()` function iterates `$ROWS` times, building record dictionaries using the column definitions:

```python
def generate_dataset():
    data = []
    for i in range(1, ROWS + 1):
        record = {
            "id": f"U{i:06d}",
            "name": f"{random.choice(['Alice','Bob','Carol'])} {random.choice(['Smith','Jones'])}",
            "email": f"user{i}@{random.choice(['gmail.com','yahoo.com','acme.com'])}",
            "created_at": (datetime.datetime.now() - datetime.timedelta(days=random.randint(0,90))).isoformat(),
            "rating": random.choices([5,4,3,2,1], weights=[40,30,20,5,5])[0],
            "category": random.choice(["Bug","Feature Request","Complaint","Praise"]),
            "text": "Lorem ipsum dolor sit amet...",
            "product": random.choice(["electronics","clothing","home"])
        }
        data.append(record)
    return data

```

### Output Helper Functions

The template provides format-specific writers such as `save_as_csv()`:

```python
def save_as_csv(data, filename):
    with open(filename, "w", newline="") as f:
        writer = csv.DictWriter(f, fieldnames=data[0].keys())
        writer.writeheader()
        writer.writerows(data)

```

## Enforcing Realism Through Constraints

The skill distinguishes itself from basic mock generators by implementing **constraint-driven realism**. As documented in [`SKILL.md`](https://github.com/phuryn/pm-skills/blob/main/SKILL.md), the `$CONSTRAINTS` parameter accepts rules that shape data distributions:

- **Skewed rating distributions** – Weighted probabilities (40% five-star, 30% four-star, 20% three-star, 5% each for one and two stars)
- **Conditional category-rating logic** – Bugs correlate with low ratings while feature requests correlate with high ratings
- **Realistic email domain mixing** – Proportional distribution across Gmail, Yahoo, and corporate domains

These constraints ensure that generated datasets exhibit the same statistical patterns and logical correlations found in production data, making them suitable for realistic load testing and UI demonstrations.

## Execution and Validation

After generation, the skill validates output integrity. The Python template includes a validation block that confirms successful execution:

```python
if __name__ == "__main__":
    dataset = generate_dataset()
    save_as_csv(dataset, FILENAME)
    print(f"Generated {len(dataset)} records in {FILENAME}")

```

This produces immediate feedback such as `Generated 200 records in customer_feedback.csv`, confirming that the dataset respects the requested `$ROWS` parameter and is ready for consumption.

## Complete Usage Example

Below is a minimal invocation that generates a CSV file containing 200 customer feedback records:

```bash
dummy-dataset \
  $PRODUCT="AcmeApp" \
  $DATASET_TYPE="customer_feedback" \
  $ROWS=200 \
  $COLUMNS="id,name,email,created_at,rating,category,text,product" \
  $FORMAT="CSV" \
  $CONSTRAINTS="rating_distribution,category_rules,email_domains"

```

The skill expands this command into the complete Python script shown in the previous sections, executing it to produce `customer_feedback.csv` with realistic, constraint-respecting data.

## Summary

- The **dummy-dataset** skill in `phuryn/pm-skills` generates synthetic data through an eight-step pipeline defined in [`pm-execution/skills/dummy-dataset/SKILL.md`](https://github.com/phuryn/pm-skills/blob/main/pm-execution/skills/dummy-dataset/SKILL.md)
- **Input parameters** (`$PRODUCT`, `$DATASET_TYPE`, `$ROWS`, `$COLUMNS`, `$FORMAT`, `$CONSTRAINTS`) control data shape and output format
- **Python template generation** produces self-contained scripts with `generate_dataset()` and `save_as_csv()` functions when the `Python` format is selected
- **Constraint rules** enforce realistic distributions (weighted ratings, conditional categories, mixed email domains) that mirror production data patterns
- **Validation** confirms row counts and file integrity through console output after generation completes

## Frequently Asked Questions

### How does the dummy-dataset skill handle different output formats?

The skill branches its output logic based on the `$FORMAT` parameter. When set to `CSV`, it calls `save_as_csv()` to write headers and rows to a file. For `JSON`, it uses `json.dump()` to serialize the dataset. The `SQL` format generates `INSERT` statements, while the `Python` format returns the full generation script that can be executed repeatedly to produce any of the other formats on demand.

### What types of data constraints can I apply to generated datasets?

The `$CONSTRAINTS` parameter accepts business rules that shape data distributions. Common constraints include weighted probability distributions for ratings (e.g., 40% five-star reviews), conditional logic linking categories to ratings (bugs only appearing with low scores), and realistic mixes of email domains (Gmail, Yahoo, corporate). These constraints ensure synthetic data exhibits realistic statistical patterns and logical correlations.

### Can I regenerate the same dataset multiple times using the dummy-dataset skill?

Yes, when you specify `$FORMAT="Python"`, the skill generates a self-contained Python script rather than static data. This script includes the `generate_dataset()` function and all constraint logic, allowing you to rerun the generation process repeatedly or modify parameters manually. The script uses standard libraries (`csv`, `json`, `datetime`, `random`) ensuring portability across environments without external dependencies.

### Where is the dummy-dataset skill definition located in the repository?

The primary skill specification resides in [`pm-execution/skills/dummy-dataset/SKILL.md`](https://github.com/phuryn/pm-skills/blob/main/pm-execution/skills/dummy-dataset/SKILL.md). This file defines the argument schema, the eight-step generation process, and the Python template structure. The skill is integrated into the CLI through [`pm-execution/commands/generate-data.md`](https://github.com/phuryn/pm-skills/blob/main/pm-execution/commands/generate-data.md), with repository-wide documentation available in the root [`README.md`](https://github.com/phuryn/pm-skills/blob/main/README.md) and execution suite details in [`pm-execution/README.md`](https://github.com/phuryn/pm-skills/blob/main/pm-execution/README.md).