A docs pipeline. Write MDX once. Get a website for humans, an llms.txt for HTTP agents, an AGENTS.md-fronted bundle for offline coding agents, and a static search index — all from a single source.
flowchart LR
src["docs/*.mdx"]
site_run["leadtype generate"]
bundle_run["leadtype generate --bundle"]
site_out["public/<br/>llms.txt · llms-full.txt<br/>docs/*.md · search-index.json"]
bundle_out["packages/<name>/<br/>AGENTS.md · docs/*.md"]
humans["humans (browser)"]
http_agents["HTTP agents<br/>(/llms.txt or<br/>Accept: text/markdown)"]
search["search UI · AI answers"]
offline_agents["coding agents<br/>(Claude Code, Codex, Cursor,<br/>Copilot…) read<br/>node_modules/<pkg>/AGENTS.md"]
src --> site_run
src --> bundle_run
site_run --> site_out
bundle_run --> bundle_out
site_out --> humans
site_out --> http_agents
site_out --> search
bundle_out --> offline_agents
leadtype is not a docs website framework. Bring your own UI — Next.js, TanStack Start, Astro, Nuxt, SvelteKit, Vue, Svelte, anything — and let leadtype handle conversion, validation, search, and the agent-facing outputs it specializes in. It's designed to layer behind a framework like Fumadocs or Starlight, not replace it.
- Build a docs site — wire leadtype into your build to convert MDX, index search, and serve markdown to agents.
- Bundle docs into your package — ship
AGENTS.mdplus topic markdown inside the npm tarball so consumers can point agents at version-matched docs innode_modules/<your-package>/. Agents that install your package then spend 32–54% fewer tokens and stop confidently guessing wrong about your API — the win is biggest for the small, cheap models most agents run, with a smaller accuracy bump for frontier models (evals).
# npm
npm install leadtype
# pnpm
pnpm add leadtype
# bun
bun add leadtypeThe fastest start in an existing app — scaffolds the docs source, route, config, and a first artifact set. The framework is auto-detected from package.json; pass --framework to be explicit:
npx leadtype init # auto-detect, or:
npx leadtype init --framework next # next · astro · nuxt · sveltekitOr wire the pipeline by hand. For a hosted docs site:
npx leadtype generate --src . --out public --base-url https://leadtype.devFor an npm-bundled doc set:
npx leadtype generate --bundle --src . --out packages/acmeThe first produces public/llms.txt, public/llms-full.txt, public/docs/search-index.json, and public/docs/*.md. The second produces packages/acme/AGENTS.md and packages/acme/docs/*.md with relative links that still work after npm install.
Bundling is two steps, and the second is the one that matters. Shipping AGENTS.md only pays off if consuming projects point their agent at it — left to discover it on their own, agents read the bundle only ~29% of the time; with a root-AGENTS.md pointer it's ~90–100% (evals). So tell consumers to add this to their own root AGENTS.md:
When working with the `acme` library, read the bundled docs in
`node_modules/acme/AGENTS.md` first — they're version-matched to the
installed package and stay accurate as it updates.leadtype generate --bundle prints this snippet, filled in with your package name, on success.
Full docs at leadtype.dev:
- Quickstart
- How it works
- Build a docs site
- Bundle docs into your package
- Add search
- Frontmatter
- CLI reference
- Architecture — core package boundary and framework adapter rules
- Methodology — how leadtype differs from Fumadocs, Starlight, and Mintlify
packages/leadtype/— the npm package (CLI + library entry points).apps/example/— production docs site and reference template, on TanStack Start.docs/— the source MDX rendered by both this site and the package's bundled docs.
bun install
bun run dev # build the package, run the pipeline, start the example appPipeline checks:
bun run --filter example pipeline:build
bun run --filter example pipeline:test
bun run --filter example test:e2eMIT.