Quill Skill
This skill works in both Claude Code and Codex. It enforces the compression contract, format awareness, and non-linear writing patterns that make Quill work.
Workflow Routing
In Claude Code, prefer the /quill:* slash commands when the user invokes them. Codex does not expose those commands. When no command was invoked, translate the user's intent directly into the matching workflow from references/workflows.md:
- Start a new project or initialize Quill ->
Init Workflow
- Write a chapter ->
Write Workflow
- Revise a chapter ->
Revise Workflow
- Inspect progress ->
Status Workflow
- Edit or extend the outline ->
Outline Workflow
- Manage threads ->
Threads Workflow
- Manage characters or concepts ->
Character / Concept Workflow
- Switch between LaTeX and Markdown ->
Format Workflow
- Assemble or convert the manuscript ->
Export Workflow
Load only the workflow section needed for the current request. references/workflows.md is the canonical spec on every platform.
Project State: quill.json + Summary Files
Before any action on an existing Quill project, read quill.json. If it does not exist and the user wants to start a new book, use the Init Workflow.
The canonical schema (v2) lives in references/schema.md. Two-part state model:
quill.json — book metadata, outline and chapter status, characters and concepts, open/resolved threads, continuity flags, world rules, revision log, last_chapter_written. Small fields only; never store prose or summaries here.
.quill/summaries/ch-NN.json — one file per written chapter: the chapter summary plus ending_excerpt (final ~150 words, verbatim). These files are the project's memory.
Migration: if quill.json lacks schema_version, the project is v1. Run python3 scripts/quill-validate.py --migrate (or migrate by hand per schema.md) before doing anything else.
Initialization Contract
When starting a new Quill project, always run the six-phase questionnaire from the Init Workflow. Do not infer the output format from context or taste; explicitly ask whether the project should use latex or markdown, then apply the format-specific setup.
Every newly initialized project gets all three bundled helper scripts copied from templates/ into the project's scripts/ directory: quill-sync-outline.py, quill-validate.py, quill-stats.py. Directory layout, book.tex preamble, and project README templates live in references/init-templates.md.
Chapter stubs created by Quill must begin with a format-specific marker so later workflows can treat them as placeholders:
- Markdown:
<!-- quill:chapter-stub -->
- LaTeX:
% quill:chapter-stub
If a chapter file still matches the Quill stub placeholder, the write workflow may replace it without asking for overwrite confirmation.
Format Awareness
Check quill.json.format to determine how to handle files:
|
LaTeX |
Markdown |
| Chapter files |
chapters/ch-NN.tex |
chapters/ch-NN.md |
| Chapter start |
\chapter{Title} |
No heading (added at export) |
| Assembled source output |
book.tex with \input{} |
export/manuscript.md |
| Optional compiled output |
book.pdf via pdflatex if available |
export/manuscript.docx / .html via pandoc if available |
| Character sheets |
characters/name.md |
characters/name.md |
| Concept sheets |
concepts/name.md |
concepts/name.md |
Never mix formats. If the project is LaTeX, all chapter operations use .tex. If Markdown, all use .md.
Toolchain Boundary
Treat format conversion and export as separate operations:
- Format switching (
markdown <-> latex) is an in-repo source conversion. It does not require pandoc, pdflatex, or any other external converter. The per-construct conversion rules live in references/format-conversion.md.
- Export and compilation happen after the sources are in the right format.
- LaTeX projects always maintain
book.tex; PDF compilation is optional and depends on a LaTeX engine being installed.
- Markdown projects always maintain
export/manuscript.md; DOCX/HTML conversion is optional and depends on pandoc.
When external tools are missing, do not frame the format switch as blocked or degraded. Proceed with the deterministic in-repo conversion, handle supported markup explicitly, and call out only the constructs that may need manual cleanup.
Keep generated artifacts separate from source files:
- Source chapters live only in
chapters/ and must all share the active extension from quill.json.format.
- Assembled manuscripts, temporary snapshots, and conversion intermediates belong under
export/, never in chapters/.
- After a successful switch, do not leave both
.md and .tex versions of the same chapter in place.
Compression Contract
This is the core design principle that allows Quill to handle book-length works within context limits.
Rules:
Never load full chapters unnecessarily. Only load a chapter file when actively writing, revising, or when the user explicitly asks to see it.
Briefings under 1500 tokens. When writing a new chapter, build context from quill.json plus per-chapter summary files — never from raw prose of previous chapters.
ending_excerpt is the only raw prose carried forward. Each summary file keeps the final ~150 words of its chapter verbatim. Prose handoff uses the ending_excerpt of the nearest prior written chapter. Everything else comes from compressed summaries.
Summary files are the memory. After writing each chapter, self-summarize into .quill/summaries/ch-NN.json. This is how context is preserved without loading everything.
Active characters/concepts from the 3 nearest prior written chapters only. Don't load all characters into the briefing, and don't pull continuity from later chapters unless the user explicitly asks. Exception: characters or concepts named in the current chapter's outline brief are always included, even if last seen outside that window.
Targeted verification reads are allowed; wholesale rereads are not. If the user flags a specific chapter as a continuity risk, read that chapter, extract the hard facts into the briefing, and discard the prose. Cap: at most 2 full-chapter verification reads per task, and only for individually named chapters — if the user names more than 2, ask which matter most for this chapter. Blanket phrasing ("all previous chapters", "everything so far", "be careful about continuity") names nothing and licenses zero rereads — summaries, threads, and continuity flags are the continuity mechanism. If that feels insufficient, say so and invite the author to name the 1–2 chapters they actually worry about.
Summaries are trusted unless suspect. If there is concrete reason to doubt a chapter summary (e.g., a reported contradiction), verify it against the chapter file and repair the summary before relying on it.
What goes in a briefing:
- Title, genre, POV, style_fingerprint, setting, tone
- Active characters/concepts from the 3 nearest prior written chapters (quill.json entries; read a
characters/ or concepts/ sheet only when that entry is central to this chapter)
- Continuity flags and relevant open threads — if more threads are relevant than the budget allows (e.g., a convergence chapter), include in full only the threads explicitly named in this chapter's outline brief and compress the rest to one line each
- This chapter's outline brief and purpose
ending_excerpt of the nearest prior written chapter (verbatim)
- Target word count
What does NOT go in a briefing:
- Full text of any chapter
- All characters (only recently active ones)
- All threads (only relevant ones)
- Historical revision log entries
- Resolved threads
Non-Linear Work Patterns
Quill supports writing and revising chapters in any order. When working non-linearly:
Pick the right prose handoff — Use the ending_excerpt from the summary file of the nearest prior written chapter. If writing chapter 5 and chapter 4 is unwritten but chapter 3 is written, hand off from chapter 3's ending_excerpt.
Check revision_log — If a chapter was revised, later chapters may have status: "needs-revision". Alert the user to potential continuity issues.
Warn about downstream impact — When revising an earlier chapter, compare old and new summaries. If characters, world facts, threads, or the ending changed, flag which later chapters may be affected.
Update tracking fields correctly — last_chapter_written should reflect the highest chapter number written, not the most recently touched chapter.
Auto-Compaction
Project state grows as chapters are written. To keep it manageable, enforce these compaction rules automatically:
When to compact
Run compaction after every chapter write or revision and whenever quill.json is updated.
Compaction rules
Chapter summaries — what_happened_or_covered must stay under 3 sentences. If a summary is longer after self-summarization, condense it immediately in the summary file.
Resolved threads — Keep only the last 10 resolved threads. When resolved_threads exceeds 10 entries, remove the oldest (lowest resolved_in_chapter). They've served their purpose.
Revision log — Keep only the last 10 entries. Older revision history is not needed for active writing decisions.
Character last_seen — Only store the most recent last_seen value. Don't accumulate history.
ending_excerpt — Hard cap at 150 words per summary file. If longer, trim from the beginning to keep the final 150 words.
World rules — Deduplicate. If two world_rules entries express the same fact, merge them into one.
Open threads — If an open thread was both opened and closed in the same chapter, skip adding it to open_threads entirely — record it only in resolved_threads.
Continuity flags — Cap at 20 entries. Flags are objects with added_in_chapter (see schema.md); always append new flags at the end, and treat legacy string entries as added_in_chapter: 0. When over the cap, auto-remove flags where last_chapter_written - added_in_chapter >= 10 (oldest first) until the count reaches 20, then stop. List the removed flags in your end-of-task report. Only if still over 20 after that, ask the author which to keep.
Compaction is silent
Don't announce compaction to the user and never block on a question for it (the rule-8 fallback is the one exception). Just do it as part of the quill.json update. When compaction dropped data the user might care about (e.g., removed continuity flags), note it briefly in your report after the fact.
Self-Summarization
After every chapter write or revision, the system must:
Write .quill/summaries/ch-NN.json with all required fields (canonical shape in references/schema.md):
chapter
what_happened_or_covered
emotional_beat_or_takeaway
new_characters_or_concepts
new_world_facts
threads_or_questions_opened
threads_or_questions_closed
actual_word_count — via python3 scripts/quill-stats.py when shell execution is available, otherwise estimated
ending_excerpt — the final ~150 words of the chapter, verbatim
Update quill.json with the derived small fields (characters, threads, world rules, outline status, last_chapter_written).
This is not optional. Skipping self-summarization breaks the compression contract and causes context loss for future chapters.
File Conventions
project-root/
├── quill.json ← single source of truth (v2, small fields only)
├── .quill/
│ └── summaries/
│ ├── ch-01.json ← per-chapter summaries + ending excerpts (commit this)
│ └── ...
├── book.tex ← LaTeX wrapper (LaTeX projects only)
├── chapters/
│ ├── ch-01.tex or .md ← chapter files (zero-padded)
│ ├── ch-02.tex or .md
│ └── ...
├── scripts/
│ ├── quill-sync-outline.py
│ ├── quill-validate.py
│ └── quill-stats.py
├── characters/ ← fiction projects
│ ├── character-name.md ← detailed character sheets
│ └── ...
├── concepts/ ← technical/nonfiction projects
│ ├── concept-name.md ← detailed concept sheets
│ └── ...
└── export/
├── manuscript.md ← assembled markdown (Markdown projects)
└── ... ← optional conversion intermediates
- Chapter files are zero-padded:
ch-01, ch-02, ..., ch-10, ch-11
- Character and concept sheet filenames are lowercase with hyphens:
elena-vasquez.md, memory-allocation.md
scripts/quill-sync-outline.py is safe to rerun after outline edits; it updates only stub chapter files
.quill/ must be committed with the book project — it is project memory, not a cache
- The
export/ directory is for assembled output and conversion intermediates — never put source files here
1---2name: quill3description: Activate when a quill.json file is present, when the user mentions Quill, or when the user wants to plan, draft, write, revise, or outline a book, novel, manuscript, or technical book — including managing chapters, threads, characters, or concepts, switching between LaTeX and Markdown, checking progress, or exporting the manuscript.4---56# Quill Skill78This skill works in both Claude Code and Codex. It enforces the compression contract, format awareness, and non-linear writing patterns that make Quill work.910---1112## Workflow Routing1314In Claude Code, prefer the `/quill:*` slash commands when the user invokes them. Codex does not expose those commands. When no command was invoked, translate the user's intent directly into the matching workflow from [`references/workflows.md`](references/workflows.md):1516- Start a new project or initialize Quill -> `Init Workflow`17- Write a chapter -> `Write Workflow`18- Revise a chapter -> `Revise Workflow`19- Inspect progress -> `Status Workflow`20- Edit or extend the outline -> `Outline Workflow`21- Manage threads -> `Threads Workflow`22- Manage characters or concepts -> `Character / Concept Workflow`23- Switch between LaTeX and Markdown -> `Format Workflow`24- Assemble or convert the manuscript -> `Export Workflow`2526Load only the workflow section needed for the current request. `references/workflows.md` is the canonical spec on every platform.2728---2930## Project State: quill.json + Summary Files3132Before any action on an existing Quill project, read `quill.json`. If it does not exist and the user wants to start a new book, use the `Init Workflow`.3334The canonical schema (v2) lives in [`references/schema.md`](references/schema.md). Two-part state model:3536- **`quill.json`** — book metadata, outline and chapter status, characters and concepts, open/resolved threads, continuity flags, world rules, revision log, `last_chapter_written`. Small fields only; never store prose or summaries here.37- **`.quill/summaries/ch-NN.json`** — one file per written chapter: the chapter summary plus `ending_excerpt` (final ~150 words, verbatim). These files are the project's memory.3839**Migration:** if `quill.json` lacks `schema_version`, the project is v1. Run `python3 scripts/quill-validate.py --migrate` (or migrate by hand per `schema.md`) before doing anything else.4041---4243## Initialization Contract4445When starting a new Quill project, always run the six-phase questionnaire from the `Init Workflow`. Do not infer the output format from context or taste; explicitly ask whether the project should use `latex` or `markdown`, then apply the format-specific setup.4647Every newly initialized project gets all three bundled helper scripts copied from [`templates/`](templates/) into the project's `scripts/` directory: `quill-sync-outline.py`, `quill-validate.py`, `quill-stats.py`. Directory layout, `book.tex` preamble, and project README templates live in [`references/init-templates.md`](references/init-templates.md).4849Chapter stubs created by Quill must begin with a format-specific marker so later workflows can treat them as placeholders:50- Markdown: `<!-- quill:chapter-stub -->`51- LaTeX: `% quill:chapter-stub`5253If a chapter file still matches the Quill stub placeholder, the write workflow may replace it without asking for overwrite confirmation.5455---5657## Format Awareness5859Check `quill.json.format` to determine how to handle files:6061| | LaTeX | Markdown |62|---|---|---|63| Chapter files | `chapters/ch-NN.tex` | `chapters/ch-NN.md` |64| Chapter start | `\chapter{Title}` | No heading (added at export) |65| Assembled source output | `book.tex` with `\input{}` | `export/manuscript.md` |66| Optional compiled output | `book.pdf` via `pdflatex` if available | `export/manuscript.docx` / `.html` via `pandoc` if available |67| Character sheets | `characters/name.md` | `characters/name.md` |68| Concept sheets | `concepts/name.md` | `concepts/name.md` |6970Never mix formats. If the project is LaTeX, all chapter operations use `.tex`. If Markdown, all use `.md`.7172## Toolchain Boundary7374Treat format conversion and export as separate operations:75761. **Format switching (`markdown` <-> `latex`) is an in-repo source conversion.** It does not require `pandoc`, `pdflatex`, or any other external converter. The per-construct conversion rules live in [`references/format-conversion.md`](references/format-conversion.md).772. **Export and compilation happen after the sources are in the right format.**78 - LaTeX projects always maintain `book.tex`; PDF compilation is optional and depends on a LaTeX engine being installed.79 - Markdown projects always maintain `export/manuscript.md`; DOCX/HTML conversion is optional and depends on `pandoc`.8081When external tools are missing, do not frame the format switch as blocked or degraded. Proceed with the deterministic in-repo conversion, handle supported markup explicitly, and call out only the constructs that may need manual cleanup.8283Keep generated artifacts separate from source files:8485- Source chapters live only in `chapters/` and must all share the active extension from `quill.json.format`.86- Assembled manuscripts, temporary snapshots, and conversion intermediates belong under `export/`, never in `chapters/`.87- After a successful switch, do not leave both `.md` and `.tex` versions of the same chapter in place.8889---9091## Compression Contract9293This is the core design principle that allows Quill to handle book-length works within context limits.9495### Rules:96971. **Never load full chapters unnecessarily.** Only load a chapter file when actively writing, revising, or when the user explicitly asks to see it.98992. **Briefings under 1500 tokens.** When writing a new chapter, build context from `quill.json` plus per-chapter summary files — never from raw prose of previous chapters.1001013. **`ending_excerpt` is the only raw prose carried forward.** Each summary file keeps the final ~150 words of its chapter verbatim. Prose handoff uses the `ending_excerpt` of the nearest prior *written* chapter. Everything else comes from compressed summaries.1021034. **Summary files are the memory.** After writing each chapter, self-summarize into `.quill/summaries/ch-NN.json`. This is how context is preserved without loading everything.1041055. **Active characters/concepts from the 3 nearest prior written chapters only.** Don't load all characters into the briefing, and don't pull continuity from later chapters unless the user explicitly asks. Exception: characters or concepts named in the current chapter's outline brief are always included, even if last seen outside that window.1061076. **Targeted verification reads are allowed; wholesale rereads are not.** If the user flags a specific chapter as a continuity risk, read that chapter, extract the hard facts into the briefing, and discard the prose. Cap: at most 2 full-chapter verification reads per task, and only for individually named chapters — if the user names more than 2, ask which matter most for this chapter. Blanket phrasing ("all previous chapters", "everything so far", "be careful about continuity") names nothing and licenses zero rereads — summaries, threads, and continuity flags are the continuity mechanism. If that feels insufficient, say so and invite the author to name the 1–2 chapters they actually worry about.1081097. **Summaries are trusted unless suspect.** If there is concrete reason to doubt a chapter summary (e.g., a reported contradiction), verify it against the chapter file and repair the summary before relying on it.110111### What goes in a briefing:112- Title, genre, POV, style_fingerprint, setting, tone113- Active characters/concepts from the 3 nearest prior written chapters (quill.json entries; read a `characters/` or `concepts/` sheet only when that entry is central to this chapter)114- Continuity flags and relevant open threads — if more threads are relevant than the budget allows (e.g., a convergence chapter), include in full only the threads explicitly named in this chapter's outline brief and compress the rest to one line each115- This chapter's outline brief and purpose116- `ending_excerpt` of the nearest prior written chapter (verbatim)117- Target word count118119### What does NOT go in a briefing:120- Full text of any chapter121- All characters (only recently active ones)122- All threads (only relevant ones)123- Historical revision log entries124- Resolved threads125126---127128## Non-Linear Work Patterns129130Quill supports writing and revising chapters in any order. When working non-linearly:1311321. **Pick the right prose handoff** — Use the `ending_excerpt` from the summary file of the nearest prior *written* chapter. If writing chapter 5 and chapter 4 is unwritten but chapter 3 is written, hand off from chapter 3's `ending_excerpt`.1331342. **Check `revision_log`** — If a chapter was revised, later chapters may have `status: "needs-revision"`. Alert the user to potential continuity issues.1351363. **Warn about downstream impact** — When revising an earlier chapter, compare old and new summaries. If characters, world facts, threads, or the ending changed, flag which later chapters may be affected.1371384. **Update tracking fields correctly** — `last_chapter_written` should reflect the highest chapter number written, not the most recently touched chapter.139140---141142## Auto-Compaction143144Project state grows as chapters are written. To keep it manageable, enforce these compaction rules automatically:145146### When to compact147148Run compaction **after every chapter write or revision** and whenever `quill.json` is updated.149150### Compaction rules1511521. **Chapter summaries** — `what_happened_or_covered` must stay under 3 sentences. If a summary is longer after self-summarization, condense it immediately in the summary file.1531542. **Resolved threads** — Keep only the last 10 resolved threads. When `resolved_threads` exceeds 10 entries, remove the oldest (lowest `resolved_in_chapter`). They've served their purpose.1551563. **Revision log** — Keep only the last 10 entries. Older revision history is not needed for active writing decisions.1571584. **Character `last_seen`** — Only store the most recent `last_seen` value. Don't accumulate history.1591605. **`ending_excerpt`** — Hard cap at 150 words per summary file. If longer, trim from the beginning to keep the final 150 words.1611626. **World rules** — Deduplicate. If two `world_rules` entries express the same fact, merge them into one.1631647. **Open threads** — If an open thread was both opened and closed in the same chapter, skip adding it to `open_threads` entirely — record it only in `resolved_threads`.1651668. **Continuity flags** — Cap at 20 entries. Flags are objects with `added_in_chapter` (see `schema.md`); always append new flags at the end, and treat legacy string entries as `added_in_chapter: 0`. When over the cap, auto-remove flags where `last_chapter_written - added_in_chapter >= 10` (oldest first) until the count reaches 20, then stop. List the removed flags in your end-of-task report. Only if still over 20 after that, ask the author which to keep.167168### Compaction is silent169170Don't announce compaction to the user and never block on a question for it (the rule-8 fallback is the one exception). Just do it as part of the quill.json update. When compaction dropped data the user might care about (e.g., removed continuity flags), note it briefly in your report after the fact.171172---173174## Self-Summarization175176After every chapter write or revision, the system must:1771781. Write `.quill/summaries/ch-NN.json` with all required fields (canonical shape in [`references/schema.md`](references/schema.md)):179 - `chapter`180 - `what_happened_or_covered`181 - `emotional_beat_or_takeaway`182 - `new_characters_or_concepts`183 - `new_world_facts`184 - `threads_or_questions_opened`185 - `threads_or_questions_closed`186 - `actual_word_count` — via `python3 scripts/quill-stats.py` when shell execution is available, otherwise estimated187 - `ending_excerpt` — the final ~150 words of the chapter, verbatim1881892. Update `quill.json` with the derived small fields (characters, threads, world rules, outline status, `last_chapter_written`).190191This is not optional. Skipping self-summarization breaks the compression contract and causes context loss for future chapters.192193---194195## File Conventions196197```198project-root/199├── quill.json ← single source of truth (v2, small fields only)200├── .quill/201│ └── summaries/202│ ├── ch-01.json ← per-chapter summaries + ending excerpts (commit this)203│ └── ...204├── book.tex ← LaTeX wrapper (LaTeX projects only)205├── chapters/206│ ├── ch-01.tex or .md ← chapter files (zero-padded)207│ ├── ch-02.tex or .md208│ └── ...209├── scripts/210│ ├── quill-sync-outline.py211│ ├── quill-validate.py212│ └── quill-stats.py213├── characters/ ← fiction projects214│ ├── character-name.md ← detailed character sheets215│ └── ...216├── concepts/ ← technical/nonfiction projects217│ ├── concept-name.md ← detailed concept sheets218│ └── ...219└── export/220 ├── manuscript.md ← assembled markdown (Markdown projects)221 └── ... ← optional conversion intermediates222```223224- Chapter files are zero-padded: `ch-01`, `ch-02`, ..., `ch-10`, `ch-11`225- Character and concept sheet filenames are lowercase with hyphens: `elena-vasquez.md`, `memory-allocation.md`226- `scripts/quill-sync-outline.py` is safe to rerun after outline edits; it updates only stub chapter files227- `.quill/` must be committed with the book project — it is project memory, not a cache228- The `export/` directory is for assembled output and conversion intermediates — never put source files here