> ## Documentation Index
> Fetch the complete guide index at: https://www.synscribe.com/agentic-discovery/llms.txt
> Use this file to discover all pages before exploring further.

---
title: How Better Auth Became AI Agents' #2 Docs Source
description: Repo created May 2024; 4.59% of all AI-agent doc retrieval by June 2026 — #2 behind only Next.js, ahead of React. The full agent-surface teardown.
slug: /agentic-discovery/case-studies/better-auth
series: The Agentic Discovery Playbook — Case Study
last_verified: 2026-06-11
---

# How Better Auth Became AI Agents' #2 Docs Source in Two Years

> **The lesson:** A product with no training-data prior and a mediocre trust score can out-rank React at the agent retrieval layer by saturating every surface agents touch — docs index, MCP, skills, in-product features — in a category where agents are forced to look things up. Demand capture, not reputation, is the replicable part.

## At a glance

| | |
|---|---|
| Category | Authentication framework (TypeScript) |
| Repo created | 2024-05-19 (GitHub-API verified) |
| Agent retrieval share | **4.59%** of all Context7 library traffic — **#2 overall**, behind only Next.js, ahead of React (2026-06-11) |
| Context7 entry | 502,435 tokens · 2,557 snippets · trust **7.6** · benchmark 77.5 · updated 3 d (2026-06-11) |
| 30-day momentum | +7% (within-top-50 share) |
| Agent skills installs | ~115.5K org total (order-of-magnitude; skills.sh telemetry) |

## What they built

Better Auth is the headline anomaly of our research: a roughly two-year-old auth framework that, as of 2026-06-11, is out-fetched by nothing except Next.js. It cannot be coasting on training data — the repo didn't exist before May 2024 — and it isn't coasting on reputation either: its Context7 trust score is 7.6, which the index assigns partly on org age. It ranks #2 on *demand* anyway.

What we directly observed is a full-stack agent surface, running from the docs layer down into the product itself:

| Surface | What we observed (2026-06-11) | Layer |
|---|---|---|
| llms.txt | Rich index with a dedicated **"AI Resources"** section | Retrieval ([Play 5](/agentic-discovery/llms-txt)) |
| Markdown mirrors | `.md` docs served — but only under a nonstandard `/llms.txt/docs/...md` prefix; canonical-path `.md` is empty | Retrieval ([Play 6](/agentic-discovery/markdown-docs-for-ai-agents)) |
| Docs MCP | Remote server at **mcp.better-auth.com**, installed by Better Auth's own CLI: `npx auth@latest mcp --cursor` or `--claude-code`, plus a Cursor deeplink | Retrieval + environment ([Play 3](/agentic-discovery/mcp-server-distribution)) |
| Agent skills | Installable skills encoding library conventions; ~115.5K org-total installs, order-of-magnitude | Environment ([Play 4](/agentic-discovery/agent-skills-and-agents-md)) |
| In-docs AI chat | Embedded assistant inside the documentation | Retrieval |
| Product features | An **MCP auth-provider plugin** and an **Agent Auth plugin** — agent-native capabilities in the product itself | Product ([Play 10](/agentic-discovery/agent-first-onboarding)) |

> "so your coding assistant follows library conventions"
> — better-auth.com docs, describing its installable agent Skills (observed 2026-06-11)

The CLI-installed MCP is the move worth dwelling on. Most products publish an MCP server and hope developers wire it up. Better Auth's CLI writes its docs server *into the agent's own configuration* — one command, and every future Cursor or Claude Code session in that environment can query Better Auth's live docs. That is environment-layer installation, the mechanism our pilot experiments found strongest.

In the 2×2 our report uses to map the anomalies (retrieval demand × training prior), Better Auth is the canonical "retrieval-carried" product: weak prior, all surface, high demand. The opposite corner is Tailwind — strong prior, zero first-party surface — which is why the two cases bracket the strategy space (see [the Tailwind case study](/agentic-discovery/case-studies/tailwind)).

## The receipts

All figures observed 2026-06-11; single-day snapshot, ±10% error bars (we watched Stripe's snippet count read 130 and 207 on the same day).

**The ranking.** From the Context7 top-50 share table (2026-06-11):

| # | Library | Share |
|---|---|---|
| 1 | /vercel/next.js | 10.97% |
| 2 | **/better-auth/better-auth** | **4.59%** |
| 3 | /websites/vercel | 3.35% |
| 4 | /vercel/ai | 3.12% |
| 5 | /anthropics/claude-code | 2.63% |
| 6 | /reactjs/react.dev | 2.57% |

A repo created 2024-05-19 sits ahead of React's official docs, Supabase, shadcn/ui, and Tailwind. 30-day momentum: +7% — modest but positive while it holds the slot.

**The anomaly, stated precisely (report §5, A1).** The #2 position can't be training data (too young) and can't be reputation-by-age (trust 7.6). What it has: category-leading task friction (auth is maximum boilerplate), a CLI that installs its docs-MCP into the agent's own config, skills encoding its conventions, and a large fresh Context7 corpus (502K tokens, 3-day freshness). The explanation consistent with the evidence: **retrieval-layer dominance in a high-retrieval-demand category, plus agent-environment installation.**

**The benchmark is unremarkable — and it didn't matter for demand.** Better Auth's Context7 benchmark is 77.5, below Bun (84.4), Next.js (84.9), and shadcn/ui (87.1). Demand rank and quality score are different axes; Better Auth won the first without leading the second.

**The flaw in the stack.** Its `.md` mirrors work only under the nonstandard `/llms.txt/docs/...` prefix while canonical-path `.md` URLs return empty. Agents guess the standard convention first; a working mirror at the wrong path is undiscoverable. The #2 ranking happened despite this, not because of it.

**The sobering control result.** In our pilot E1 (single model — Claude Haiku 4.5 — n=3 per arm, tools disabled, 2026-06-11), bare agents asked to add auth to a fresh Next.js app chose NextAuth 3/3 — Better Auth 0/3. Its dominance lives at the *retrieval* layer, where agents fetch docs mid-task; the bare-model prior in auth still belongs to the incumbent. Pilot-grade, but it shows exactly which layer Better Auth actually owns.

**Skills caveat.** The ~115.5K org-total install count comes from skills.sh telemetry, which is opt-out, excludes CI, and is cache-noisy — we observed other vendors' totals varying between page loads. Order-of-magnitude only.

**Skills detail.** Within that org total, `better-auth-best-practices` alone reads 45.7K installs — the `{product}-best-practices` pattern that dominates the skills leaderboard (see [Play 4](/agentic-discovery/agent-skills-and-agents-md)).

## What to copy

- [ ] Add a dedicated "AI Resources" section to your llms.txt so agents find your MCP, skills, and agent docs from the index file ([Play 5](/agentic-discovery/llms-txt)).
- [ ] Ship a remote docs-MCP, then make your own CLI install it into Cursor and Claude Code with one command — don't wait for developers to wire it up ([Play 3](/agentic-discovery/mcp-server-distribution)).
- [ ] Publish skills that encode your library's conventions, so agents follow your idioms instead of improvising ([Play 4](/agentic-discovery/agent-skills-and-agents-md)).
- [ ] Keep your Context7 entry large and fresh — 502K tokens at 3-day freshness is part of this story; claim and curate the entry ([Play 2](/agentic-discovery/ai-agent-registries-and-directories)).
- [ ] Build agent-native product features, not just agent-readable docs — Better Auth sells an MCP auth-provider plugin and an Agent Auth plugin ([Play 10](/agentic-discovery/agent-first-onboarding)).
- [ ] Serve `.md` mirrors at the *canonical-path* convention, not a custom prefix — copy the surface, fix their flaw ([Play 6](/agentic-discovery/markdown-docs-for-ai-agents)).

## What NOT to over-copy

- **The category did heavy lifting.** Auth is the highest-friction, most boilerplate-heavy task in app scaffolding — retrieval demand for auth docs is structurally enormous (report §4.2). Better Auth's achievement is capturing that demand against incumbents (Auth0, NextAuth, Clerk all predate it in training data). If your category generates few mid-task doc lookups, the same stack yields a smaller prize.
- **Retrieval rank is a flow metric, not a stock metric.** The same dataset shows openclaw falling −50% in 30 days while still ranked #10. Better Auth's +7% momentum is solid, but this position must be maintained, not banked.
- **One day, one index.** All numbers are a 2026-06-11 Context7 snapshot with ±10% error bars; Context7 is the dominant retrieval directory we can measure, not the whole retrieval layer.
- **The nonstandard `.md` prefix.** Genuinely a defect — do not replicate it.
- **Retrieval dominance hasn't flipped the bare-model default.** E1's control arm picked NextAuth 3/3. Copy this stack expecting to win agents that *look things up*, not agents answering from memory.

## FAQ

**Why does Better Auth rank #2 on Context7?**
Not training data and not reputation — the repo dates to May 2024 and its trust score is 7.6. The evidence-consistent explanation is retrieval-layer dominance in a structurally high-demand category (auth), combined with environment installation: a CLI that writes its docs-MCP into Cursor and Claude Code configs, plus skills, llms.txt, and a large, fresh index entry.

**Does Better Auth have an MCP server?**
Yes — a remote docs MCP at mcp.better-auth.com, installable via its own CLI (`npx auth@latest mcp --cursor` or `--claude-code`) with a Cursor deeplink. It also ships MCP as a *product* capability: an MCP auth-provider plugin and an Agent Auth plugin (observed 2026-06-11).

**Is Better Auth proof that any new product can become an AI-agent default in two years?**
It's proof the break-in is possible, not that it's easy. Better Auth combined a maximum-retrieval-demand category with a complete agent surface and environment installation. In our pilot, bare models still defaulted to NextAuth 3/3 — the win is at the retrieval layer, and it has to be re-earned as rankings move.

---

*Snapshot date 2026-06-11; single-day metrics carry ±10% error bars. Part of [Case Studies](/agentic-discovery/case-studies) · [The Complete Playbook to Agentic Discovery](/agentic-discovery).*

← Previous: [Case Studies](/agentic-discovery/case-studies) · Next: [How DodoPayments Owns a Category Query](/agentic-discovery/case-studies/dodopayments) →

> **Stay ahead of the agents.** We re-test this playbook quarterly and publish what changed — new data, busted myths, ranking shifts. [Get the update digest →](/agentic-discovery#updates)
>
> **Want this done for you?** Synscribe runs agentic-discovery programs for B2B SaaS and developer platforms. [Talk to us →](/contact)
