Reverts supabase/supabase#48144
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Documentation generation now surfaces missing or unreadable AI skills
and Terraform schema data instead of silently producing empty sections.
* This improves visibility into incomplete documentation builds and
helps ensure generated reference content is available and accurate.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Ali Waseem <waseema393@gmail.com>
<!-- ccr-slack-attribution -->
_Requested by **Ivan Vasilov** · [Slack
thread](https://supabase.slack.com/archives/C0161K73J1J/p1784639352877839?thread_ts=1784625513.046239&cid=C0161K73J1J)_
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.
YES
## What kind of change does this PR introduce?
Bug fix.
## What is the current behavior?
Running `pnpm --filter=docs run build:guides-markdown` standalone — as
`apps/www`'s prebuild does, without first running
`build:federated-content` — crashes with `ENOENT ... ai-skills.json`
(and the equivalent for `terraform.schema.json`).
The `AiSkillsIndex` and `TerraformProviderSchema` markdown-schema
handlers `readFileSync` a gitignored, build-time-generated JSON artifact
unconditionally. In the full docs build these files exist because
`build:federated-content` runs first (via the docs `prebuild`), but in
the standalone / www path they do not, so the read throws.
These unguarded reads were introduced in #48045 (ai-skills) and #48010
(terraform), which surfaced as the www Vercel build failure.
## What is the new behavior?
Both handlers now render an empty section (return an empty string) when
the generated artifact is absent, so `build:guides-markdown` succeeds in
the standalone / www path.
When the artifact IS present (the full docs build, which runs
`build:federated-content` first), behavior is byte-for-byte unchanged —
the file is parsed and rendered exactly as before. The full docs build
is not affected.
## Additional context
Implemented with a minimal `existsSync` guard (from the already-imported
`node:fs`) in each handler:
- `apps/docs/internals/markdown-schema/AiSkillsIndex.ts`
- `apps/docs/internals/markdown-schema/TerraformProviderSchema.ts`
No changes to any `package.json`, `.gitignore`, or the generators — the
fix is confined to the two handlers.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01RynCtzP874KrpN8CPf7n7n)_
Co-authored-by: Claude <noreply@anthropic.com>