$npx -y skills add WILLOSCAR/research-units-pipeline-skills --skill front-matter-writerWrite the survey's front matter files (Abstract, Introduction, Related Work, Discussion, Conclusion) in paper voice, with high citation density and a single evidence-policy paragraph. Trigger: front matter writer, introduction writer, related work writer, abstract writer, dis
| 1 | # Front Matter Writer (compatibility router) |
| 2 | |
| 3 | Purpose: produce the paper-level shell while preserving the current output contract and approval gate. |
| 4 | |
| 5 | ## Load Order |
| 6 | |
| 7 | Always read: |
| 8 | - `references/overview.md` |
| 9 | |
| 10 | Read by task: |
| 11 | - `references/abstract_archetypes.md` for `sections/abstract.md` |
| 12 | - `references/context_projection.md` when adjusting how chapter briefs are projected into Introduction / Related Work context |
| 13 | - `references/introduction_jobs.md` for Introduction body files |
| 14 | - `references/related_work_positioning.md` for Related Work body files |
| 15 | - `references/discussion_conclusion_patterns.md` for `sections/discussion.md` and `sections/conclusion.md` |
| 16 | - `references/forbidden_stems.md` before revising any reader-facing prose |
| 17 | - `references/examples_good.md` and `references/examples_bad.md` for calibration only |
| 18 | |
| 19 | Machine-readable assets: |
| 20 | - `assets/front_matter_context.schema.json` |
| 21 | - `assets/front_matter_context_schema.json` (compatibility alias for checklist-aligned naming) |
| 22 | - `assets/front_matter_contract.json` |
| 23 | - `assets/front_matter_templates.json` |
| 24 | - `assets/front_matter_context_projection.json` |
| 25 | |
| 26 | ## Inputs |
| 27 | |
| 28 | Required: |
| 29 | - `DECISIONS.md` with `Approve C2` |
| 30 | - `outline/outline.yml` |
| 31 | - `outline/mapping.tsv` |
| 32 | - `citations/ref.bib` |
| 33 | |
| 34 | Optional but useful: |
| 35 | - `GOAL.md` |
| 36 | - `queries.md` |
| 37 | - `papers/retrieval_report.md` |
| 38 | - `papers/core_set.csv` |
| 39 | - `outline/coverage_report.md` |
| 40 | - `outline/writer_context_packs.jsonl` |
| 41 | |
| 42 | ## Outputs |
| 43 | |
| 44 | Keep the current output contract: |
| 45 | - `sections/abstract.md` |
| 46 | - `sections/S<sec_id>.md` for front-matter H2 bodies |
| 47 | - `sections/discussion.md` |
| 48 | - `sections/conclusion.md` |
| 49 | - `output/FRONT_MATTER_REPORT.md` |
| 50 | - `output/FRONT_MATTER_CONTEXT.json` |
| 51 | |
| 52 | ## Compatibility mode |
| 53 | |
| 54 | Current mode is reference-first with script compatibility: |
| 55 | - writing guidance lives in `references/` |
| 56 | - the structured job contract lives in `assets/front_matter_contract.json` |
| 57 | - the hook bank used by the script lives in `assets/front_matter_templates.json` |
| 58 | - `scripts/run.py` still owns approval checks, metadata parsing, deterministic hook selection, file emission, and context-sidecar writing |
| 59 | |
| 60 | That means: |
| 61 | - preserve current file shapes and approval behavior |
| 62 | - treat the assets as the active semantic source for section jobs, hook banks, and render guardrails |
| 63 | - avoid moving prose policy back into `SKILL.md` |
| 64 | |
| 65 | ## Script boundary |
| 66 | |
| 67 | Use `scripts/run.py` as a deterministic helper for: |
| 68 | - approval gate enforcement |
| 69 | - front-matter file discovery / path selection |
| 70 | - metadata extraction |
| 71 | - rendering from `assets/front_matter_contract.json` + `assets/front_matter_templates.json` |
| 72 | - writing the report and context sidecar |
| 73 | |
| 74 | Do not treat the script as the main place for long-form writing guidance. |
| 75 | |
| 76 | ## Output shape rules |
| 77 | |
| 78 | Keep these stable: |
| 79 | - `sections/abstract.md` starts with `## Abstract` or `## 摘要` |
| 80 | - Introduction / Related Work `sections/S<sec_id>.md` files are body-only |
| 81 | - `sections/discussion.md` includes `## Discussion` |
| 82 | - `sections/conclusion.md` includes `## Conclusion` |
| 83 | - methodology note appears once in normal prose, not as pipeline/process narration |
| 84 | |
| 85 | ## Quick Start |
| 86 | |
| 87 | - `uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>` |
| 88 | |
| 89 | ## Troubleshooting |
| 90 | |
| 91 | - If the front matter sounds narrated, reload `references/forbidden_stems.md` and `references/examples_bad.md`. |
| 92 | - If Related Work turns into a survey list, reload `references/related_work_positioning.md`. |
| 93 | - If the asset and the references drift, fix the asset/routing inside this skill package rather than expanding `SKILL.md` again. |
| 94 | |
| 95 | |
| 96 | ## Execution notes |
| 97 | |
| 98 | When running this skill in compatibility mode, `scripts/run.py` currently reads these inputs directly: |
| 99 | - `DECISIONS.md` for `Approve C2` |
| 100 | - `outline/outline.yml` to resolve Introduction / Related Work section ids |
| 101 | - `outline/mapping.tsv` for front-matter citation placement context |
| 102 | - `citations/ref.bib` for citation-key scope |
| 103 | - `GOAL.md`, `queries.md`, `papers/retrieval_report.md`, `papers/core_set.csv`, `outline/coverage_report.md`, and `outline/writer_context_packs.jsonl` as optional context sources |
| 104 | |
| 105 | ## Script |
| 106 | |
| 107 | ### Quick Start |
| 108 | |
| 109 | - `uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>` |
| 110 | |
| 111 | ### All Options |
| 112 | |
| 113 | - `--workspace <dir>` |
| 114 | - `--unit-id <id>` |
| 115 | - `--inputs <path1;path2>` |
| 116 | - `--outputs <path1;path2>` |
| 117 | - `--checkpoint <C*>` |
| 118 | |
| 119 | ### Examples |
| 120 | |
| 121 | - `uv run python .codex/skills/front-matter-writer/scripts/run.py --workspace <workspace>` |
| 122 | |
| 123 | ## Troubleshooting |
| 124 | |
| 125 | - If `DECISIONS.md` lacks `Approve C2`, the script will write a checkpoint block and exit. |
| 126 | - If `citations/ref.bib` or `outline/outline.yml` is missing, restore those inputs before rerunning. |
| 127 | - If the fro |