A Template is a reusable structure (title, description, and body) that shapes how Dosu generates Documents inside a Library. This page explains what Templates are, why teams use them, how Dosu matches one while it writes, and how to create and publish them.
What it is#
A Template captures the shape of a kind of Document you want to produce more than once. It has three parts:
- A title that names the structure (for example, API Reference or Runbook).
- A description of what this kind of Document covers and when it applies.
- A body that lays out the sections and guidance a Document should follow, in the order you want them.
Templates live inside a Library alongside its Sources, Documents, Topics, and settings. Create a Template once, and Dosu reuses its shape whenever it writes a similar page, so Documents of the same type are generated consistently.
If a Template body begins with a YAML frontmatter block (keys between --- lines), those keys become required fields for any Document generated from it. This is a way to enforce structured metadata by example. Keep frontmatter minimal unless you need those fields, since required keys make it harder to satisfy generation requirements.
Why it matters#
As an engineering organization grows, documentation drifts. Different people write runbooks differently, API pages land in different shapes, and onboarding docs follow whatever structure the last author used. That inconsistency makes knowledge harder to find and harder to trust, for people and for the coding agents reading it.
Templates give your team a shared standard:
- Runbooks, API references, and guides follow the same structure across all repos and teams in the Library.
- New documentation is faster to produce because Dosu starts with a proven shape rather than a blank page.
- Projects with specific documentation standards can encode those standards once and apply them everywhere.
How it works#
Templates take effect during document generation. Dosu researches your Sources first, then considers your Templates:
- Dosu gathers context from the Sources you selected (code, issues, pull requests, conversations).
- It builds a content-rich description of what the new Document will cover, based on that research.
- It reviews the published Templates in the Library and looks for one whose structure fits.
- If a Template clearly fits, Dosu uses its body as the page's structure and may conduct additional research to fill the Template's expected sections.
- If no Template clearly fits, Dosu abstains and writes a free-form Document instead.
Matching is based on the Template's section structure, meaning the headings in its body, not on the description alone. A Template that merely sounds related is not enough on its own. Abstaining is the default because following a Template that does not fit would hurt the result more than using none, and a vague or unrelated request should not be forced into the wrong shape. If a structured Template is not being picked up, make its body headings clearly reflect the kind of Document it is.
Dosu records which Template produced each Document. That lets you find pages by Template later and regenerate a Document with the same structure when the underlying Sources change. Every generated Document is a draft you can edit before it publishes, so your team stays in control of the result.
Creating and publishing a Template#
You manage Templates in the Templates view under Documents.
- Open Documents and go to the Templates view.
- Create a new Template. You can start from a blank structure or a starter Template, and you can bulk-import a set of starter Templates to begin with.
- Give it a clear title and description, then lay out the body sections you want Documents to follow.
- Publish it. Dosu only matches Templates that are published in the Library, so an unpublished or archived Template is not used during generation.
If you already have a Document whose structure you like, the fastest way to capture it is the Convert to template action. You can also convert a Template back into a Document, and archive or restore a Template.
When to use Templates#
Reach for a Template when:
- You produce the same kind of Document repeatedly (API references, runbooks, onboarding guides, architecture overviews).
- You want a consistent shape across many repos, teams, or Libraries.
- A generated Document needs specific metadata fields filled every time (use frontmatter for this).
Skip Templates for one-off pages. A free-form Document is the better fit when the content does not follow a repeatable structure, and Dosu produces one automatically when no Template matches.