Files
supabase/.agents/skills/ask-the-docs/SKILL.md
Nik RichersandNik Richers a522111d51 docs(skills): update ask-the-docs skill and add a drift check (#54149)
## I have read the CONTRIBUTING.md file.

YES

## What kind of change does this PR introduce?

**Skill fix + drift check.** This PR fixes stale facts in the
`ask-the-docs` skill after the Next.js 16 upgrade and the AI layout
work. It also gives the skill a cheap way to notice its own drift: each
checked reference file records the commit it was verified at, and the
agent runs one `git log` against that commit before it answers.
Follow-up to #54082.

## What is the current behavior?

- `app-map.md` says the docs app is Next.js 15. It is Next.js 16
(#52045).
- `app-map.md` and `llm-agent-surface.md` point to
`apps/docs/middleware.ts` and `apps/www/middleware.ts`. Both files are
now `proxy.ts` (#52045).
- The skill doesn't say that dev uses Turbopack while the build uses
webpack (#53787), so a loader change can work in dev and fail in the
build.
- The skill doesn't mention layout v2 (#52971 to #52976) or
`apps/docs/style-guide/`.
- No reference file records when it was last checked, so an agent can't
tell an old fact from a new one.

## What is the new behavior?

| File | Change |
| --- | --- |
| `SKILL.md` | New step 1, **Check for drift**: run `git log <Verified
at>..HEAD` for each reference file the answer uses. A file with no stamp
is unverified. New rule: list stale facts under **Skill corrections**
and, with the user's approval, fix them in the user's open PR if it
changes `apps/docs`, else in a new PR. |
| `reference/app-map.md` | Next.js version removed, `proxy.ts`, a
`style-guide/` row, and a short **Layout v2** section (variant, flag,
override, shell files). |
| `reference/llm-agent-surface.md` | Each `middleware.ts` is now
`proxy.ts` (docs and www), including the Mermaid node. A stale line
range is removed. |
| `reference/build-pipeline.md` | Dev uses Turbopack, the build uses
`--webpack`, and a loader change must work in both. |

Only these 3 reference files get a `Verified at: 3089aa3f67
(2026-11-25).` line, because they are the only ones checked claim by
claim. The other 11 files get a stamp when someone checks them.

## Additional context

- **Proof:** none needed. This PR changes skill reference files only,
with no rendered output.
- **Verification:** each changed fact was checked against the code at
this branch's base.

| Fact | Evidence |
| --- | --- |
| Next.js 16 | `pnpm-workspace.yaml` catalog: `next: ^16.4.3` |
| `proxy.ts` | `apps/docs/proxy.ts` and `apps/www/proxy.ts` exist,
`middleware.ts` doesn't |
| Turbopack in dev, webpack in build | `apps/docs/package.json` `build`:
`next build --webpack`; `next.config.mjs` has `webpack` and `turbopack`
blocks |
| `layout-v2:` variant | `apps/docs/styles/globals.css:25` |
| Flag and override | `apps/docs/features/IaNav/constants.ts`
(`docs-ia-mvp-v1`, `option-1`, URL override) |

- `app-map.md` still lists `content/troubleshooting/` on `master`.
#54082 removes it, so this PR leaves those lines alone. The two PRs
touch different lines and can merge in either order.

### Test plan

- [ ] Each fact in the table above matches the code
- [ ] Ask the skill a question about `apps/docs/proxy.ts` and confirm it
runs the drift check first
- [ ] `grep -rn "middleware.ts" .agents/skills/ask-the-docs` returns
nothing

---------

Co-authored-by: Nik Richers <nik@validmind.ai>
2026-11-26 11:17:31 -07:00

9.7 KiB

name, description
name description
ask-the-docs Answer questions about the Supabase docs app (apps/docs) using documented architecture, build pipeline, and review-pattern notes, and apply feature-design principles (codebase reuse, coding minimalism) when proposing or critiquing changes. Use when the user asks "how does X work in the docs app?", "where does Y live?", "is this approach OK for the docs app?", or before writing non-trivial changes under apps/docs/ — especially anything touching the MDX pipeline, markdown generation, content components, federated docs, or contributor-facing authoring patterns, or feature flags and experiments. Can answer architecture questions with Mermaid diagrams when helpful.

Ask the docs-app librarian

A reference for apps/docs knowledge — architecture, build pipeline, federated docs, known fragilities — plus the feature-design principles the codebase rewards: understand and reuse the existing code before writing new code, and practice coding minimalism to keep the surface area small.

Two jobs:

  1. Look up what's already documented about the docs app — architecture, tradeoffs, gotchas, prior decisions — instead of re-deriving from cold reads.
  2. Pre-empt review feedback by applying the codebase-reuse / minimalism principles before opening a PR. Catches the "fix it in the next round" comments early.

When to invoke

  • User asks about apps/docs architecture, conventions, or behavior ("how does the markdown pipeline work?", "where do listings data files go?", "why does Troubleshooting have a .mjs utils file?").
  • User asks about LLM/agent consumption (llms.txt, markdown negotiation, searchDocs, bulk exports, agent onboarding guides, humans vs agents vs crawlers, AI prompt blocks in quickstarts).
  • About to write code under apps/docs/ that touches: MDX components, internals/markdown-schema/, generate-guides-markdown.ts, content data modules, the lint pipeline, telemetry events, contributor-facing snippets, federated routes, reference codegen, or Management API / OpenAPI reference pages.
  • Reviewing a docs-app PR and want a sanity check against the documented principles.

Not for: general Supabase docs content questions (use write-the-docs, edit-the-docs, or review-the-docs), or app-level work outside apps/docs/.

Answering with diagrams

Architecture and pipeline questions are often clearer with a diagram than with prose. Default to including a Mermaid diagram in answers about:

  • The MDX runtime vs markdown-export pipeline split.
  • Build flow (Turbo task graph → build → Vercel).
  • LLM/agent consumption surface (llms.txt, negotiation, bulk exports).
  • Federated docs fetch flow.
  • CI / PR flow.
  • Component / data-registry relationships.
  • Management API OpenAPI → codegen → reference page flow.

Mermaid fences (`` ```mermaid `````) render natively on GitHub and most Markdown previewers. Several reference files already embed Mermaid; reuse or adapt them rather than re-deriving.

Keep diagrams small and one-topic. If a diagram needs more than a dozen nodes, split it.

Reference files

Short, focused docs under reference/. Read whichever apply to the task at hand — they cite each other where context matters.

File What's inside
reference/adding-features.md Best-practices guidance for adding features to apps/docs. Inventory existing code first, pick the smallest viable shape, reuse pipelines.
reference/docs-app-direction.md Refactoring vision and working norms — what new work should align with.
reference/known-issues.md Living list of broken, fragile, or in-flux systems. Check before depending on anything (federated docs, search, Sentry, reference-page architecture).
reference/app-map.md Architecture cheat sheet — directories, the two-pipeline (MDX runtime + markdown export) model, heading/typography contract, telemetry, lint entries.
reference/build-pipeline.md Turborepo task graph for building apps/docs — codegen, markdown generation, sitemap, Vercel deploy. Mermaid diagram included.
reference/llm-agent-surface.md Audience routing, llms.txt, content negotiation, bulk exports.
reference/llm-agent-parity.md HTML↔markdown fidelity (e.g. AI prompts), search caveat, agent onboarding guides, in-flux wiring.
reference/federated-docs.md How docs pulls markdown from external repos at build time. Routes, pageMap, remark/rehype plugins, link transforms, known failure modes.
reference/ci-and-lint.md GitHub Actions on every PR — Docs Tests, typecheck, oxfmt, Vercel preview gate. Where to add a check before creating a new one.
reference/management-api-reference.md Management API OpenAPI → reference generation, including scoped PAT permission tables; why not to swap in Scalar/Redoc.
reference/graphql-endpoint.md The /api/graphql endpoint under apps/docs/resources/ — per-query folder layout, rootSchema.ts, connection/field utils, and the steps to add a new top-level query.
reference/search-embeddings.md The scripts/search/ embeddings pipeline behind searchDocs — content sources, processing flow, change detection, and the page / page_section tables.
reference/feature-flags.md Static enabled-features flags and PostHog experiment flags in apps/docs: where each resolves, the variant hook pattern, and gotchas.
reference/gotchas.md Specific traps to watch for. One-liner per item.

How to use during a chat

  1. Check for drift. For each reference file you use, run git log --oneline <Verified at>..HEAD -- apps/docs ':!apps/docs/content' and read each commit that touches code the answer depends on. A file with no Verified at line is unverified.
  2. Start by reading adding-features.md and app-map.md if the question touches design choices or unfamiliar code paths. They're small on purpose — read both, don't skim.
  3. Verify before recommending. Reference content may lag behind the live code. Confirm with the actual files (apps/docs/...) before acting on remembered claims about file paths, function names, or behavior.
  4. Cite the principle, not just the rule. "Per adding-features.md § 'Reuse pipelines, don't fork them', this routes through the existing markdown-schema handler rather than introducing a side path."
  5. Reach for Mermaid when explaining architecture, flows, or relationships — see Answering with diagrams.

Updating the librarian

This skill lives in .agents/skills/ask-the-docs/ in supabase/supabase. When something in apps/docs changes in a way that makes a reference file inaccurate, or a generally-applicable lesson emerges from a PR review, open a pull request against this repo to update the relevant file, same as any other in-repo change.

List each stale fact under "Skill corrections" at the end of the answer. With the user's approval, fix it in their open PR if that PR changes apps/docs, else in a new PR. After you check a whole file, set its Verified at line to that commit.

Keep each canonical file under ~250 lines; split before they bloat. Capture only what a future contributor would benefit from knowing — if a fact is already obvious from a quick read of the live code, don't write it down.

  • pm-the-docs — audience, stage, content type, and placement calls (Frame and Shape stages of the "Write the docs" checklist, mirrored in pm-the-docs's reference file). Cross-repo product lookup (universe) lives there, not in this skill.
  • test-the-docs — execute docs snippets against a Docker-isolated local stack; verification report.
  • review-the-docs — reviewing open docs PRs with type-specific verification.