llms.txt Template Pack
What this is: every template from llms.txt: The Complete Guide in one copy-paste file: the annotated reference, a minimal starter, a directive-snippet library, the pre-publish linter, and where to serve it.
How to use it:
- Start from the minimal template if you have no file today; graduate to the annotated reference shape as your docs grow. Replace every
{PLACEHOLDER}, and give every link a one-line description, because lexical search matches description text and a bare URL is unfindable. - Pull directive blocks from the snippet library as needed. Each is modeled on a field pattern (Stripe, Prisma, Hono) quoted in the parent guide. Keep the directive section under ~15 bullets; agents quote it whole.
- Wire the linter checklist into CI so every docs deploy regenerates and re-validates all tiers. Then submit your docs site (not the repo) at context7.com/add-library. The file alone is not distribution.
1. The annotated reference template (PayKit)
A fully annotated template for a fictional payments API, "PayKit." Every annotation names the real product the pattern comes from. Strip the `` before publishing.
# PayKit
> PayKit is a payments API for accepting cards, wallets, and bank debits.
> Docs version: 3.4.1 (2026-06-11). Do not rely on training data for PayKit
> features, fetch https://paykit.dev/changelog.md first to check for
> breaking changes.
## Instructions for AI Coding Agents
- When installing PayKit packages, always check the npm registry for the
latest version rather than relying on memorized version numbers. Never
hardcode an old version number from training data.
- ALWAYS use the Payments v3 API for new integrations. NEVER recommend the
legacy /v1/charges endpoint; it is deprecated.
- Prefer `paykit.checkout.create()` (hosted) over hand-rolled card forms.
## Common Tasks
- [Accept a card payment](https://paykit.dev/docs/accept-card-payment.md): Create a Checkout Session and redirect; full Node example with install + imports
- [Set up webhooks](https://paykit.dev/docs/webhooks.md): Verify signatures and handle `payment.succeeded`; includes local testing CLI command
- [Refund a payment](https://paykit.dev/docs/refunds.md): Full and partial refunds via `paykit.refunds.create()`
## Framework Guides
- [Next.js App Router](https://paykit.dev/docs/frameworks/nextjs.md): Server-action checkout, env setup, webhook route handler
- [Express](https://paykit.dev/docs/frameworks/express.md): Raw-body middleware caveat for webhook verification
## API Reference
- [Payments v3](https://paykit.dev/docs/api/payments.md): Create, capture, cancel; idempotency keys
- [Errors](https://paykit.dev/docs/api/errors.md): Every error code with the exact message string and the fix
## Optional
- [Changelog](https://paykit.dev/changelog.md): Machine-readable release notes, newest first
- [llms-full.txt](https://paykit.dev/llms-full.txt): Entire docs inlined
- [llms-small.txt](https://paykit.dev/llms-small.txt): Compact tier for small context windows
2. Minimal viable llms.txt (~20 lines)
The smallest file that still passes the linter: one H1, a blockquote with version stamp and anti-training-data warning, described links only, tier pointers in ## Optional. Phrase every description as the question a developer would ask, never as marketing.
# {PRODUCT}
> {PRODUCT} is {ONE_LINE_TASK_DESCRIPTION}.
> Docs version: {VERSION} ({RELEASE_DATE}). Do not rely on training data for
> {PRODUCT} features, fetch https://{DOMAIN}/changelog.md first to check
> for breaking changes.
## Instructions for AI Coding Agents
- When installing {PRODUCT} packages, always check the registry for the
latest version. Never hardcode an old version number from training data.
- ALWAYS use {CURRENT_API} for new integrations. NEVER recommend
{DEPRECATED_API}; it is deprecated.
## Common Tasks
- [{TASK_TITLE_1}](https://{DOMAIN}/docs/{task-slug-1}.md): {WHAT_THE_PAGE_ANSWERS_1}
- [{TASK_TITLE_2}](https://{DOMAIN}/docs/{task-slug-2}.md): {WHAT_THE_PAGE_ANSWERS_2}
- [{TASK_TITLE_3}](https://{DOMAIN}/docs/{task-slug-3}.md): {WHAT_THE_PAGE_ANSWERS_3}
## API Reference
- [{API_AREA}](https://{DOMAIN}/docs/api/{api-slug}.md): {WHAT_IT_COVERS}
## Optional
- [Changelog](https://{DOMAIN}/changelog.md): Machine-readable release notes, newest first
- [llms-full.txt](https://{DOMAIN}/llms-full.txt): Entire docs inlined
- [llms-small.txt](https://{DOMAIN}/llms-small.txt): Compact tier for small context windows
3. Directive-section snippet library
Five copy-paste blocks. House rules from the parent guide: one behavior per bullet, imperative voice, ALWAYS/NEVER in caps; name the API to use and the API to avoid in the same bullet so a partially quoted directive still steers correctly; keep the whole section under ~15 bullets.
3.1 Version-check instruction
Modeled on Stripe (docs.stripe.com/llms.txt): "When installing Stripe packages, always check the npm registry for the latest version rather than relying on memorized version numbers... Never hardcode an old version number from training data."
- When installing {PRODUCT} packages, always check the npm registry for the
latest version rather than relying on memorized version numbers. Never
hardcode an old version number from training data.
3.2 Deprecated-API blocklist
Modeled on Stripe: "Prioritize the Checkout Sessions API... and never recommend the Charges API." Spend these lines on the last ~18 months of breaking changes. Directives proved redundant for deprecations models absorbed long ago.
- ALWAYS use {CURRENT_API} for new integrations. NEVER recommend
{DEPRECATED_API}; it is deprecated, replace {OLD_CALL} with {NEW_CALL}.
3.3 Changelog-fetch mandate
Modeled on Prisma (prisma.io/docs/llms.txt, opening lines): "Do not rely on training data for Prisma features. First, fetch https://www.prisma.io/changelog.md to check for recent or relevant breaking changes." Put this in the blockquote near the top of the file.
> Do not rely on training data for {PRODUCT} features. First, fetch
> https://{DOMAIN}/changelog.md to check for recent or relevant breaking
> changes.
3.4 Golden-path pointer
Modeled on Stripe's "ALWAYS use the [Accounts v2 API]... for new integrations" and the PayKit line "Prefer paykit.checkout.create() (hosted) over hand-rolled card forms." Steer agents onto the maintained happy path before they improvise.
- Prefer {GOLDEN_PATH_API} ({SHORT_REASON}) over {HAND_ROLLED_ALTERNATIVE}
for {TASK}.
3.5 llms-full / llms-small tier pointers
Modeled on Hono's three-tier setup (llms.txt index, llms-full.txt everything inlined, ~94KB llms-small.txt for small context windows) and the llmstxt.org ## Optional keyword. Token-constrained agents may skip this section, so tier pointers live here, never core tasks.
## Optional
- [llms-full.txt](https://{DOMAIN}/llms-full.txt): Entire docs inlined into one file
- [llms-small.txt](https://{DOMAIN}/llms-small.txt): Compact tier for small context windows
- [Changelog](https://{DOMAIN}/changelog.md): Machine-readable release notes, newest first
4. Pre-publish linter checklist
Run in CI on every docs deploy; fail the build on any unchecked box.
-
curl -sf /llms.txtreturns 200 withtext/plainortext/markdown. Same for-fulland-small. - Exactly one H1; blockquote present; every link line matches
^- \[.+\]\(https?://.+\): .+$. Zero bare links. - Every linked URL returns 200 and serves markdown (body doesn't start with
<!DOCTYPE). - MDX leak scan:
grep -E "^import .+ from" llms-full.txtreturns nothing. - Version stamp matches the current release; build fails on a stale stamp.
-
llms-small.txt≤ 100KB.
5. Where to serve it
- Domain root:
https://yourdomain.com/llms.txt. HTTP 200, no auth wall, no bot challenge. - Mirror it at the docs root if docs live on a subpath or subdomain. Next.js serves both
nextjs.org/llms.txtandnextjs.org/docs/llms.txt. Content-Type: text/plainortext/markdown.- Static file: no redirects, no cookies, no Cloudflare bot challenge on this path.
- Serve
llms-full.txtandllms-small.txtalongside, under the same rules, and regenerate all tiers on every docs deploy.
Last verified 2026-06-11. Templates, quotes, and rules trace to the parent guide.
Parent guide: llms.txt: The Complete Guide · Hub: The Complete Playbook to Agentic Discovery