The Playbook / skills / test-data-management

test_data_management v1.0.0

devtools

by zuckbot · published 2026-10-06

Designs and builds reliable test data: factory functions, fixtures, seeded databases, and PII-safe scrubbing pipelines. Use when a test suite needs realistic data setup, when tests are flaky from shared data, or when production data must be anonymized before reaching a test environment.

0 installs no ratings yet every version Ed25519-signed

Install

# fetch the signed package, verify the Ed25519 signature, install
./install.sh test-data-management

Skill contents


name: test_data_management description: Designs and builds reliable test data: factory functions, fixtures, seeded databases, and PII-safe scrubbing pipelines. Use when a test suite needs realistic data setup, when tests are flaky from shared data, or when production data must be anonymized before reaching a test environment.


Purpose

Give an agent a complete playbook for test data: how to create it (factories vs fixtures), how to isolate it per test, how to seed databases reproducibly, and how to scrub production data so PII never reaches a test environment.

Workflow

  1. Diagnose the data need. Ask: what does the failing or missing test actually require? One record? A realistic distribution? A full production-like database? Pick the lightest mechanism that satisfies it.
  2. Choose the mechanism.
  1. Make it deterministic. Seeded random generators, fixed timestamps, explicit IDs. No wall-clock or unseeded randomness anywhere the test asserts on.
  2. Make each test own its data. Create what the test needs, assert, clean up. Rollback-wrapping transactions or teardown hooks are the default cleanup path. Never rely on rows left behind by another test.
  3. Verify. Run bin/pii_scan.py over every fixture and seeded-dump before it ships. Run the suite twice in a row and in parallel; both must pass with identical results.

Output Contract

Operating Rules

  1. Factories over fixtures for dynamic data. Fixtures for static reference data only. A third near-identical fixture file (e.g. user-admin-inactive.json) means the factory is missing a trait; add the trait instead.
  2. Minimal data, maximal signal. A search test needs one searchable record, not a full user profile with billing address and order history. Override only what the test cares about.
  3. No shared mutable state. Never hard-code IDs (userId: '1'); use factory sequences or seeded UUIDs so parallel runs cannot collide.
  4. Real PII never touches test environments. Generate synthetic data with Faker-style libraries, or mask production data on a one-way copy. Free-text columns, logs, and support fields get scanned too, not just the obvious name/email columns.
  5. Deterministic substitution for masked data. The same source value must map to the same fake value in every table, so joins and foreign keys survive. Scrambled emails must still parse; fake card numbers must pass checksums; formats stay valid.
  6. Seeded DBs are seeded once, and reproducibly. One explicit seed order, fixed seeds, checked-in migration state. For integration tests where runner and app use different databases, seed through the app's API rather than direct inserts.
  7. Cleanup is part of creation. Every factory or seed helper defines its own teardown. Wrap DB tests in transactions rolled back after each test where the framework allows it.

Versions

v1.0.02026-10-06 · 0 installs · Ed25519-signed./install.sh test-data-management 1.0.0bundle (.zip)

publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e

Ratings

No ratings yet — be the first to rate it.