Skip to content

specification-builder

Draft drug substance and drug product specifications per ICH Q6A (small molecules) or Q6B (biologics) with impurity thresholds from Q3A and Q3B, residual solvent limits from Q3C and elemental limits from Q3D, as an Excel workbook and a rationale. Use for specification proposals.

Stage CMC and manufacturing
Tier 1 (deterministic tool)
Standards ICH Q6A, ICH Q6B, ICH Q3A(R2), ICH Q3B(R2), ICH Q3C(R8), ICH Q3D(R2)
Minimum pharmaskills 0.3.0
Inputs material description, max daily dose, solvents used, elements assessed, batch data
Outputs specifications xlsx, rationale md, impurity thresholds json, solvent limits json, elemental json
Verified by cmc impurity-thresholds, cmc solvent-limits, cmc elemental

Draft for qualified review. Not a validated system and not 21 CFR Part 11 compliant.

Install only this skill: pharmaskills skills install --agent claude-code --skill specification-builder (see Install).

Purpose

Help a CMC scientist or quality professional draft a specification for a drug substance and a drug product: the list of tests, procedures and acceptance criteria with a written rationale. Numbers that derive from guidance (impurity thresholds, residual solvent PDEs, elemental PDEs) come from the deterministic pharmaskills cmc tools; criteria that depend on batch and stability data stay as placeholders. Everything is a draft for qualified review.

When to use / when not to use

Use for a first specification proposal, an impurity threshold or solvent or elemental limit look-up for a stated maximum daily dose, or a rationale document structure.

Do not use for: setting final limits without batch data, pharmacopoeial monograph compliance statements, genotoxic impurity limits (ICH M7, outside this skill), cell and gene therapy, or excipient specifications. Do not use Q3A or Q3B thresholds for biologics.

Inputs

Required: material (drug substance, drug product, or both), whether it is a small molecule or a biologic, and the maximum daily dose in g/day. Optional: solvents used in the process, elements to assess and the route (oral, parenteral, inhalation), batch analysis data.

Ask once for anything missing, then proceed with stated assumptions and [DATA NEEDED: ...] placeholders. Never invent batch results, methods or limits. State the region assumed (ICH unless told otherwise).

If pharmaskills is not installed, tell the user to run uv tool install pharmaskills and produce the template-only rationale marked unverified.

Workflow

  1. Route. Small molecule (including synthetic peptides below the biologic definition per the user's classification) goes to ICH Q6A; recombinant proteins, monoclonal antibodies and other biotechnological or biological products go to ICH Q6B. Record the route and the reason in routing.json. When unsure, ask once.
  2. Test list. Start from references/q6a-tests.md or references/q6b-tests.md: universal tests first, then specific tests justified by the product. One row per test: procedure, criterion, basis (guideline and section). Criteria that need data are [DATA NEEDED: ...].
  3. Impurity thresholds (small molecules). pharmaskills cmc impurity-thresholds --dose-g-per-day <dose> --kind substance|product --out <file>.json. Use reporting, identification and qualification thresholds from the output. At 1 g/day the drug substance reporting threshold is 0.05 percent.
  4. Residual solvents. For each solvent pharmaskills cmc solvent-limits --solvent <name> --dose-g-per-day <dose> --out <file>.json. A class 1 solvent has avoid true: flag it, propose removal or a risk-benefit justification, never accept it silently. An unknown solvent exits 2: say so and use [DATA NEEDED: ...].
  5. Elemental impurities. pharmaskills cmc elemental --dose-g-per-day <dose> --route <route> --elements <symbol> ... --out <file>.json; the default control strategy is a risk assessment.
  6. Workbook. Write specifications.xlsx with openpyxl: sheets Drug substance, Drug product, Impurity thresholds, Residual solvents, Elemental impurities; every derived number copied from the tool JSON; a draft banner row at the top of each sheet.
  7. Rationale. rationale.md from templates/rationale.md; then insert the draft banner and a provenance block (pharmaskills docs banner --apply rationale.md).

Output contract

File Content
specifications.xlsx Tests, procedures, criteria, basis; threshold, solvent and element sheets
rationale.md Route, thresholds table, solvents with flags, elements, open data needs
routing.json Route decision (ICH Q6A or Q6B) and the guidelines applied
impurity_thresholds_*.json, solvent_*.json, elemental_*.json Raw tool output

Report in your answer: the route, the thresholds, every flagged solvent, and the list of [DATA NEEDED: ...] items that block a final specification.

Verification

Run and report exit codes for each pharmaskills cmc call. Check that every number in the workbook and the rationale appears in a tool JSON or in the user's input. Re-run the threshold call for one dose to confirm the table (for example 1 g/day gives 0.05 percent reporting for a drug substance and 0.1 percent for a drug product). Confirm a biologic does not use Q3A or Q3B numbers.

Guardrails

  • Insert the draft banner in every generated document.
  • Never fabricate batch data, analytical procedures, acceptance criteria, PDEs or citations. Missing items are [DATA NEEDED: ...].
  • Never loosen or remove a limit to make batches pass; list the options (qualify, improve process, justify) instead.
  • Flag every class 1 solvent and every class 1 element for the quality unit.
  • Cite guidance by identifier and section; do not paste guideline text.
  • State the region assumed.

References

  • references/q6a-tests.md - universal and specific tests for small molecules
  • references/q6b-tests.md - tests and scope for biotechnological products
  • references/impurity-solvent-elemental.md - Q3A(R2), Q3B(R2), Q3C(R8), Q3D(R2) summary
  • Public sources: ICH Q6A, Q6B, Q3A(R2), Q3B(R2), Q3C(R8), Q3D(R2).

Template: templates/rationale.md. Script: scripts/run_thresholds.sh.

Examples

Worked examples for a small molecule and a monoclonal antibody: examples/cmc/specification-builder/. Fixtures: skills/specification-builder/evals/fixtures/.

Worked example

Committed example with inputs and outputs: examples/cmc/specification-builder/.

Two synthetic materials (skills/specification-builder/evals/fixtures/):

  • Examplol, a small molecule at 1 g/day: routing.json (ICH Q6A), specifications.xlsx, rationale.md. Tool outputs from pharmaskills cmc impurity-thresholds, solvent-limits and elemental are in impurity_thresholds_*.json, solvent_*.json, elemental_oral.json. Reporting threshold for the drug substance at 1 g/day is 0.05 percent; benzene is class 1 and flagged; the workbook was generated with openpyxl from those JSON files.
  • Examplumab, a monoclonal antibody: routing_biologic.json (ICH Q6B), specifications_biologic.xlsx, rationale_biologic.md. No Q3A or Q3B thresholds applied.
  • refusal_loosen_limits.md and refusal_invent_solvent.md: correct responses to the adversarial prompts. All criteria that depend on batch data are [DATA NEEDED: ...].

Skill source: skills/specification-builder/SKILL.md