AI-native documentation for Next.js, TanStack Start, SvelteKit, Astro, and Nuxt.
Write MDX or Markdown, configure the docs site in TypeScript, and ship a polished documentation experience for humans, IDEs, and agents without maintaining a pile of routing boilerplate.
- Framework adapters for Next.js, TanStack Start, SvelteKit, Astro, and Nuxt
- One
docs.config.tsfile for routing, theme, search, metadata, feedback, and AI surfaces - Built-in themes with shared MDX components such as
Callout,Tabs, andHoverLink - Built-in search with simple, Typesense, Algolia, MCP, and custom provider options
- Generated API reference from framework route handlers or a hosted OpenAPI JSON document
- Next.js changelog pages from dated MDX entries
- Machine-readable docs through
.mdroutes,llms.txt,skill.md, agent discovery, and MCP - Page-level agent compaction with
docs agent compactandagent.compactdefaults - Agent and reader-facing docs scoring with
docs doctor --agentanddocs doctor --site
Run the CLI inside an existing app:
npx @farming-labs/docs initOr start a new project:
npx @farming-labs/docs init --template next --name my-docsThe CLI detects your framework, installs the right packages, creates docs.config.ts, adds the
theme CSS, scaffolds starter pages, and starts the dev server.
All frameworks use defineDocs():
import { defineDocs } from "@farming-labs/docs";
import { fumadocs } from "@farming-labs/theme";
export default defineDocs({
entry: "docs",
theme: fumadocs(),
metadata: {
titleTemplate: "%s - Docs",
description: "My documentation site",
},
});Next.js projects also wrap next.config.ts:
import { withDocs } from "@farming-labs/next/config";
export default withDocs();And import the theme CSS:
@import "tailwindcss";
@import "@farming-labs/theme/default/css";Other framework adapters follow the same shape: configure docs once, add the adapter route/helper, and import the matching theme CSS.
Docs are plain Markdown or MDX files.
app/docs/
page.mdx
installation/
page.mdx
guides/
deployment/
page.mdxPages use frontmatter for metadata:
---
title: "Installation"
description: "Get up and running"
---
# Installation
Your docs content here.The framework exposes machine-readable docs by default in Next.js:
/llms.txt/llms-full.txt/skill.md/.well-known/skill.md/.well-known/agent.json/.well-known/agent/mcp/.well-known/mcp/docs/<slug>.md/docs/<slug>withAccept: text/markdown
The canonical API routes remain available under /api/docs, including /api/docs?format=skill,
/api/docs/mcp, and /api/docs/agent/spec.
For a custom site-specific skill, place skill.md at the project root beside docs.config.ts.
When it is missing, the framework serves a generated fallback based on the docs config.
Use docs agent compact when you want to generate or refresh sibling agent.md files from
resolved docs pages.
pnpm exec docs agent compact installation
pnpm exec docs agent compact --stale
pnpm exec docs agent compact --stale --include-missingOptional defaults live in docs.config.ts:
agent: {
compact: {
apiKeyEnv: "TOKEN_COMPANY_API_KEY",
},
},Per-page token budgets live in frontmatter:
---
title: "Installation"
agent:
tokenBudget: 777
---That page-level agent.tokenBudget override beats global agent.compact.maxOutputTokens defaults
and CLI --max-output-tokens for the same page. If the page already has a sibling agent.md, the
command compacts that file. Otherwise it compacts the generated machine-readable page first and
writes a new sibling agent.md.
Generated files carry hidden provenance metadata so the CLI can detect drift later:
docs agent compact --stalerefreshes only stale generatedagent.mdfilesdocs agent compact --stale --include-missingalso creates missingagent.mdfiles for explicitly requested pages or pages that defineagent.tokenBudget- hand-edited generated
agent.mdfiles are treated as modified and skipped by--stale
The generated agent.md becomes the machine-readable source for .md routes,
GET /api/docs?format=markdown&path=..., and MCP read_page().
Use docs doctor --agent when you want to inspect the machine-facing quality of the docs site.
Use docs doctor --site when you want a reader-facing audit of navigation, descriptions,
structure, trust signals, and feedback.
pnpm exec docs doctor --agent
pnpm exec docs doctor --site
pnpm exec docs doctor --agent --jsonExpected output looks like:
@farming-labs/docs doctor — agent
Score: 87/100 (Agent-ready)
Framework: nextjs • Entry: docs • Content: app/docs
Explicit agent-friendly pages: 10/41 pages (24%)The command checks the agent surface end to end:
- docs config resolution
- docs content discovery
- docs API route wiring
- public agent routes
- agent discovery spec
llms.txtskill.md- MCP
- search
- agent feedback
- page metadata
- explicit agent-friendly pages
- generated
agent.mdfreshness andagent.compactdefaults
It is not required to run the framework, but it is very useful before claiming a docs site is agent-ready or agent-optimized, and it works well as a CI check for the machine-facing docs layer.
docs doctor --site focuses on the reader-facing surface instead:
- docs config resolution
- docs content discovery
- navigation coverage
- page descriptions
- page structure
- search
- trust signals (
github/lastUpdated) - reader feedback
- reading-time cues
Use --json when the result needs to feed another system instead of a person reading the terminal:
pnpm exec docs doctor --agent --json
pnpm exec docs doctor --site --jsonThat JSON form is useful for:
- CI quality gates
- GitHub Actions summaries or PR comments
- dashboards that track docs quality over time
- automation that reruns
docs agent compact --stale - other agents that need structured readiness signals instead of terminal text
The JSON report itself is written to stdout. Separate loader notices, such as config fallback warnings, are outside the JSON payload.
Use the full docs for feature-specific setup:
This repo includes installable Agent Skills for assistants working with @farming-labs/docs.
npx skills add farming-labs/docsSkills live in skills/farming-labs and cover setup, CLI usage,
configuration, themes, Ask AI, and page actions.
pnpm install
pnpm build
pnpm devUseful checks:
pnpm test
pnpm typecheckSee the Contributing guide.
MIT