Skip to content

Make prisma.io docs agent-ready: llms.txt split, agent directives, skill.md, MCP discovery#8087

Merged
nurul3101 merged 5 commits into
mainfrom
docs/agent-ready-score
Jul 21, 2026
Merged

Make prisma.io docs agent-ready: llms.txt split, agent directives, skill.md, MCP discovery#8087
nurul3101 merged 5 commits into
mainfrom
docs/agent-ready-score

Conversation

@ankur-arch

@ankur-arch ankur-arch commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Why

Mintlify's agent-score audit of www.prisma.io/docs scored 85/100 (B) with failing checks in Content Discoverability, Markdown Parity, Full Content Discoverability, Agent Skills, and MCP Server discovery. This PR addresses all of them so AI agents (Claude, ChatGPT, Cursor, etc.) can reliably discover, crawl, and trust our docs.

Key changes

1. llms.txt was too big to be usable (116k chars → ~7.5k)

Agents truncate llms.txt above 100k chars, so ours was effectively cut off mid-file. The root index no longer dumps all 631 pages; it now links to per-area section indexes (/docs/llms/orm.txt, /docs/llms/postgres.txt, … 10 sections total, each under 50k chars). A coverage helper guarantees every page is reachable from the root index — pages that match no section are listed directly under "Other pages."

2. Agents visiting a page had no pointer to the index

Every docs page now carries an llms.txt directive in both formats:

  • HTML: a visually-hidden (crawler-visible) element linking /docs/llms.txt and the page's .md URL
  • Markdown: a blockquote at the top of every .md page

3. Markdown pages were missing content the HTML had

The page description (rendered in HTML) is now included in the markdown output, and HTML-only chrome (copy buttons, "Edit on GitHub" footer) is marked data-markdown-ignore so parity checkers don't count it against us.

4. llms-full.txt was 7 MB with broken links (→ ~4.5 MB, links fixed)

The full-content feed now excludes legacy /orm/v6 pages (191 pages, still available per-page via .md) and deprecated Accelerate/Optimize pages (already excluded from the index, but leaking into the full feed). In-body root-relative links are now resolved to absolute URLs — before, ~2,500 links would lose the /docs prefix when resolved against the feed URL. After the fix, 4,591 of 4,597 internal links resolve (the 6 remaining point at a pre-existing broken link target in Accelerate content).

5. No agent skill definition existed (score: 0/100)

An agentskills.io-format skill is now served at /skill.md, /docs/skill.md, and /.well-known/agent-skills/*. Content is grounded strictly in existing docs (quickstart + MCP server pages): the core CLI workflow, Prisma Postgres setup, MCP config, and where agents should read docs.

6. Our MCP server wasn't discoverable (score: 0/100)

Prisma already runs a real MCP server at mcp.prisma.io/mcp — checkers just couldn't find it. Standard discovery documents are now served at /.well-known/mcp, /.well-known/mcp.json, and /.well-known/mcp/server-card(s).json, listing the 11 documented tools.

Impact

Check Before After
llms.txt size 116k chars (truncated by agents) ~7.5k root + sections < 50k
llms.txt directive (HTML/MD) absent on every page
Markdown parity 1/15 pages diverged descriptions included, chrome ignored
llms-full.txt 7 MB, ~2.5k broken links ~4.5 MB, 6 pre-existing broken links
skill.md none /skill.md + well-known endpoints
MCP discovery none /.well-known/mcp* → mcp.prisma.io

Verification

  • pnpm --filter docs types:check and pnpm --filter site types:check pass
  • All new endpoints curl-verified against local dev servers (200 + correct Content-Type)
  • Link resolution verified by script against the sitemap's 637 URLs
  • Section file sizes measured from generated output

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added machine-readable agent skill and MCP discovery endpoints, including MCP server cards and dedicated docs skill Markdown routes.
    • Introduced new per-page llms.txt cross-links in the docs renderer for better offline/AI access.
  • Improvements
    • Enhanced llms.txt/llms-full.txt generation with clearer legacy ORM v6 exclusions and expanded, consistent section coverage.
    • Updated markdown/link processing to produce absolute, offline-friendly URLs while preserving fenced/inline code.
  • Chores
    • Added an “agent readiness” lint script and CI coverage to enforce indexing, endpoint, and content invariants.

Keeping the score from regressing (added in follow-up commit)

The setup is now self-maintaining:

  • Shared builders — the llms.txt root index and section files are generated by pure functions in lib/llms.ts; the route handlers are thin wrappers. New content is picked up automatically via section prefixes, and pages matching no section surface in the root "Other pages" list, so nothing can silently fall out of the index.
  • CI guardpnpm --filter docs lint:agent-ready (new step in the Links workflow) fails the build if any invariant regresses: size budgets (root < 50k, each section < 50k with early warnings), full page coverage, catch-all creep (> 25 uncategorized pages → time to add a section), the markdown llms.txt directive, stale common-query links, v6/deprecated pages leaking into llms-full.txt, or missing skill.md / MCP-discovery fields. It also prints a size-budget table with per-file headroom for reviewers.
  • Repo skill.claude/skills/docs-agent-ready/SKILL.md documents the invariants, the endpoint→file map for both apps, and playbooks (adding a docs area, splitting an over-budget section, page-chrome rules, keeping skill.md in sync with the quickstart/MCP docs).

Current guard output: 0 failures, 0 warnings — largest file (llms/orm.txt) at 38k of its 50k budget.

…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>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jul 21, 2026 9:09am
docs Ready Ready Preview, Comment Jul 21, 2026 9:09am
eclipse Ready Ready Preview, Comment Jul 21, 2026 9:09am
site Ready Ready Preview, Comment Jul 21, 2026 9:09am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dc3182a1-ca36-47ed-8c6b-8bf6f0deaf67

📥 Commits

Reviewing files that changed from the base of the PR and between 70e6715 and deb835f.

📒 Files selected for processing (2)
  • apps/docs/scripts/lint-agent-ready.ts
  • apps/docs/src/lib/llm-markdown.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/scripts/lint-agent-ready.ts

Walkthrough

The change adds AI-readable documentation links and markdown processing, reorganizes LLM indexes and feeds, introduces Prisma agent-skill and MCP discovery endpoints, and adds automated agent-readiness validation.

Changes

AI documentation and agent discovery

Layer / File(s) Summary
Markdown extraction and page metadata
apps/docs/src/app/(docs)/(default)/[[...slug]]/page.tsx, apps/docs/src/lib/get-llm-text.ts, apps/docs/src/lib/llm-markdown.ts
Adds page markdown links, excludes UI regions from extraction, absolutizes markdown links, and preserves fenced and inline code.
LLM index organization and filtering
apps/docs/src/lib/llms.ts, apps/docs/src/app/llms.txt/route.ts, apps/docs/src/app/llms/[...slug]/route.ts
Adds documentation sections, excludes legacy ORM v6 routes, centralizes page matching, and builds root and section indexes.
Docs feeds and skill endpoint
apps/docs/src/app/llms-full.txt/route.ts, apps/docs/src/lib/agent-skill.ts, apps/docs/src/app/skill.md/route.ts
Filters legacy ORM v6 pages from the full feed and adds a Markdown skill endpoint.
Agent skill and MCP payload builders
apps/site/src/lib/agent-skills.ts, apps/docs/src/lib/mcp-discovery.ts
Defines generated skill Markdown, agent-skill indexes, MCP discovery metadata, and server cards.
Well-known discovery endpoints
apps/site/src/app/.well-known/..., apps/site/src/app/skill.md/route.ts, apps/docs/src/app/.well-known/...
Serves generated JSON and Markdown through non-revalidating routes with explicit content types.
Agent-readiness validation and CI wiring
apps/docs/scripts/lint-agent-ready.ts, .github/workflows/links.yml, apps/docs/package.json, turbo.json, .claude/skills/...
Documents readiness rules, validates generated indexes and endpoints, and runs the checks in CI.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Agent
  participant WellKnownRoute
  participant Builder
  Agent->>WellKnownRoute: Request skill or MCP metadata
  WellKnownRoute->>Builder: Generate payload
  Builder-->>WellKnownRoute: Return JSON or Markdown
  WellKnownRoute-->>Agent: Send typed response
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main docs-agent readiness changes, including llms.txt splitting, agent directives, skill.md, and MCP discovery.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/agent-ready-score

Comment @coderabbitai help to get the list of available commands.

@argos-ci

argos-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jul 21, 2026, 9:16 AM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/src/lib/get-llm-text.ts`:
- Around line 201-210: Update absolutizeInBodyLinks to preserve inline backtick
code spans as well as fenced blocks before rewriting links, ensuring markdown
examples such as [label](/path) inside inline code remain unchanged while actual
links continue through resolveInBodyHref.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bbdd4c54-76b7-4fd1-b989-2e2283a2db85

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb6000 and a97b71a.

📒 Files selected for processing (18)
  • apps/docs/src/app/(docs)/(default)/[[...slug]]/page.tsx
  • apps/docs/src/app/.well-known/mcp.json/route.ts
  • apps/docs/src/app/.well-known/mcp/route.ts
  • apps/docs/src/app/llms-full.txt/route.ts
  • apps/docs/src/app/llms.txt/route.ts
  • apps/docs/src/app/skill.md/route.ts
  • apps/docs/src/lib/get-llm-text.ts
  • apps/docs/src/lib/llm-markdown.ts
  • apps/docs/src/lib/llms.ts
  • apps/docs/src/lib/mcp-discovery.ts
  • apps/site/src/app/.well-known/agent-skills/index.json/route.ts
  • apps/site/src/app/.well-known/agent-skills/prisma/SKILL.md/route.ts
  • apps/site/src/app/.well-known/mcp.json/route.ts
  • apps/site/src/app/.well-known/mcp/route.ts
  • apps/site/src/app/.well-known/mcp/server-card.json/route.ts
  • apps/site/src/app/.well-known/mcp/server-cards.json/route.ts
  • apps/site/src/app/skill.md/route.ts
  • apps/site/src/lib/agent-skills.ts

Comment thread apps/docs/src/lib/get-llm-text.ts Outdated
…-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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/scripts/lint-agent-ready.ts`:
- Around line 232-240: Update the MCP discovery validation around
mcpDiscoveryDocument to validate both docs and site discovery payloads, not just
the docs builder. For every server, verify the canonical server URL, transport,
and authentication fields against the expected values, and fail with actionable
field-specific messages when either payload is incomplete or incorrect; retain
the existing pass behavior only when both roots are fully valid.
- Around line 136-168: Update the Check 5 validation loop to cover every indexed
page in the relevant sections rather than sampling only the first page. For each
page, validate that the markdown directive is the first required content and
that the rendered HTML has the directive as its first child, using the existing
page text/rendering utilities and reporting failures per page; retain the
description check for each page.
- Around line 28-30: Update the baseUrl declaration in the lint-agent-ready
script to always use the fixed production URL https://www.prisma.io, removing
the NEXT_PUBLIC_PRISMA_URL environment-variable fallback so byte-budget
measurements remain stable across environments.

In `@apps/docs/src/lib/agent-skill.ts`:
- Around line 52-56: Update the setup instructions around the `npx create-db`
command to require explicit user consent immediately before provisioning the
hosted Prisma Postgres database. Make clear that the agent must pause and obtain
confirmation before executing this external resource-creation step, while
preserving the subsequent connection-string configuration guidance.
- Around line 35-43: Update the TypeScript project setup instructions before
`prisma init` to include `npx tsc --init` and configure `tsconfig.json` with
`module: "ESNext"`, `moduleResolution: "bundler"`, and `target: "ES2023"`, plus
set `"type": "module"` in `package.json`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 16eb7c99-7e57-49e5-8f04-50c19851a619

📥 Commits

Reviewing files that changed from the base of the PR and between a97b71a and 1dffbaa.

📒 Files selected for processing (12)
  • .claude/skills/README.md
  • .claude/skills/docs-agent-ready/SKILL.md
  • .github/workflows/links.yml
  • apps/docs/package.json
  • apps/docs/scripts/lint-agent-ready.ts
  • apps/docs/src/app/llms-full.txt/route.ts
  • apps/docs/src/app/llms.txt/route.ts
  • apps/docs/src/app/llms/[...slug]/route.ts
  • apps/docs/src/app/skill.md/route.ts
  • apps/docs/src/lib/agent-skill.ts
  • apps/docs/src/lib/llms.ts
  • turbo.json

Comment thread apps/docs/scripts/lint-agent-ready.ts Outdated
Comment thread apps/docs/scripts/lint-agent-ready.ts Outdated
Comment thread apps/docs/scripts/lint-agent-ready.ts Outdated
Comment thread apps/docs/src/lib/agent-skill.ts
Comment thread apps/docs/src/lib/agent-skill.ts Outdated
- 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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/src/lib/llm-markdown.ts`:
- Around line 409-419: Update the placeholder generation and restore logic in
the inline-code protector around the restore method so restoration cannot
replace sentinel text reintroduced by an earlier span. Coordinate token
generation across both inline and fenced-code protectors in get-llm-text.ts,
using collision-free unique placeholders rather than sequential per-protector
indices. Add regression coverage for sentinel-looking text inside inline and
fenced code spans, preserving literal content during restoration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8c2f4193-5345-4f4b-97ef-33057c3a7070

📥 Commits

Reviewing files that changed from the base of the PR and between 1dffbaa and 524b760.

📒 Files selected for processing (5)
  • apps/docs/scripts/lint-agent-ready.ts
  • apps/docs/src/lib/agent-skill.ts
  • apps/docs/src/lib/get-llm-text.ts
  • apps/docs/src/lib/llm-markdown.ts
  • apps/site/src/lib/agent-skills.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/docs/src/lib/agent-skill.ts
  • apps/site/src/lib/agent-skills.ts
  • apps/docs/src/lib/get-llm-text.ts

Comment thread apps/docs/src/lib/llm-markdown.ts Outdated
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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/docs/src/lib/llms.ts (1)

355-448: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression coverage for section partitioning.

Test that /orm/next, /guides/next, /cli/next, /orm/v6, and unmatched pages appear only in their intended feed. The existing coverage check can pass even if a page is duplicated across a parent and Prisma Next section.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/src/lib/llms.ts` around lines 355 - 448, Add regression tests for
buildLLMsIndexContent, buildLLMsSectionContent, and getLLMsFullPages covering
/orm/next, /guides/next, /cli/next, /orm/v6, and an unmatched page. Assert each
page appears only in its intended feed, including that Prisma Next pages are not
duplicated in parent sections, /orm/v6 is excluded from the full feed, and
unmatched pages appear only in the index’s other-pages section.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/docs/src/lib/llms.ts`:
- Around line 355-448: Add regression tests for buildLLMsIndexContent,
buildLLMsSectionContent, and getLLMsFullPages covering /orm/next, /guides/next,
/cli/next, /orm/v6, and an unmatched page. Assert each page appears only in its
intended feed, including that Prisma Next pages are not duplicated in parent
sections, /orm/v6 is excluded from the full feed, and unmatched pages appear
only in the index’s other-pages section.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c92d7302-8726-4f75-a83d-c889f05946c6

📥 Commits

Reviewing files that changed from the base of the PR and between 524b760 and 70e6715.

📒 Files selected for processing (1)
  • apps/docs/src/lib/llms.ts

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>
@ankur-arch

Copy link
Copy Markdown
Contributor Author

@coderabbitai resolve

@ankur-arch

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@nurul3101
nurul3101 merged commit b6806c8 into main Jul 21, 2026
17 checks passed
@nurul3101
nurul3101 deleted the docs/agent-ready-score branch July 21, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants