You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes the three regressing checks in the Mintlify/afdocs agent-readiness
audit and adds guards so they stay fixed:
Content Discoverability (directive buried past 50% of the HTML):
- Move the hidden llms.txt directive to the first child of <body> in the
docs root layout; the sidebar markup previously pushed it to 30-88% of
the body. Now sits at 0-1% on every page.
Markdown Content Parity (pages failing at 52-90% missing):
- Restore heading markers in getLLMText output from the page toc —
fumadocs' processed markdown emits headings as bare "Text [#anchor]"
lines, so "## 1. Set up your project" degraded to a stripped list item
on the markdown side.
- Convert <details>/<summary> to a bold summary + dedented body; the
serialized 2-space indent broke the code fences inside.
- Wrap the OpenAPI explorer (APIPage) in data-markdown-ignore; the
interactive reference has no markdown equivalent and the .md already
carries the generated API summary.
- Unescape remark escapes (\_, \{, \}) outside code so prose like
snake_case matches the rendered HTML.
MCP Server Discoverable (no server at expected endpoints):
- New /docs/mcp route proxies MCP protocol traffic to mcp.prisma.io/mcp
(browser GETs redirect to the /mcp marketing page).
- Header-matched beforeFiles rewrites on the site route MCP traffic on
www.prisma.io/mcp to the real server; browsers still get the page.
Guards: lint-agent-ready now checks directive-first-in-body, heading
markers across all pages, <details> leakage, the APIPage parity wrapper,
and both MCP endpoints. Skill docs updated with the new invariants and
an afdocs reproduction playbook.
Verified with the afdocs CLI against a local production build: directive
+ parity + markdown-url + content-negotiation all pass on the 20 pages
that previously failed or warned (avg 1% missing, was avg 8%).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/skills/docs-agent-ready/SKILL.md
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ name: docs-agent-ready
3
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
4
metadata:
5
5
author: Prisma
6
-
version: "2026.7.21"
6
+
version: "2026.7.24"
7
7
---
8
8
9
9
# Docs agent-readiness
@@ -15,8 +15,10 @@ Keep Prisma's docs machine-readable so the Mintlify **agent-score** audit does n
15
15
-**Root `llms.txt` < 50k bytes** (warn at 35k). It links to per-area section indexes, not every page.
16
16
-**Each section index < 50k bytes** (warn at 40k). Over budget means split the section.
17
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.
18
+
-**Directives in HTML + Markdown** — every page's Markdown (`getLLMText`) starts with the hidden `llms.txt` directive blockquote; the HTML keeps a hidden directive as the **first child of `<body>` in the root layout** (`apps/docs/src/app/layout.tsx`), NOT inside the page component. Audits measure the directive's byte position in the body and warn when it sits past 50%, which is where it lands if rendered after the sidebar markup.
19
+
-**HTML/Markdown parity** via `data-markdown-ignore` on human-only chrome so the Markdown mirrors the page. The OpenAPI explorer (`APIPage` wrapper in `src/components/api-page.tsx`) carries `data-markdown-ignore` because the interactive reference has no markdown equivalent — the `.md` serves the generated API summary instead.
20
+
-**Markdown keeps real headings** — fumadocs' processed output emits headings as bare `Text [#anchor]` lines; `getLLMText` restores `##` markers from the page toc (`restoreHeadingMarkers` in `llm-markdown.ts`). Without them, parity checkers strip list-like heading text ("## 1. Set up …") and agents see prose instead of structure.
21
+
-**`<details>` blocks are converted** to a bold summary line + dedented body (`formatDetails` in `llm-markdown.ts`); serialized `<details>` children are 2-space indented, which silently breaks the code fences inside for markdown consumers.
20
22
-**`llms-full.txt` excludes** legacy `/orm/v6` and the Accelerate/Optimize products (`getLLMsFullPages`).
21
23
-**Skill + MCP endpoints live at BOTH roots**: `www.prisma.io` (apps/site) and `/docs` (apps/docs).
22
24
@@ -32,6 +34,8 @@ Keep Prisma's docs machine-readable so the Mintlify **agent-score** audit does n
|`/.well-known/mcp*` (site) |`apps/site/src/lib/agent-skills.ts` (`buildMcpDiscovery`, server cards) |
37
+
|`/docs/mcp` (MCP proxy) |`apps/docs/src/app/mcp/route.ts` → proxies protocol traffic to `mcp.prisma.io/mcp`|
38
+
|`/mcp` (site, MCP traffic) | header-matched `beforeFiles` rewrites in `apps/site/next.config.mjs` (browser GETs still get the marketing page) |
35
39
36
40
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
41
@@ -41,18 +45,31 @@ The route handlers are thin wrappers: shared builders in `llms.ts` are the singl
41
45
42
46
**(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
47
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.
48
+
**(c) Changing page chrome.**The hidden `llms.txt` directive lives in `apps/docs/src/app/layout.tsx` as the first child of `<body>` — keep it there (before `<Banner`), never move it into the page component where the sidebar markup would push it past 50% of the HTML. In `[[...slug]]/page.tsx`, put `data-markdown-ignore` on any human-only chrome (banners, nav, badges) so it stays out of the parity comparison. New interactive/human-only MDX components should get `data-markdown-ignore` on their wrapper plus a markdown fallback in `normalizeProcessedMarkdown` (`llm-markdown.ts`), following `APIPage`/`formatApiPage`.
45
49
46
50
**(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
51
48
52
**(e) Verification.**
49
53
50
54
```bash
51
55
pnpm --filter docs lint:agent-ready # all invariants + size table
Audit gotchas encoded in the invariants above: the HTML directive check needs an `<a href*="/llms.txt">` within the first 10% of the (nav/script/style-stripped) `<body>` on sampled pages and warns when every match sits past 50%; the parity check compares HTML text segments against the `.md`, strips `data-markdown-ignore` elements from the HTML side, and only treats a fenced code block as protected when the fence starts at column 0 — which is why `<details>` bodies must be dedented and headings must keep their `#` markers. The separate "MCP Server Discoverable" check probes `<origin>/mcp` with an MCP initialize request (discovery documents alone do not count), which is what the `/docs/mcp` proxy route and the site `/mcp` rewrites are for.
0 commit comments