Repository navigation
feat: Add ai-skills federated content and data - #48045
jeremenichelli merged 2 commits into
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAI skill metadata is generated into a local JSON file, consumed by the guide UI, and transformed into Markdown through a registered schema handler. The UI now uses headings and code blocks instead of a table and copy button. ChangesAI skills content pipeline
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant GitHub
participant FederatedContent
participant GeneratedJSON
participant AiSkillsGuide
GitHub->>FederatedContent: Provide skill directories and SKILL.md files
FederatedContent->>GeneratedJSON: Write ai-skills.json
AiSkillsGuide->>GeneratedJSON: Read skill summaries
GeneratedJSON-->>AiSkillsGuide: Return parsed skills
AiSkillsGuide-->>AiSkillsGuide: Render descriptions and install commands
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/docs/internals/markdown-schema/AiSkillsIndex.ts (1)
1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse
GENERATED_DIRECTORYfor this cross-layer path contract.Reconstructing the path here can silently diverge from the producer and runtime consumer when the generated directory moves.
Proposed refactor
import { readFileSync } from 'node:fs' import path from 'node:path' +import { GENERATED_DIRECTORY } from '~/lib/docs' -const SKILLS_PATH = path.join(process.cwd(), 'features/docs/generated/ai-skills.json') +const SKILLS_PATH = path.join(GENERATED_DIRECTORY, 'ai-skills.json')🤖 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/internals/markdown-schema/AiSkillsIndex.ts` around lines 1 - 4, Update the path construction near SKILLS_PATH to reuse the existing GENERATED_DIRECTORY symbol instead of rebuilding the generated-directory path from process.cwd() and a hardcoded segment. Preserve the ai-skills.json filename while aligning this reader with the producer and runtime consumer path contract.
🤖 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/federated-content/fetch-federated-content.ts`:
- Around line 155-170: Validate item.name against the repository’s safe
skill-slug format before constructing the installCommand in the skills mapping;
reject or skip invalid directory names rather than embedding them. Ensure only
validated names are interpolated into the executable command and preserve the
existing behavior for valid skill names.
---
Nitpick comments:
In `@apps/docs/internals/markdown-schema/AiSkillsIndex.ts`:
- Around line 1-4: Update the path construction near SKILLS_PATH to reuse the
existing GENERATED_DIRECTORY symbol instead of rebuilding the
generated-directory path from process.cwd() and a hardcoded segment. Preserve
the ai-skills.json filename while aligning this reader with the producer and
runtime consumer path contract.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: de6bc95c-75f9-4b25-b8b8-f1ee7c17ef5f
📒 Files selected for processing (7)
apps/docs/app/guides/getting-started/ai-skills/AiSkills.utils.tsapps/docs/app/guides/getting-started/ai-skills/AiSkillsIndex.tsxapps/docs/app/guides/getting-started/ai-skills/CopyButton.tsxapps/docs/internals/generate-guides-markdown.tsapps/docs/internals/markdown-schema/AiSkillsIndex.tsapps/docs/lib/docs.tsapps/docs/scripts/federated-content/fetch-federated-content.ts
💤 Files with no reviewable changes (1)
- apps/docs/app/guides/getting-started/ai-skills/CopyButton.tsx
czenko
left a comment
There was a problem hiding this comment.
Ran through the test and this worked as expected.
Left non-blocking notes.
| return skills | ||
| .map( | ||
| (skill) => | ||
| `### ${skill.name}\n\n${skill.description}\n\n\`\`\`sh\n${skill.installCommand}\n\`\`\`` |
There was a problem hiding this comment.
Agree that this formatting is much nicer than the table.
Would be nice if this was written in code to be more human readable, too. You can instead drop the \n escapes and let the string's actual line breaks mirror the markdown output.
| const SKILLS_PATH = path.join(process.cwd(), 'features/docs/generated/ai-skills.json') | ||
|
|
||
| interface SkillSummary { | ||
| name: string | ||
| description: string | ||
| installCommand: string | ||
| } | ||
|
|
||
| export const AiSkillsIndex = (): string => { | ||
| const skills: SkillSummary[] = JSON.parse(readFileSync(SKILLS_PATH, 'utf-8')) |
| } | ||
|
|
||
| const AI_SKILLS_REPO = { | ||
| org: 'supabase', |
There was a problem hiding this comment.
Two thoughts:
- (nit) Should
orghave a default value of 'supabase' so this does not have to be defined each time, assuming this gets hoisted into something shared? - There is already a
SKILLS_REPOthat is a separate but identical object literal. Renaming could introduce a bug. Could hoist this into a shared constant.
There was a problem hiding this comment.
(nit) Should org have a default value of 'supabase' so this does not have to be defined each time, assuming this gets hoisted into something shared?
Having that set makes type checking more robust, but I get your point.
There is already a SKILLS_REPO that is a separate but identical object literal. Renaming could introduce a bug. Could hoist this into a shared constant.
That's a good one, let me see if I can re-use some of it.
|
|
||
| /** | ||
| * Lists the skill directories in the agent-skills repo, fetches each | ||
| * `SKILL.md`'s frontmatter, and writes the summary to |
There was a problem hiding this comment.
Strange to me that the SKILL itself is the documentation. Its audience is Claude but not necessarily humans.
There was a problem hiding this comment.
Sadly that's the name the file has in the repo and we are not in control of that.
| </div> | ||
| <> | ||
| {skills.map((skill) => ( | ||
| <div key={skill.name}> |
There was a problem hiding this comment.
[nit]:
{skills.map((skill, index) => (
<div key={index}>
....
</div>
))}
There was a problem hiding this comment.
Actually, it's not recommended to use index as key in React, doesn't change much in this case because the position of the elements it's not tied to a React state value, but if you use index and you mutate an Iterable React won't know if the element actually changed. Having a unique string is way better than using index.
Further reading: https://robinpokorny.com/blog/index-as-a-key-is-an-anti-pattern/
Rodriguespn
left a comment
There was a problem hiding this comment.
The agent skills page looks good, great job! One note is that changing from a table view to a list/section view can make the page more extensive as we add more skills to the agent skills repo (not planned and we're actually going to avoid adding more and pack everything into suoabase agent skill and the docs).
Another thing to have into consideration from now kn is that the agent skill description in the frontmatter is now used also as the description in the docs page. Nothing against it, as the agent skill description are short, one liners and action driven (usually have action verbs like "use"). Just one thing to have in mind
|
Thanks for your input @Rodriguespn, addressing some of your comments.
That was already in use, it was the second column of the table. Now it's just a normal paragraph.
Not a problem. We will think of that when we have that problem, for now, we are more than good. |
Braintrust eval report
|
…nt (#48144) <!-- 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 <[email protected]>
…fomap-entry-for-pitr-archiving-stale' into hunleyd/indata-979-studio-lintinfomap-entry-for-pitr-archiving-stale * origin/hunleyd/indata-979-studio-lintinfomap-entry-for-pitr-archiving-stale: (35 commits) chore: simplify CPU messaging for compute sizes (#48109) chore(studio): add valtio and react-hook-form ESLint ratchet rules (#48037) feat: Add ai/python federated content and data (#48043) feat: Add ai-skills federated content and data (#48045) feat: Add deployment/ci federated content and data (#48041) fix(studio): wire up siwc-enabled query param opt-in on sign-in/sign-up (#48126) fix(studio): stop stacking overlaid area series in report charts (#48034) Update Dev toolbar to support filtering feature flags (#48137) Update dev toolbar to support mocking org restrictions (#48136) feat: Add terraform federated content and data (#48010) Chore/add sessions database connections (#48094) fix(studio): guard panel collapse/resize on narrow viewports (#48098) Landing page agent focus (#47989) fix(studio): chip away explicit-tabindex ratchet debt (#48040) fix(studio): untangle nested buttons in editor tabs (#48101) fix(docs): broken link (#48117) docs: add VS Code to the AI coding agent plugin install picker (#48108) docs: add Kimi Code to MCP and AI coding agent plugin setup (#48099) fix: preserve function responses (#47920) fix(assistant): SQL approval buttons do nothing (#48102) ...
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Adds support for AI Skills data fetching on
/docs/guides/ai-tools/ai-skillsroute to be fetched pre-build and provide complete markdown content.Small re-design on the section for better readability.
How to test:
.mdto the route, the server should return a markdown version of each page with all the content.About the re-design. See how in the table format the description is really hard to read because of the narrow space, and the command is cut off. Overall, a table is a really poor use of space for this type of content.
Before

After

Summary by CodeRabbit
Summary by CodeRabbit