writing-draft
Internal skill for expanding section outlines into prose. Called after section outlines are complete.
What this skill does
# Writing Draft
Expand detailed section outlines into prose via the `writing-draft` ultracode workflow — one write-agent per section, in parallel — applying domain-specific style rules. The skill owns the gate, the `/goal` loop, and the mandatory source-verify; the workflow owns the per-section fan-out + JS gate.
**Prerequisites:** PRECIS.md, OUTLINE.md, ACTIVE_WORKFLOW.md, and at least one section outline in `outlines/` must exist.
## Shared Enforcement
Auto-load all constraints matching `applies-to: writing-draft` (includes constraint-loading-protocol, source-anchored-citations, no-bold-lead, topic-sentences, and all shared writing constraints):
!`uv run python3 ${CLAUDE_SKILL_DIR}/../../scripts/load-constraints.py writing-draft`
**You MUST have these constraints loaded before proceeding. No claiming you "remember" them.**
**CRITICAL:** The `constraint-loading-protocol` above requires loading the domain skill (writing-legal/econ/general) and ai-anti-patterns before writing any prose — see Step 2 below.
## Draft Flowchart (This IS the Spec)
Drafting is a **ultracode TRANSFORM workflow**, not hand-drafting. The skill keeps the gate, the `/goal` loop, and the mandatory source-verify; the `writing-draft` workflow owns the per-section fan-out (one write-agent per section, in parallel) and computes the gate in JS. The outline is the spec; each write-agent EXPANDS its section's outline into prose — adding only local prose craft, citations from real sources, and the bridges to neighbors.
```
START (all section outlines in outlines/ exist, OUTLINE_REVIEWED.md APPROVED)
│
├─ Step 1: Load context (PRECIS, OUTLINE, ACTIVE_WORKFLOW) + constraints
│
├─ Step 2: Run the writing-draft WORKFLOW (discover → transform → verify → gate)
│ ├─ Discover: enumerate sections; STRUCTURE gate (paragraph-granular? else bounce to outline)
│ ├─ Transform: one write-agent per section — expands outline → prose, cites REAL sources
│ │ (never fabricates; honest [CITE-NEEDED] when unsourceable), writes bridges from
│ │ the adjacent OUTLINES (no dependency on sibling drafts)
│ ├─ Verify (read-only): coverage (every point) + fidelity (every cite resolves) + transitions
│ └─ Gate (JS): result.overallPass = every section drafted + substrate clean
│
├─ Step 3: Read the gate, drive the /goal loop
│ ├─ underGranular non-empty → STOP, bounce those outlines to writing-outline
│ ├─ overallPass=false → /goal loop: re-invoke (onlyChecks=sectionsThatFailed) + fix findings
│ └─ overallPass=true → proceed
│
├─ Step 4: MANDATORY full source-verify (deep quote-fidelity; resolve every [CITE-NEEDED])
│
└─ GATE: workflow overallPass=true AND source-verify clean?
├─ NO → keep the /goal loop running (no pause)
└─ YES → write DRAFT_COMPLETE.md → Load writing-validate → /writing-review
```
If text and flowchart disagree, the flowchart wins.
<EXTREMELY-IMPORTANT>
## The Iron Law of Drafting
**NO PROSE WITHOUT OUTLINE. Every section must have a detailed outline in `outlines/` BEFORE you write prose for it. This is not negotiable.**
If you find yourself drafting without a matching outline file:
1. STOP immediately
2. DELETE what you wrote
3. Create the outline first using writing-outline
4. THEN draft the prose
Writing without an outline produces incoherent, wandering prose that requires complete rewriting.
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT>
## The Iron Law of Draft Completeness
**Reporting sections complete without verifying every outline point was expanded is NOT HELPFUL — the user publishes a draft with gaps that reviewers catch.**
Before claiming a section is drafted:
1. Open the outline file for that section
2. Check off EVERY subsection point — is it in the prose?
3. Check off EVERY evidence item — is it cited in the prose?
4. Check the word count — does it match the outline's estimate?
If ANY point or evidence is missing, the section is NOT complete. Saying "draft done" when outline points were skipped wastes the user's time — they discover gaps during review that should never have survived drafting. The outline is a contract; the draft must fulfill it.
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT>
## The Iron Law of Depth
**EACH SECTION DESERVES FULL ATTENTION. Do not rush through sections to "finish" the draft. This is not negotiable.**
The failure mode: a single agent writes cursory 2-paragraph versions of every section to reach "draft complete" as fast as possible. This is reward hacking - optimizing for the appearance of completion without the substance.
Each section must:
- Expand EVERY point from the outline (not a subset)
- Include EVERY piece of evidence mapped in the outline
- Develop transitions between subsections
- Meet the word count target from the outline
If you catch yourself writing a section significantly shorter than the outline implies, STOP. You are being cursory. Go back to the outline and expand every point.
</EXTREMELY-IMPORTANT>
## Session Resume Detection
Before starting, check for an existing handoff:
1. Check if `.planning/HANDOFF.md` exists
2. **If found:** Read it and present to user:
- Show the phase, section in progress, and Next Action
- Ask: "Resume from handoff, or start fresh?"
- If resume: skip to the recorded section
- If fresh: proceed normally
3. **If not found:** Proceed normally
## Process
### Step 1: Load Context
```
Read(".planning/ACTIVE_WORKFLOW.md")
Read(".planning/PRECIS.md")
Read(".planning/OUTLINE.md")
```
### Step 2: Load Domain Skill
The workflow's write-agents apply the domain style rules per-section (the workflow resolves the domain skill itself). Load it here too so you can judge the `/goal` loop's output and enforce the export template (legal `.docx`). Based on `style` in ACTIVE_WORKFLOW.md, load the domain skill (relative to this skill's base directory):
| Style | Action |
|---|---|
| legal | `Read("${CLAUDE_SKILL_DIR}/../../skills/writing-legal/SKILL.md")` |
| econ | `Read("${CLAUDE_SKILL_DIR}/../../skills/writing-econ/SKILL.md")` |
| general | `Read("${CLAUDE_SKILL_DIR}/../../skills/writing-general/SKILL.md")` |
<EXTREMELY-IMPORTANT>
### Legal Domain: MUST Load Full Skill
When `style: legal` is detected:
1. **MUST Read the full skill file:**
Discover path: `${CLAUDE_SKILL_DIR}/../../skills/writing-legal/SKILL.md`, then `Read()` the output.
2. **MUST use template for .docx export:**
```
${CLAUDE_SKILL_DIR}/../../skills/writing-legal/templates/law_review_template.docx
```
3. **Iron Laws from writing-legal:**
- NO DOCX WITHOUT TEMPLATE - Copy template first, then add content
- NO CLAIM WITHOUT COUNTERARGUMENTS - Confront objections
- NO SECONDARY CITATIONS - Read original sources
**If you create a legal docx without reading the skill and using the template, DELETE IT and START OVER.**
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT>
### Econ Domain: MUST Load Full Skill
When `style: econ` is detected:
1. **MUST Read the full skill file:**
Discover path: `${CLAUDE_SKILL_DIR}/../../skills/writing-econ/SKILL.md`, then `Read()` the output.
2. **Iron Laws from writing-econ:**
- NO BOILERPLATE - Delete "This paper discusses...", roadmap paragraphs
- NO ELEGANT VARIATION - One concept = one word, always
- HOOK WITH FINDING - Start with compelling result, not background
3. **Delete & Restart triggers:**
- "This paper discusses..." → DELETE, start with finding
- Table-of-contents paragraph → DELETE
- "As we shall see..." → DELETE
**If you write boilerplate in an econ paper, DELETE THE SECTION and START OVER with a hook.**
</EXTREMELY-IMPORTANT>
### Step 2b: Load Universal Constraints
```
Skill(skill="workflows:ai-anti-patterns")
```
**You MUST load ai-anti-patterns before drafting.** Domain skills catch domain-specific issues; ai-anti-patterns catches AI writing smell (hedging, filler, false balance, weasel words). Both layers are required — see `constraints/constraint-Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.