Skip to content

Commit b6806c8

Browse files
ankur-archclaude
andauthored
Make prisma.io docs agent-ready: llms.txt split, agent directives, skill.md, MCP discovery (#8087)
* docs/site: make prisma.io agent-ready (llms.txt split, skill.md, MCP discovery) Fixes failing checks from the Mintlify agent-score audit of www.prisma.io/docs: - Split the 116k-char llms.txt into a small root index plus per-area section indexes (each under 50k chars), with a coverage guarantee for unmatched pages - Add llms.txt directives to both HTML (visually-hidden element) and markdown (blockquote) versions of every docs page - Improve markdown/HTML parity: include page descriptions in markdown, mark HTML-only page chrome with data-markdown-ignore - Slim llms-full.txt from ~7 MB to ~4.5 MB by excluding legacy /orm/v6 and deprecated product pages; absolutize in-body links so they resolve - Serve an agentskills.io-format skill at /skill.md, /docs/skill.md and /.well-known/agent-skills/* - Serve MCP discovery documents at /.well-known/mcp, /.well-known/mcp.json and server cards, pointing at the existing https://mcp.prisma.io/mcp Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: add agent-readiness guard, shared llms builders, and docs-agent-ready skill Make the agent-score setup self-maintaining: - Extract llms.txt / section-index generation into pure builders in lib/llms.ts (byte-identical output) so routes and checks share one source of truth; llms-full page filtering exported as getLLMsFullPages - Add scripts/lint-agent-ready.ts (pnpm --filter docs lint:agent-ready), wired into turbo and the Links CI workflow: enforces size budgets, full page coverage, catch-all creep, markdown directives, common-query link resolution, llms-full exclusions, and skill/MCP content sanity - Add .claude/skills/docs-agent-ready with invariants, endpoint file map, and playbooks for adding new docs areas Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs/site: address CodeRabbit review on agent-readiness PR - Protect inline code spans (not just fenced blocks) when absolutizing in-body markdown links - Pin the guard's byte-budget measurements to the production base URL - Guard now asserts the directive blockquote positionally on all 621 pages, checks descriptions across all pages, and adds a source-level guard for the hidden HTML directive - Field-level MCP discovery validation for both the docs and site payloads - Skill workflows now mirror the quickstart's ESM/TypeScript setup steps verbatim, and require explicit user approval before provisioning a hosted database with npx create-db Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: dedicated llms.txt sections for Prisma Next and Prisma Compute Prisma Next content (/next, /orm/next, /guides/next, /cli/next — 68 pages) was split across the orm/guides/cli indexes and the root catch-all; Compute was folded into the platform section. Both now get their own section index (llms/next.txt, llms/compute.txt) with excludePrefixes keeping the sibling sections version-clean, plus a Prisma Next common-query entry. Root catch-all drops from 12 to 3 pages; all sections remain under the 50k budget. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: collision-safe placeholder restoration in markdown protectors Sequential per-token replace could corrupt output when protected code literally contained sentinel-looking text. Both protectors now use PUA-character delimiters lengthened deterministically until absent from the input, with a single-pass regex restore, and the guard gains a protector round-trip check with adversarial inputs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent fef4821 commit b6806c8

26 files changed

Lines changed: 1483 additions & 90 deletions

File tree

.claude/skills/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ A skill is a folder with a `SKILL.md` (the instructions) and sometimes `referenc
1616
| [`content-write-blog`](content-write-blog/SKILL.md) | Scaffold a new Prisma blog post (frontmatter + section stubs) | "Draft a blog post about connection pooling" |
1717
| [`content-create-hero-image`](content-create-hero-image/SKILL.md) | Generate a post's hero (SVG) and social/OG image (PNG) in the Eclipse house style | "Create a cover image for my Compute post" |
1818
| [`docs-writer`](docs-writer/README.md) | Write or rewrite developer docs (how-to, concept, reference) | "Write a how-to for deploying to Prisma Compute" |
19+
| [`docs-agent-ready`](docs-agent-ready/SKILL.md) | Hold the docs' agent-readiness invariants (llms.txt budgets, coverage, skill/MCP endpoints) when editing them | "Add a new docs section to llms.txt" |
1920

2021
---
2122

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: docs-agent-ready
3+
description: Use when adding a new docs section or product area, editing llms.ts / the llms.txt or llms/[...slug] / llms-full.txt routes / get-llm-text / skill.md / .well-known endpoints, or working on the "agent score", "llms.txt", or anything "agent-ready" in the docs and site apps. Explains the invariants the Mintlify agent-readiness audit measures and how to hold them.
4+
metadata:
5+
author: Prisma
6+
version: "2026.7.21"
7+
---
8+
9+
# Docs agent-readiness
10+
11+
Keep Prisma's docs machine-readable so the Mintlify **agent-score** audit does not silently regress as content is added. The score measures whether AI agents can discover and fetch the docs: a working `llms.txt` index, per-page Markdown, a discoverable skill, and MCP discovery. The guard `apps/docs/scripts/lint-agent-ready.ts` (run `pnpm --filter docs lint:agent-ready`) enforces the invariants below on every PR via `.github/workflows/links.yml`.
12+
13+
## Invariants
14+
15+
- **Root `llms.txt` < 50k bytes** (warn at 35k). It links to per-area section indexes, not every page.
16+
- **Each section index < 50k bytes** (warn at 40k). Over budget means split the section.
17+
- **Every page is reachable** — each `filterPagesForLLMsIndex` page appears in a section file or the root "Other pages" list. The guard asserts against the generated content, not just membership.
18+
- **Directives in HTML + Markdown** — every page's Markdown (`getLLMText`) starts with the hidden `llms.txt` directive blockquote; the HTML page keeps a hidden directive as its first child.
19+
- **HTML/Markdown parity** via `data-markdown-ignore` on human-only chrome so the Markdown mirrors the page.
20+
- **`llms-full.txt` excludes** legacy `/orm/v6` and the Accelerate/Optimize products (`getLLMsFullPages`).
21+
- **Skill + MCP endpoints live at BOTH roots**: `www.prisma.io` (apps/site) and `/docs` (apps/docs).
22+
23+
## File map
24+
25+
| Endpoint | Generated by |
26+
|---|---|
27+
| `/docs/llms.txt` | `apps/docs/src/app/llms.txt/route.ts``buildLLMsIndexContent` (llms.ts) |
28+
| `/docs/llms/<slug>.txt` | `apps/docs/src/app/llms/[...slug]/route.ts``buildLLMsSectionContent` (llms.ts) |
29+
| `/docs/llms-full.txt` | `apps/docs/src/app/llms-full.txt/route.ts``getLLMsFullPages` (llms.ts) + `getLLMText` |
30+
| `/docs/<page>.md` | `apps/docs/src/lib/get-llm-text.ts` (`getLLMText`) |
31+
| `/docs/skill.md` | `apps/docs/src/app/skill.md/route.ts``apps/docs/src/lib/agent-skill.ts` |
32+
| `/docs/.well-known/mcp[.json]` | `apps/docs/src/lib/mcp-discovery.ts` |
33+
| `/skill.md`, `/.well-known/agent-skills/*` | `apps/site/src/lib/agent-skills.ts` (`buildSkillMarkdown`) |
34+
| `/.well-known/mcp*` (site) | `apps/site/src/lib/agent-skills.ts` (`buildMcpDiscovery`, server cards) |
35+
36+
The route handlers are thin wrappers: shared builders in `llms.ts` are the single source of truth, so the guard measures exactly what the routes serve.
37+
38+
## Playbooks
39+
40+
**(a) Adding a new docs area.** Add an entry to `llmsSections` in `apps/docs/src/lib/llms.ts` with `prefixes` (and `excludePrefixes` if a sub-tree belongs elsewhere). Run `pnpm --filter docs lint:agent-ready`. A **"Catch-all creep"** warning (> 25 pages in root "Other pages") means a new docs area needs its own section here.
41+
42+
**(b) Section over budget.** When a section fails/warns on size, split it into two sections in `llmsSections` (narrower `prefixes`, or carve a sub-tree out with a new slug). Re-run the guard.
43+
44+
**(c) Changing page chrome** in `apps/docs/src/app/(docs)/(default)/[[...slug]]/page.tsx`: keep the hidden `llms.txt` directive as the first child, and put `data-markdown-ignore` on any human-only chrome (banners, nav, badges) so it stays out of the Markdown.
45+
46+
**(d) Changing the CLI workflow or MCP tools** in docs content: update the skill copy in `apps/site/src/lib/agent-skills.ts` AND `apps/docs/src/lib/agent-skill.ts` — they quote real commands and tool names. Keep them in sync with the Prisma Postgres quickstart and `content/docs/ai/tools/mcp-server.mdx`. The `commonQueries` links in `llms.ts` must point to existing pages (the guard fails on stale links).
47+
48+
**(e) Verification.**
49+
50+
```bash
51+
pnpm --filter docs lint:agent-ready # all invariants + size table
52+
pnpm --filter docs types:check # types
53+
curl -s https://www.prisma.io/docs/llms.txt | head
54+
curl -s https://www.prisma.io/docs/skill.md | head
55+
curl -s https://www.prisma.io/.well-known/mcp
56+
```
57+
58+
The guard prints a size table with per-file headroom so reviewers see how close each file is to its budget.

.github/workflows/links.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ jobs:
2929

3030
- name: Validate documentation links
3131
run: pnpm run lint:links
32+
33+
- name: Validate agent-readiness
34+
run: pnpm --filter docs lint:agent-ready

apps/docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"types:check": "fumadocs-mdx && next typegen && tsc --noEmit",
1515
"postinstall": "fumadocs-mdx",
1616
"lint:links": "tsx ./scripts/lint-links.ts",
17+
"lint:agent-ready": "tsx ./scripts/lint-agent-ready.ts",
1718
"lint:external-links": "tsx ./scripts/lint-external-links.ts",
1819
"lint:images": "tsx ./scripts/lint-images.ts",
1920
"lint:code": "tsx ./scripts/lint-code-blocks.ts",

0 commit comments

Comments
 (0)