agentleFS
charliehzmcharliehzm/medharness/.claude/skills/test-data-generation/SKILL.md

test-data-generation

Skill85 starsChanged 6 months agoApache-2.0View on GitHub

Use this skill at Step 5 of the v2 SOP to generate stage-isolated synthetic test fixtures (mock data) for an OpenSpec change. Outputs fixtures into mock/阶段N-<名称>/, computes fingerprints, declares synthetic-only source, and runs the fingerprint match against the real-sample fingerprint library. Chinese trigger examples: "生成测试数据", "Mock 数据生成", "Step 5", "合成 fixture", "生成 mock", "测试数据 generation". Do NOT use to sample from production, do NOT use real PHI as seed even after redaction. Success = fixtures generated, fingerprints computed, fingerprint match against real-sample library returns zero collisions, source declaration marked synthetic-only.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read schema from change specs (data model section in design.md).

    line 42
  2. Distinctive:

    If any collision/near-match: stop, escalate, do not write fixtures.

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Data Generation

Generates fixtures the change can be tested against, with the strong invariant: never reversible to real patients.

Generation modes (pick one)

ModeWhenRisk
Pure synthetic (faker-style)DefaultLow
Schema-driven randomWhen distribution matters less than shapeLow
Distribution-matched synthetic (DP)When ML features depend on realistic distributionsMedium — guard against re-identification
Real → fully-decoupled (rare)Only with Data Steward signoff + 18-id strip + outlier removal + k-anonymity ≥ 5High — extra audit

Forbidden mode: "sample from production then mask names". Cannot prevent re-identification. Refuse.

Workflow

  1. Read schema from change specs (data model section in design.md).
  2. Choose generation mode; document choice in source_declaration.md.
  3. Generate per-stage directory: mock/阶段N-<名称>/.
  4. For each output file, compute fingerprints (sha256 of canonical-sorted rows).
  5. Compare fingerprints against the real-sample fingerprint library (held by Data Steward).
  6. If any collision/near-match: stop, escalate, do not write fixtures.
  7. Else: write fixtures + fingerprints.txt + source_declaration.md.

Source declaration template

# Source Declaration · 阶段N-<名称>

- 生成模式: <pure-synthetic / schema-driven / distribution-matched / real-decoupled>
- 生成时间: <ts>
- 生成器: <tool + version>
- 真实样本接触: 否(默认)/ 是(需 Data Steward 签字)
- 指纹核验: <PASS / FAIL>,对比库版本 <x.y>
- 合规等级承诺: 本数据集等同 L1,可在所有 allowlist 模型上使用

Common failure modes

  1. "Looks real" generators — Faker with locale 'zh_CN' produces plausible Chinese names but no link to real patients; this is fine. The trap is when devs seed with real values.
  2. Distribution-matched without DP — releasing means/variances can leak. Mitigation: differential privacy budget recorded in source declaration.
  3. Forgetting fingerprint match — fixtures written but never checked. Mitigation: this skill MUST run fingerprint compare before write.
  4. Cross-stage mixing — same fixture used across stages. Mitigation: per-stage directory; do not symlink.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.