Agent skill

Generating Synthetic Surrogates

by maziyarpanahi in maziyarpanahi/openmed

Replace detected PHI with realistic, type-matched fake values in OpenMed so clinical notes stay readable and parseable instead of full of [REDACTED] markers.

Apache-2.0Auto-check passedLegal & Compliance

Install Generating Synthetic Surrogates

skills CLI
$ npx skills add maziyarpanahi/openmed --skill generating-synthetic-surrogates -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install maziyarpanahi/openmed generating-synthetic-surrogates --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/maziyarpanahi/openmed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/generating-synthetic-surrogates .claude/skills/generating-synthetic-surrogates && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
generating-synthetic-surrogates
GitHub stars
5.5k
Token cost
~1.8k tokens
SKILL.md length
542 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Replace detected PHI with realistic, type-matched fake values in OpenMed so clinical notes stay readable and parseable instead of full of [REDACTED] markers.

  • Works in 6 steps: Choose method="replace" (or a profile… → Enable consistency with consistent=True… → Set locale= so surrogates look native… → …
  • The user wants surrogate names
  • SKILL.md covers When to use this skill, Quick start, Surrogates vs opaque redaction and Custom providers and label…, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Generating Synthetic Surrogates is an agent skill from maziyarpanahi/openmed. Replace detected PHI with realistic, type-matched fake values in OpenMed so clinical notes stay readable and parseable instead of full of [REDACTED] markers. Use when the user wants surrogate names, MRNs, addresses, or dates rather than opaque masks, needs consistent fake identities across a document, must keep notes natural for downstream NLP, or wants to register a custom surrogate generator or provider. Covers deidentify(method="replace", consistent=True, seed=..., locale=...), registerlabelgenerator…

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Legal & Compliance, covering Natural language processing and Privacy and GDPR. The repository describes itself as: Local-first healthcare AI: clinical NER and HIPAA PII de-identification on hardware you control. 2,200+ medical models, 35 model-backed PII languages, and Python, MLX, Android… The licence is Apache-2.0.

When your agent uses it

  • The user wants surrogate names
  • Dates rather than opaque masks
  • Needs consistent fake identities across a document
  • Must keep notes natural for downstream NLP

Example prompts

  • “replace”
  • “/generating-synthetic-surrogates”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Choose method="replace" (or a profile like gdpr_pseudonymization /
  2. Enable consistency with consistent=True and a seed= so repeated
  3. Set locale= so surrogates look native (pt_BR, de_DE, …); it
  4. Register custom generators for any house-specific formats (MRN, account,
  5. If reversibility is needed, add keep_mapping=True and store
  6. Verify no surrogate collides with a real value and residual risk is low

What it can do on your machine

Read from SKILL.md and the folder at commit 34d7b8c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • eur-lex.europa.eu
    • hhs.gov

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Generating Synthetic Surrogates loads about 1.8k tokens when it runs. Until then it costs about 171 tokens; SKILL.md has 542 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~171
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from maziyarpanahi/openmed at commit 34d7b8c, republished under its Apache-2.0 licence (© maziyarpanahi). 542 words, ~1,779 tokens.

Download SKILL.mdSave it as .claude/skills/generating-synthetic-surrogates/SKILL.md (or your agent's skills folder).
name
generating-synthetic-surrogates
description
Replace detected PHI with realistic, type-matched fake values in OpenMed so clinical notes stay readable and parseable instead of full of [REDACTED] markers. Use when the user wants surrogate names, MRNs, addresses, or dates rather than opaque masks, needs consistent fake identities across a document, must keep notes natural for downstream NLP, or wants to register a custom surrogate generator or provider. Covers deidentify(method="replace", consistent=True, seed=..., locale=...), register_label_generator, register_clinical_provider, and Anonymizer/AnonymizerConfig. Pairs with OpenMed deidentifying-clinical-text and configuring-privacy-policies.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
de-identification
metadata.pairs
after
metadata.version
1.0

Generating synthetic surrogates

method="replace" swaps each detected identifier for a realistic, type-matched fake — John Doe becomes Mark Lee, a phone becomes a plausible phone, a date becomes a plausible date. Unlike opaque [REDACTED]/[NAME] masks, surrogate text reads naturally and stays parseable by downstream NLP, while still containing no real PHI. OpenMed generates surrogates on-device via Faker-backed providers keyed to each canonical label.

When to use this skill

Use surrogates when the de-identified text must remain readable or machine- parseable: training data for clinical NLP, demos, QA, or notes a human still needs to skim. If you only need the identifiers gone and don't care about readability, plain method="mask" is simpler and more obviously redacted.

Quick start

python
import openmed

note = (
    "Patient John Doe (MRN 1234567) saw Dr. John Doe's colleague on 2024-03-02. "
    "Reach John Doe at 617-555-0142."
)

result = openmed.deidentify(
    note,
    method="replace",
    consistent=True,     # every "John Doe" -> the SAME surrogate within this call
    seed=42,             # reproducible across runs
    locale="en_US",      # shapes the fakes; defaults from lang via LANG_TO_LOCALE
)
print(result.deidentified_text)
# Patient Mark Lee (MRN 8830127) saw Dr. Mark Lee's colleague on 2024-07-18. ...

consistent=True is what makes the output coherent: the three mentions of "John Doe" collapse to one fake identity instead of three different ones, so the note still makes sense. seed= makes that mapping reproducible run to run.

Surrogates vs opaque redaction

method="mask" ([NAME])method="replace" (surrogate)
Readabilitylow — placeholdershigh — reads like a real note
Downstream NLPtokenizers see [NAME] everywherenatural distribution preserved
Co-referencelost (all [NAME])preserved with consistent=True
Obvious it's de-identifiedyesno (must be tracked out-of-band)
Reversiblewith keep_mapping=Truewith keep_mapping=True

Custom providers and label generators

When a built-in surrogate doesn't match your house format (e.g. your MRNs are H + 7 digits), register a generator or a Faker provider.

python
from openmed import (
    register_label_generator, register_clinical_provider,
    Anonymizer, AnonymizerConfig,
)

# Override the surrogate for one canonical label. Signature: (faker, original, *, locale)
def hospital_mrn(faker, original, *, locale):
    return f"H{faker.numerify('#######')}"

register_label_generator("ID_NUM", hospital_mrn)   # global, all new Anonymizers

# Add a whole custom Faker provider (e.g. proprietary identifier formats):
register_clinical_provider(MyClinicalProvider)     # a faker BaseProvider subclass

# Per-instance control (preferred for isolation): pass providers via config,
# and pull a single surrogate directly when you need one.
anon = Anonymizer(AnonymizerConfig(
    lang="en", consistent=True, seed=7, custom_providers=[MyClinicalProvider],
))
fake = anon.surrogate("1234567", "ID_NUM")

Use register_label_generator(canonical_label, fn) to swap one label's surrogate; register_clinical_provider(provider) to add providers globally; or AnonymizerConfig.custom_providers for per-run scoping. Validate any custom label against openmed.CANONICAL_LABELS.

Workflow

  1. Choose method="replace" (or a profile like gdpr_pseudonymization / canada_pipeda that replaces by default — see configuring-privacy-policies).
  2. Enable consistency with consistent=True and a seed= so repeated mentions resolve to one identity and the result is reproducible.
  3. Set locale= so surrogates look native (pt_BR, de_DE, …); it defaults from lang via LANG_TO_LOCALE (deidentifying-multilingual-text).
  4. Register custom generators for any house-specific formats (MRN, account, address) before the run.
  5. If reversibility is needed, add keep_mapping=True and store result.mapping as a secret, separate from the output.
  6. Verify no surrogate collides with a real value and residual risk is low (auditing-deidentification-runs).
Show full SKILL.md (192 more words)Show less

Hand-off to / from OpenMed

  • Core de-id: deidentifying-clinical-text — method, thresholds, keep_mapping, policies.
  • Policies that replace: configuring-privacy-policies (gdpr_pseudonymization, canada_pipeda).
  • Multilingual surrogates: deidentifying-multilingual-text (lang/locale).
  • Restore: openmed.reidentify(text, mapping) when keep_mapping=True.
  • Other surfaces: MCP openmed_deidentify / REST POST /pii/deidentify.

Edge cases & gotchas

  • Surrogates must not collide with real values. A fake MRN that happens to be a real patient's MRN re-identifies them. Keep generated identifiers out of the real ID space (dedicated prefix/range) and check against your live keys.
  • Surrogates look real but are not labeled. Anyone reading the output cannot tell it's de-identified. Track provenance out-of-band (e.g. an AuditReport) so surrogate notes are never mistaken for source records.
  • Keep the mapping secret. With keep_mapping=True, result.mapping re-identifies everyone — encrypt it and store it apart from the output.
  • register_label_generator is global and process-wide. It mutates a shared registry; for isolation use AnonymizerConfig.custom_providers instead.
  • Consistency is per-document by default. consistent=True makes mentions agree within a call; cross-document stability requires the same seed.
  • Permissive licensing only. Don't build providers from UMLS/SNOMED/CPT/MIMIC/i2b2/n2c2; call restricted resources out-of-process.

Standards & references

© maziyarpanahi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/generating-synthetic-surrogates of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Generating Synthetic Surrogates next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Generating Synthetic Surrogates compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Generating Synthetic Surrogates this skillmaziyarpanahi/openmed5.5k—~1.8kAutomated safety check: PassApache-2.0
Pseudonymization Riskmukul975/Privacy-Data-Protection-Skills301—~3.2kAutomated safety check: PassApache-2.0
C15tc15t/c15t1.9k1 repos~1.6kAutomated safety check: PassApache-2.0
Korean Privacy Termskimlawtech/korean-privacy-terms587—~2.9kAutomated safety check: PassApache-2.0
Gdpr ComplianceSushegaad/Claude-Skills-Governance-Risk-and-Compliance9461 repos~3.9kAutomated safety check: PassMIT
Hipaa ComplianceSushegaad/Claude-Skills-Governance-Risk-and-Compliance9461 repos~2.3kAutomated safety check: PassMIT

Similar skills

  • Pseudonymization Risk

    mukul975/Privacy-Data-Protection-Skills

    Assessment of pseudonymization techniques and re-identification risk.

    301 GitHub stars~3.2k tokensUpdated 6 mo ago
    Legal & ComplianceAuto-check passed
  • C15t

    c15t/c15t

    Work with c15t consent management docs, APIs, and integrations for Next.js, React, and JavaScript.

    1.9k GitHub starsUsed in 1 repo~1.6k tokens
    Legal & ComplianceAuto-check passed
  • Korean Privacy Terms

    kimlawtech/korean-privacy-terms

    처리방침·이용약관 자동 생성 스킬 패키지 (v4.0). An agent skill from kimlawtech/korean-privacy-terms.

    587 GitHub stars~2.9k tokensUpdated 1 mo ago
    Legal & ComplianceAuto-check passed
  • Gdpr Compliance

    Sushegaad/Claude-Skills-Governance-Risk-and-Compliance

    Expert GDPR compliance assistant covering all four core workflows: (1) auditing code and systems for GDPR violations, (2) drafting GDPR-compliant documents such as privacy policies, Data Processing…

    946 GitHub starsUsed in 1 repo~3.9k tokens
    Legal & ComplianceAuto-check passed
  • Hipaa Compliance

    Sushegaad/Claude-Skills-Governance-Risk-and-Compliance

    Expert HIPAA compliance assistant for healthcare and software contexts.

    946 GitHub starsUsed in 1 repo~2.3k tokens
    Legal & ComplianceAuto-check passed
  • Pii Contract Analyze

    gregmos/PII-Shield

    Universal legal document processor with PII anonymization. An agent skill from gregmos/PII-Shield.

    150 GitHub stars~8.9k tokensUpdated 3 mo ago
    Legal & ComplianceAuto-check: notes

More from maziyarpanahi/openmed

All 74 skills in this repo
  • Checks OpenMed de-identified clinical text against the 18 HIPAA Safe Harbor identifier categories and reports gaps and residual re-identification risk.

    5.5k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • OpenMed Model Card Writer

    maziyarpanahi/openmed

    Fills in a model card for an OpenMed clinical NER or de-identification model from its evaluation reports: intended use, metrics, subgroups and limitations.

    5.5k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Walks a data pipeline against the HIPAA Privacy and Security Rule checklist and produces a gap report before it processes patient data.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • ICD-10 Coding Assistant

    maziyarpanahi/openmed

    Suggests candidate ICD-10-CM diagnosis and ICD-10-PCS procedure codes for clinical text extracted by OpenMed, with rationale for a certified coder to review.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • OpenMed ETL to OMOP CDM

    maziyarpanahi/openmed

    Maps OpenMed-extracted, terminology-coded conditions, drugs and measurements into OMOP CDM v5.4 tables for OHDSI and ATLAS analytics.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Extracting SDOH and Z-Codes

    maziyarpanahi/openmed

    Finds social risks such as housing instability or food insecurity in clinical notes and proposes matching ICD-10-CM Z-codes for a coder to confirm.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about Generating Synthetic Surrogates

What does Generating Synthetic Surrogates do?

Replace detected PHI with realistic, type-matched fake values in OpenMed so clinical notes stay readable and parseable instead of full of [REDACTED] markers. Generating Synthetic Surrogates is an agent skill from maziyarpanahi/openmed. Replace detected PHI with realistic, type-matched fake values in OpenMed so clinical notes stay readable and parseable instead of full of [REDACTED] markers.

When should I use Generating Synthetic Surrogates?

Generating Synthetic Surrogates fits situations like: the user wants surrogate names; dates rather than opaque masks; needs consistent fake identities across a document; must keep notes natural for downstream NLP.

How do I install Generating Synthetic Surrogates in Claude Code?

Run `npx skills add maziyarpanahi/openmed --skill generating-synthetic-surrogates -a claude-code`. Or copy the skill folder (skills/generating-synthetic-surrogates in maziyarpanahi/openmed) into .claude/skills/generating-synthetic-surrogates in your project. Claude Code loads it when a task matches its description.

How do I install Generating Synthetic Surrogates in Codex?

Run `npx skills add maziyarpanahi/openmed --skill generating-synthetic-surrogates -a codex`. Or copy the skill folder (skills/generating-synthetic-surrogates in maziyarpanahi/openmed) into .agents/skills/generating-synthetic-surrogates in your project. Codex loads it when a task matches its description.

Can I use Generating Synthetic Surrogates in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add maziyarpanahi/openmed --skill generating-synthetic-surrogates -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/generating-synthetic-surrogates, .gemini/skills/generating-synthetic-surrogates, .github/skills/generating-synthetic-surrogates and .opencode/skills/generating-synthetic-surrogates in your project.

What does Generating Synthetic Surrogates need to run?

SKILL.md names no scripts, command-line tools or credentials: Generating Synthetic Surrogates is instructions for the agent only. Our summary lists: Python 3.

Does Generating Synthetic Surrogates access the network?

SKILL.md names 2 domains. As links in the text: eur-lex.europa.eu and hhs.gov. This is read from the text; nothing was executed.

Is Generating Synthetic Surrogates safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Generating Synthetic Surrogates use?

Generating Synthetic Surrogates is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Generating Synthetic Surrogates use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Generating Synthetic Surrogates?

Skills that share tags, products or a category with Generating Synthetic Surrogates: Pseudonymization Risk (mukul975/Privacy-Data-Protection-Skills, 301 stars), C15t (c15t/c15t, 1.9k stars), Korean Privacy Terms (kimlawtech/korean-privacy-terms, 587 stars) and Gdpr Compliance (Sushegaad/Claude-Skills-Governance-Risk-and-Compliance, 946 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Generating Synthetic Surrogates?

maziyarpanahi (a GitHub user) maintains it in maziyarpanahi/openmed, which has 5,506 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: maziyarpanahi/openmed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.