mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## I have read the CONTRIBUTING.md file.
YES
## What kind of change does this PR introduce?
**Skill update.** The `write-the-docs` and `edit-the-docs` skills and
the `pm-the-docs` checklist now say when content belongs in `/kb`
instead of `/docs`. The docs skills also get a consistency pass.
Closes DOCS-1559.
## What is the current behavior?
The skills and the checklist do not mention `/kb`. Writers get no prompt
to put comparisons or migration guides there. The skills also still
place troubleshooting in `apps/docs`, disagree about which skill owns
the Shape stage, and link to skills that are not in this repo.
## What is the new behavior?
| File | Change |
|---|---|
| `.agents/skills/write-the-docs/reference/content-type-gate.md` | Adds
a `/kb` row and a short "What goes in `/docs` and what goes in `/kb`"
section. Troubleshooting now points to `/kb`. |
| `.agents/skills/write-the-docs/SKILL.md` | Adds `/kb` to the content
types. `/kb` guides use the template gate, and `/kb` FAQs are exempt.
Phase 2 sends `/kb` content to `apps/kb/AGENTS.md`. Removes duplicate
steps and links to skills outside this repo. |
| `.agents/skills/write-the-docs/reference/drafting-mechanics.md` | Says
oxfmt instead of Prettier |
| `.agents/skills/edit-the-docs/SKILL.md` | Adds a content-type gate
check before additions |
| `.agents/skills/pm-the-docs/reference/write-the-docs-checklist.md` |
Adds a stage 2 (Shape) item to decide if content belongs in `/kb`. Shape
now points to `/pm-the-docs` for placement decisions. |
| `.agents/skills/pm-the-docs/SKILL.md`,
`.agents/skills/ask-the-docs/SKILL.md` | Agree that `pm-the-docs` owns
Frame and Shape, and `ask-the-docs` owns docs-app mechanics. Removes
links to skills outside this repo. |
| `.agents/skills/ask-the-docs/reference/*.md` | Says oxfmt instead of
Prettier, updates the troubleshooting known issue, and removes links to
skills outside this repo |
## Additional context
Skill docs only. No preview needed. Troubleshooting now lives in `/kb`
and takes no direct contributions. The skills now say so.
### Test plan
- [ ] Read the diffs. The `/docs` and `/kb` rule matches the
content-type gate.
- [ ] `grep -rn docs-agent-skills
.agents/skills/{write,ask,pm}-the-docs` returns nothing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Nik Richers <nik@validmind.ai>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Alexis Aguilar <98043211+alexisintech@users.noreply.github.com>
133 lines
6.4 KiB
Markdown
133 lines
6.4 KiB
Markdown
# `apps/docs` gotchas
|
|
|
|
Specific traps to watch for. One-liner per item.
|
|
|
|
## Markdown pipeline
|
|
|
|
- **JSX with no schema handler is unwrapped, not dropped.** Children pass
|
|
through as plain markdown. If a component should disappear entirely from
|
|
`.md` output, its handler must return `''`.
|
|
- **Handlers run bottom-up.** Children are already-serialized markdown
|
|
strings by the time the parent handler sees them. Don't try to inspect
|
|
child JSX from a parent handler — use `node.children` only for structure
|
|
decisions.
|
|
- **`mdxFlowExpression` / `mdxTextExpression` / `mdxjsEsm` are skipped.**
|
|
Anything wrapped in `{...}` won't appear in markdown output.
|
|
- **`<AiPrompt id="…" />` carries only an ID.** Prompt text lives in
|
|
`data/ai-prompts.data.ts`; don't inline prompt strings in MDX. Markdown
|
|
export handles the `PromptPanel` parts via
|
|
`internals/markdown-schema/PromptPanel.ts` (drops `PromptCopy`).
|
|
- **`<$Partial>` recursion is silent.** A missing or unreadable partial is
|
|
dropped without error. Check `partials/` paths when content seems missing
|
|
from generated `.md`.
|
|
- **`$Partial` `variables` are runtime-only unless wired in markdown export.**
|
|
`partialsRemark` substitutes `{{ .key }}` placeholders; `inlinePartials`
|
|
in `generate-guides-markdown.ts` must do the same or nested partials like
|
|
`path="{{ .prompt }}"` fail silently (file not found).
|
|
- **`GlassPanel` / `IconPanel` markdown handlers must include children.**
|
|
A handler that returns only `props.title` drops nested content. See
|
|
`internals/markdown-schema/Panel.ts`.
|
|
|
|
## Markdown handler authoring
|
|
|
|
- Handler files in `internals/markdown-schema/` must be named after the
|
|
component (`ContentListings.ts`, not `Listings.ts`). The registry key in
|
|
`generate-guides-markdown.ts` is the JSX element name.
|
|
- Use the existing `withDocsBasePath` / `addBaseUrlPrefix` from
|
|
`internal-links.ts` for URL prefixing — don't roll your own.
|
|
- If a handler needs data, the **JSX prop carries an `id`** and the handler
|
|
looks the data up from the same registry the runtime component uses. Don't
|
|
serialize data into JSX props.
|
|
- Push a blank line right after each exported block (heading, description,
|
|
list). Keeps handler logic linear and avoids redundant trailing-empty-line
|
|
branches.
|
|
|
|
## React / MDX components
|
|
|
|
- `not-prose` is the canonical opt-out from the surrounding `.prose`
|
|
typography. Wrap structural layout in `not-prose`; keep headings outside so
|
|
they inherit prose styles.
|
|
- `<Heading>` from `MdxBase.shared.tsx` is the canonical heading. Don't roll
|
|
your own `<h2>` / `<h3>` markup in MDX components — typography drifts.
|
|
- `<Link>` from `next/link` works with `target="_blank"` for external
|
|
destinations. Don't construct `<a>` directly.
|
|
- A `useSendTelemetryEvent()` call inside a render path returns a function;
|
|
don't invoke it directly inside the JSX, build a callback first.
|
|
- `$Show` reads static `enabled-features` flags only. It cannot read PostHog
|
|
flags. See [feature-flags.md](./feature-flags.md).
|
|
|
|
## Data modules
|
|
|
|
- Shared zod schemas for MDX components should use HTML heading levels
|
|
(`'h2'|'h3'|'h4'`), not markdown marker strings (`'##'`). Markdown markers
|
|
belong only in `internals/markdown-schema/` handlers (via a `Record`/`Map`
|
|
lookup).
|
|
- `getXById(id)` lookups belong in `*.utils.ts`, not in the data file or the
|
|
schema file. Schema files hold schemas; data files hold data; utils hold
|
|
functions.
|
|
- Each `.data.ts` exports named groups; the topic `index.ts` aggregates them
|
|
into a `Record<id, group>` map. The aggregation file is the single source
|
|
of truth for "all valid IDs."
|
|
|
|
## URL handling
|
|
|
|
- External-link detection is **not** just `/^https?:\/\//`. Protocol-relative
|
|
(`//host`), `mailto:`, `tel:`, custom schemes — all external. Prefer
|
|
`new URL(href, base)` or a broader regex.
|
|
- `withDocsBasePath('/guides/foo')` → `/docs/guides/foo`. Already-prefixed
|
|
URLs are passed through. Use it consistently in markdown output to avoid
|
|
broken links.
|
|
|
|
|
|
## Build / CI
|
|
|
|
- `pnpm build --filter=docs` runs markdown generation. A failure in
|
|
`generate-guides-markdown.ts` blocks the build — read its console output
|
|
rather than the cryptic CI error.
|
|
- `pnpm format` from the repo root catches most oxfmt drift. Run it
|
|
before opening a PR; CI is unforgiving.
|
|
- Auto-import sorting can silently shuffle imports across files you didn't
|
|
touch. Reset those files (`git checkout master -- <path>`) before pushing.
|
|
|
|
## Federated docs
|
|
|
|
See [`federated-docs.md`](./federated-docs.md) for the full surface — the
|
|
short version:
|
|
|
|
- **No GitHub App credentials in dev** = `$CodeSample` shows a warning, not
|
|
real content. Don't assume the page is broken.
|
|
- **`pageMap` is manual.** Upstream renames break links until a maintainer
|
|
updates the route file.
|
|
- **Wrappers pin to release tags** (`docs_v*.*.*`). If tagging breaks
|
|
upstream, build fails.
|
|
- **Search and federated content interact poorly** — search infrastructure
|
|
is currently decoupled from the markdown generation. See
|
|
[`docs-app-direction.md`](./docs-app-direction.md).
|
|
|
|
## Reference pages
|
|
|
|
- SDK and CLI reference pages **don't go through the standard MDX path** —
|
|
they're too long for the AST parser in preview environments. Generated
|
|
from `spec/` instead, output to `features/docs/generated/**`.
|
|
- Reference page length is a known UX/LLM problem. Long-term plan: split
|
|
into smaller modular pages. Management API is already one endpoint per
|
|
page (DOCS-1268); see [`management-api-reference.md`](./management-api-reference.md).
|
|
- Management API Redocly bundle **omits `--dereferenced`** because of a
|
|
circular `$ref`. Don't "fix" that by adding `--dereferenced` without
|
|
checking codegen's cycle-safe `resolveRefs`.
|
|
- Don't propose Scalar/Redoc/Elements as the Management API page UI
|
|
without covering markdown export, search, and `x-*` extension fields.
|
|
|
|
## PR hygiene
|
|
|
|
- No incidental import reorders or whitespace edits in a feature PR. Reset
|
|
files that are conceptually unchanged.
|
|
- When resetting unrelated files (`git checkout master -- <path>`), verify the
|
|
result matches current `master` — rebases can resurrect stale file versions.
|
|
- File names must match the primary export. Rename rather than aliasing on
|
|
import.
|
|
- Single-use helpers stay in the consuming file. Don't add new files in
|
|
unrelated folders for one-shot utilities.
|
|
- Two components with the same JSX shape and different classes → collapse
|
|
with a discriminator prop. Don't ship near-duplicates.
|