mirror of
https://github.com/supabase/agent-skills.git
synced 2026-03-27 10:09:26 +08:00
second refactor
This commit is contained in:
@@ -10,100 +10,10 @@ January 2026
|
||||
|
||||
## Abstract
|
||||
|
||||
Comprehensive Supabase development guide for building applications with Supabase services. Contains guides across 8 categories covering Auth, Database, Storage, Edge Functions, Realtime, client libraries, CLI, and tooling. Each reference includes setup instructions, code examples, common mistakes, and integration patterns.
|
||||
Comprehensive Supabase development guide for building applications with Supabase services. Contains guides covering Auth, Database, Storage, Edge Functions, Realtime, client libraries, CLI, and tooling. Each reference includes setup instructions, code examples, common mistakes, and integration patterns.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Getting Started](#getting-started) - **CRITICAL**
|
||||
|
||||
2. [Auth](#auth) - **CRITICAL**
|
||||
|
||||
3. [Database](#database) - **CRITICAL**
|
||||
|
||||
4. [Storage](#storage) - **HIGH**
|
||||
|
||||
5. [Edge Functions](#edge-functions) - **HIGH**
|
||||
|
||||
6. [Realtime](#realtime) - **MEDIUM-HIGH**
|
||||
|
||||
7. [Client Libraries](#client-libraries) - **MEDIUM**
|
||||
|
||||
8. [CLI & Tools](#cli-tools) - **LOW-MEDIUM**
|
||||
|
||||
---
|
||||
|
||||
## 1. Getting Started
|
||||
|
||||
**Impact: CRITICAL**
|
||||
|
||||
Project setup, connection strings, initial configuration, and first steps with Supabase.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 2. Auth
|
||||
|
||||
**Impact: CRITICAL**
|
||||
|
||||
Authentication, authorization, Row Level Security, social login, and session management.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 3. Database
|
||||
|
||||
**Impact: CRITICAL**
|
||||
|
||||
Postgres database, migrations, queries, RLS policies, and data modeling.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 4. Storage
|
||||
|
||||
**Impact: HIGH**
|
||||
|
||||
File uploads, buckets, access control, and media handling.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 5. Edge Functions
|
||||
|
||||
**Impact: HIGH**
|
||||
|
||||
Serverless functions, Deno runtime, webhooks, and background tasks.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 6. Realtime
|
||||
|
||||
**Impact: MEDIUM-HIGH**
|
||||
|
||||
Real-time subscriptions, presence, broadcast, and live updates.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 7. Client Libraries
|
||||
|
||||
**Impact: MEDIUM**
|
||||
|
||||
supabase-js SDK, client configuration, and framework integrations.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 8. CLI & Tools
|
||||
|
||||
**Impact: LOW-MEDIUM**
|
||||
|
||||
Supabase CLI, local development, migrations, CI/CD, and MCP integration.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## References
|
||||
|
||||
- https://supabase.com/docs
|
||||
- https://supabase.com/docs/guides/getting-started
|
||||
- https://supabase.com/docs/guides/auth
|
||||
- https://supabase.com/docs/guides/database
|
||||
- https://supabase.com/docs/guides/storage
|
||||
- https://supabase.com/docs/guides/functions
|
||||
- https://supabase.com/docs/guides/realtime
|
||||
|
||||
70
skills/supabase/GETTING_STARTED.md
Normal file
70
skills/supabase/GETTING_STARTED.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Getting Started
|
||||
|
||||
Welcome! This guide walks you through adding your product's content to the Supabase Agent Skills.
|
||||
|
||||
## Quick Start
|
||||
|
||||
After creating your branch, follow these steps:
|
||||
|
||||
### 1. Create Your Reference File
|
||||
|
||||
Create a new markdown file in `references/`:
|
||||
|
||||
```bash
|
||||
# Main topic file
|
||||
references/{product-name}.md
|
||||
|
||||
# Sub-topics (optional)
|
||||
references/{product-name}/{subtopic}.md
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
- `references/auth.md` - Main auth documentation
|
||||
- `references/auth/nextjs-setup.md` - Auth setup for Next.js
|
||||
- `references/storage.md` - Storage overview
|
||||
- `references/storage/upload-files.md` - File upload guide
|
||||
|
||||
### 2. Write Your Content
|
||||
|
||||
Use `references/_template.md` as your starting point. Include:
|
||||
|
||||
1. **Title** - Clear heading describing the topic
|
||||
2. **Overview** - Brief explanation of what this covers
|
||||
3. **Code examples** - Show how to use the feature
|
||||
4. **Common patterns** - Real-world usage scenarios
|
||||
5. **Documentation links** - Link to official docs
|
||||
|
||||
### 3. Update SKILL.md
|
||||
|
||||
Add your reference to the resources table in `SKILL.md`:
|
||||
|
||||
```markdown
|
||||
| Area | Resource | When to Use |
|
||||
| -------------- | ------------------------- | ------------------------ |
|
||||
| Your Feature | `references/feature.md` | Description of when |
|
||||
```
|
||||
|
||||
### 4. Validate and Build
|
||||
|
||||
```bash
|
||||
npm run validate -- supabase # Check your files
|
||||
npm run build -- supabase # Generate AGENTS.md
|
||||
npm run check # Format code
|
||||
```
|
||||
|
||||
## Writing Guidelines
|
||||
|
||||
- **Be practical** - Show real code, not abstract concepts
|
||||
- **Be complete** - Include imports and full setup when helpful
|
||||
- **Use semantic names** - `userProfile`, `bucketName`, not `data`, `x`
|
||||
- **Link to docs** - Reference official documentation
|
||||
- **Show patterns** - Demonstrate common use cases
|
||||
|
||||
## Existing References
|
||||
|
||||
Check the `references/` directory for examples of existing content.
|
||||
|
||||
## Questions?
|
||||
|
||||
Open an issue or reach out to the AI team.
|
||||
@@ -1,238 +0,0 @@
|
||||
# Product Team Contribution Guide
|
||||
|
||||
This document provides step-by-step instructions for adding your product's content to the Supabase Agent Skills.
|
||||
|
||||
## Structure Overview
|
||||
|
||||
This skill follows the [Agent Skills Open Standard](https://agentskills.io/specification):
|
||||
|
||||
```
|
||||
skills/supabase/
|
||||
├── SKILL.md # Entry point (update when adding sections)
|
||||
├── AGENTS.md # [GENERATED] Do not edit directly
|
||||
└── references/
|
||||
├── _sections.md # Section definitions
|
||||
├── _template.md # Reference template
|
||||
├── _contributing.md # Writing guidelines
|
||||
└── {prefix}-{name}.md # Your reference files
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 1: Setup Your Branch
|
||||
|
||||
```bash
|
||||
git checkout main
|
||||
git pull origin main
|
||||
git checkout -b feature/supabase-skill-{your-product}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 2: Identify Your Section
|
||||
|
||||
Check `references/_sections.md` for your product's section and prefix:
|
||||
|
||||
| Product | Section | Prefix |
|
||||
| ---------------- | ------- | ----------- |
|
||||
| Getting Started | 1 | `setup` |
|
||||
| Auth | 2 | `auth` |
|
||||
| Database | 3 | `database` |
|
||||
| Storage | 4 | `storage` |
|
||||
| Edge Functions | 5 | `functions` |
|
||||
| Realtime | 6 | `realtime` |
|
||||
| Client Libraries | 7 | `client` |
|
||||
| CLI & Tools | 8 | `cli` |
|
||||
|
||||
---
|
||||
|
||||
## Step 3: Create Your Reference Files
|
||||
|
||||
Copy the template and create reference files:
|
||||
|
||||
```bash
|
||||
cp references/_template.md references/{prefix}-{topic}.md
|
||||
```
|
||||
|
||||
**Example file names:**
|
||||
|
||||
- `auth-nextjs-setup.md` - Next.js authentication setup
|
||||
- `auth-rls-policies.md` - Row Level Security patterns
|
||||
- `storage-upload-files.md` - File upload guide
|
||||
- `functions-deploy.md` - Edge Functions deployment
|
||||
|
||||
---
|
||||
|
||||
## Step 4: Fill In the Template
|
||||
|
||||
Each reference file must have:
|
||||
|
||||
### Required Frontmatter
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: Set Up Authentication with Next.js
|
||||
impact: HIGH
|
||||
impactDescription: Enables secure user authentication in 5 minutes
|
||||
tags: auth, nextjs, setup, authentication
|
||||
---
|
||||
```
|
||||
|
||||
### Required Content
|
||||
|
||||
```markdown
|
||||
## Set Up Authentication with Next.js
|
||||
|
||||
Brief explanation of what this guide covers and why it matters.
|
||||
|
||||
**Incorrect (describe the problem):**
|
||||
|
||||
\`\`\`typescript
|
||||
// Bad pattern with explanation
|
||||
\`\`\`
|
||||
|
||||
**Correct (describe the solution):**
|
||||
|
||||
\`\`\`typescript
|
||||
// Good pattern with explanation
|
||||
\`\`\`
|
||||
|
||||
Reference: [Supabase Auth Docs](https://supabase.com/docs/guides/auth)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 5: Content Guidelines
|
||||
|
||||
### DO:
|
||||
|
||||
- Use concrete TypeScript/JavaScript examples
|
||||
- Show **Incorrect** vs **Correct** patterns
|
||||
- Include error messages developers might encounter
|
||||
- Keep examples under 30 lines each
|
||||
- Add comments explaining _why_, not _what_
|
||||
|
||||
### DON'T:
|
||||
|
||||
- Duplicate official documentation verbatim
|
||||
- Include time-sensitive content (versions, dates)
|
||||
- Assume prior Supabase knowledge
|
||||
- Use placeholder names like `foo`, `bar`, `data`
|
||||
|
||||
---
|
||||
|
||||
## Step 6: Validate and Build
|
||||
|
||||
```bash
|
||||
# Validate your reference files
|
||||
npm run validate -- supabase
|
||||
|
||||
# Build AGENTS.md
|
||||
npm run build -- supabase
|
||||
|
||||
# Run formatting
|
||||
npm run check
|
||||
```
|
||||
|
||||
Fix any validation errors before proceeding.
|
||||
|
||||
---
|
||||
|
||||
## Step 7: Open Pull Request
|
||||
|
||||
```bash
|
||||
git add skills/supabase/references/
|
||||
git commit -m "feat(skill): add {your-product} references"
|
||||
git push origin feature/supabase-skill-{your-product}
|
||||
```
|
||||
|
||||
Open PR with:
|
||||
|
||||
- Summary of references added
|
||||
- List of files created
|
||||
- Any cross-references to other products
|
||||
|
||||
---
|
||||
|
||||
## Step 8: Review Process
|
||||
|
||||
1. Product team member reviews for technical accuracy
|
||||
2. AI team reviews for skill format compliance
|
||||
3. CI validates and builds
|
||||
4. Merge to main
|
||||
|
||||
---
|
||||
|
||||
## Impact Level Guidelines
|
||||
|
||||
Choose the appropriate impact level:
|
||||
|
||||
| Level | Use For |
|
||||
| ----------- | ------------------------------------------------------ |
|
||||
| CRITICAL | Security issues, auth bypasses, data exposure |
|
||||
| HIGH | Core setup, essential patterns, breaking changes |
|
||||
| MEDIUM-HIGH | Common mistakes, integration gotchas |
|
||||
| MEDIUM | Best practices, optimization tips |
|
||||
| LOW-MEDIUM | Configuration options, tooling tips |
|
||||
| LOW | Advanced patterns, edge cases |
|
||||
|
||||
---
|
||||
|
||||
## Example Reference
|
||||
|
||||
Here's a complete example reference file:
|
||||
|
||||
```markdown
|
||||
---
|
||||
title: Configure Supabase Client for Next.js App Router
|
||||
impact: HIGH
|
||||
impactDescription: Enables type-safe Supabase access in Server and Client Components
|
||||
tags: nextjs, app-router, client, setup
|
||||
---
|
||||
|
||||
## Configure Supabase Client for Next.js App Router
|
||||
|
||||
Next.js App Router requires separate client configurations for Server Components and Client Components due to different execution environments.
|
||||
|
||||
**Incorrect (single client for both environments):**
|
||||
|
||||
\`\`\`typescript
|
||||
// lib/supabase.ts
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
|
||||
// This client won't work correctly in Server Components
|
||||
export const supabase = createClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||
);
|
||||
\`\`\`
|
||||
|
||||
**Correct (separate clients for server and browser):**
|
||||
|
||||
\`\`\`typescript
|
||||
// lib/supabase/server.ts
|
||||
import { createServerClient } from "@supabase/ssr";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function createClient() {
|
||||
const cookieStore = await cookies();
|
||||
return createServerClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
{ cookies: { getAll: () => cookieStore.getAll() } }
|
||||
);
|
||||
}
|
||||
|
||||
// lib/supabase/client.ts
|
||||
import { createBrowserClient } from "@supabase/ssr";
|
||||
|
||||
export function createClient() {
|
||||
return createBrowserClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||
);
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
Reference: [Supabase SSR Docs](https://supabase.com/docs/guides/auth/server-side/nextjs)
|
||||
```
|
||||
@@ -1,116 +0,0 @@
|
||||
# Supabase - Contributor Guide
|
||||
|
||||
This skill contains Supabase development guides optimized for AI agents and LLMs. It follows the [Agent Skills Open Standard](https://agentskills.io/specification).
|
||||
|
||||
## Quick Start for Contributors
|
||||
|
||||
```bash
|
||||
# From repository root
|
||||
npm install
|
||||
|
||||
# Validate existing references
|
||||
npm run validate -- supabase
|
||||
|
||||
# Build AGENTS.md
|
||||
npm run build -- supabase
|
||||
```
|
||||
|
||||
## Creating a New Reference
|
||||
|
||||
1. **Choose a section prefix** based on the category (see `references/_sections.md`)
|
||||
|
||||
2. **Copy the template**:
|
||||
|
||||
```bash
|
||||
cp references/_template.md references/{prefix}-your-reference-name.md
|
||||
```
|
||||
|
||||
3. **Fill in the content** following the template structure
|
||||
|
||||
4. **Validate and build**:
|
||||
|
||||
```bash
|
||||
npm run validate -- supabase
|
||||
npm run build -- supabase
|
||||
```
|
||||
|
||||
5. **Review** the generated `AGENTS.md`
|
||||
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
skills/supabase/
|
||||
├── SKILL.md # Agent-facing skill manifest (required)
|
||||
├── AGENTS.md # [GENERATED] Compiled references document
|
||||
├── README.md # This file
|
||||
└── references/
|
||||
├── _template.md # Reference template
|
||||
├── _sections.md # Section definitions
|
||||
├── _contributing.md # Writing guidelines
|
||||
└── {prefix}-*.md # Individual references
|
||||
```
|
||||
|
||||
## Reference File Structure
|
||||
|
||||
See `references/_template.md` for the complete template. Key elements:
|
||||
|
||||
```markdown
|
||||
---
|
||||
title: Clear, Action-Oriented Title
|
||||
impact: CRITICAL|HIGH|MEDIUM-HIGH|MEDIUM|LOW-MEDIUM|LOW
|
||||
impactDescription: Specific benefit (e.g., "Prevents credential exposure")
|
||||
tags: relevant, keywords
|
||||
---
|
||||
|
||||
## [Title]
|
||||
|
||||
[1-2 sentence explanation]
|
||||
|
||||
**Incorrect (description):**
|
||||
|
||||
\`\`\`typescript
|
||||
// What not to do
|
||||
\`\`\`
|
||||
|
||||
**Correct (description):**
|
||||
|
||||
\`\`\`typescript
|
||||
// What to do instead
|
||||
\`\`\`
|
||||
|
||||
Reference: [Link](url)
|
||||
```
|
||||
|
||||
## Section Prefixes
|
||||
|
||||
| Section | Prefix | Examples |
|
||||
| ---------------- | ----------- | ------------------------------------- |
|
||||
| Getting Started | `setup` | `setup-project.md`, `setup-env.md` |
|
||||
| Auth | `auth` | `auth-nextjs.md`, `auth-rls.md` |
|
||||
| Database | `database` | `database-migrations.md` |
|
||||
| Storage | `storage` | `storage-upload.md` |
|
||||
| Edge Functions | `functions` | `functions-deploy.md` |
|
||||
| Realtime | `realtime` | `realtime-subscribe.md` |
|
||||
| Client Libraries | `client` | `client-setup.md` |
|
||||
| CLI & Tools | `cli` | `cli-local-dev.md` |
|
||||
|
||||
## Writing Guidelines
|
||||
|
||||
See `references/_contributing.md` for detailed guidelines. Key principles:
|
||||
|
||||
1. **Show concrete patterns** - "Use X instead of Y", not abstract advice
|
||||
2. **Error-first structure** - Show the problem before the solution
|
||||
3. **Quantify impact** - Include specific benefits
|
||||
4. **Self-contained examples** - Complete, runnable code
|
||||
5. **Semantic naming** - Use meaningful variable names
|
||||
|
||||
## Impact Levels
|
||||
|
||||
| Level | Use When |
|
||||
| ----------- | ------------------------------------------------------ |
|
||||
| CRITICAL | Security vulnerabilities, auth bypasses, data leaks |
|
||||
| HIGH | Core functionality, performance issues, best practices |
|
||||
| MEDIUM-HIGH | Integration patterns, common mistakes |
|
||||
| MEDIUM | Optimization, alternative approaches |
|
||||
| LOW-MEDIUM | Configuration tweaks, tooling setup |
|
||||
| LOW | Advanced patterns, edge cases |
|
||||
@@ -7,65 +7,72 @@ metadata:
|
||||
version: "1.0.0"
|
||||
organization: Supabase
|
||||
date: January 2026
|
||||
abstract: Comprehensive Supabase development guide for building applications with Supabase services. Contains guides across 8 categories covering Auth, Database, Storage, Edge Functions, Realtime, client libraries, CLI, and tooling. Each reference includes setup instructions, code examples, common mistakes, and integration patterns.
|
||||
abstract: Comprehensive Supabase development guide for building applications with Supabase services. Contains guides covering Auth, Database, Storage, Edge Functions, Realtime, client libraries, CLI, and tooling. Each reference includes setup instructions, code examples, common mistakes, and integration patterns.
|
||||
---
|
||||
|
||||
# Using Supabase
|
||||
# Supabase
|
||||
|
||||
Comprehensive development guide for building applications with Supabase, maintained by Supabase. Contains guides across 8 categories to help developers integrate Supabase services effectively.
|
||||
Supabase is an open source Firebase alternative that provides a Postgres database, authentication, instant APIs, edge functions, realtime subscriptions, and storage. It's fully compatible with Postgres and works with any language, framework, or ORM.
|
||||
|
||||
## When to Apply
|
||||
## Supabase Documentation
|
||||
|
||||
Reference these guidelines when:
|
||||
Always reference the Supabase documentation before making Supabase-related claims. The documentation is the source of truth for all Supabase-related information.
|
||||
|
||||
- Building applications with Supabase
|
||||
- Integrating Supabase services (Auth, Database, Storage, etc.)
|
||||
- Setting up local development with Supabase CLI
|
||||
- Troubleshooting Supabase-related issues
|
||||
- Configuring Supabase for production deployments
|
||||
- Using the supabase-js SDK
|
||||
You can use the `curl` commands to fetch the documentation page as markdown:
|
||||
|
||||
## Guide Categories by Priority
|
||||
**Documentation:**
|
||||
|
||||
| Priority | Category | Impact | Prefix |
|
||||
| -------- | ---------------- | ----------- | ----------- |
|
||||
| 1 | Getting Started | CRITICAL | `setup` |
|
||||
| 2 | Auth | CRITICAL | `auth` |
|
||||
| 3 | Database | CRITICAL | `database` |
|
||||
| 4 | Storage | HIGH | `storage` |
|
||||
| 5 | Edge Functions | HIGH | `functions` |
|
||||
| 6 | Realtime | MEDIUM-HIGH | `realtime` |
|
||||
| 7 | Client Libraries | MEDIUM | `client` |
|
||||
| 8 | CLI & Tools | LOW-MEDIUM | `cli` |
|
||||
|
||||
## How to Use
|
||||
|
||||
Read individual reference files for detailed explanations and code examples:
|
||||
|
||||
```
|
||||
references/setup-project.md
|
||||
references/auth-nextjs.md
|
||||
references/_sections.md
|
||||
```bash
|
||||
# Fetch any doc page as markdown
|
||||
curl -H "Accept: text/markdown" https://supabase.com/docs/<path>
|
||||
```
|
||||
|
||||
Each reference file contains:
|
||||
## Overview of Resources
|
||||
|
||||
- Brief explanation of the topic
|
||||
- Setup instructions and code examples
|
||||
- Common mistakes with wrong/correct patterns
|
||||
- Integration patterns with other Supabase services
|
||||
- Links to official documentation
|
||||
Reference the appropriate resource file based on the user's needs:
|
||||
|
||||
## Full Compiled Document
|
||||
### Core Guides
|
||||
|
||||
For the complete guide with all references expanded: `AGENTS.md`
|
||||
| Area | Resource | When to Use |
|
||||
| ---------------- | -------------------------------- | -------------------------------------------------------- |
|
||||
| Getting Started | `references/getting-started.md` | Setting up a project, connection strings, dependencies |
|
||||
| Referencing Docs | `references/referencing-docs.md` | Looking up official documentation, verifying information |
|
||||
|
||||
## References
|
||||
### Authentication & Security
|
||||
|
||||
- https://supabase.com/docs
|
||||
- https://supabase.com/docs/guides/getting-started
|
||||
- https://supabase.com/docs/guides/auth
|
||||
- https://supabase.com/docs/guides/database
|
||||
- https://supabase.com/docs/guides/storage
|
||||
- https://supabase.com/docs/guides/functions
|
||||
- https://supabase.com/docs/guides/realtime
|
||||
| Area | Resource | When to Use |
|
||||
| ------------------ | -------------------- | ------------------------------------------ |
|
||||
| Auth Overview | `references/auth.md` | Authentication, social login, sessions |
|
||||
| Row Level Security | `references/rls.md` | Database security policies, access control |
|
||||
|
||||
### Database
|
||||
|
||||
| Area | Resource | When to Use |
|
||||
| -------- | ------------------------ | -------------------------------------- |
|
||||
| Database | `references/database.md` | Postgres queries, migrations, modeling |
|
||||
|
||||
### Storage & Media
|
||||
|
||||
| Area | Resource | When to Use |
|
||||
| ------- | ----------------------- | ---------------------------- |
|
||||
| Storage | `references/storage.md` | File uploads, buckets, media |
|
||||
|
||||
### Edge Functions
|
||||
|
||||
| Area | Resource | When to Use |
|
||||
| -------------- | ------------------------------ | -------------------------------------------- |
|
||||
| Edge Functions | `references/edge-functions.md` | Serverless functions, Deno runtime, webhooks |
|
||||
|
||||
### Realtime
|
||||
|
||||
| Area | Resource | When to Use |
|
||||
| -------- | ------------------------ | -------------------------------------------- |
|
||||
| Realtime | `references/realtime.md` | Real-time subscriptions, presence, broadcast |
|
||||
|
||||
### Client Libraries & CLI
|
||||
|
||||
| Area | Resource | When to Use |
|
||||
| ------------ | --------------------------- | ---------------------------------------- |
|
||||
| supabase-js | `references/supabase-js.md` | JavaScript/TypeScript SDK, client config |
|
||||
| Supabase CLI | `references/cli.md` | Local development, migrations, CI/CD |
|
||||
| MCP Server | `references/mcp.md` | AI agent integration, MCP tooling |
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
# Writing Guidelines for Supabase References
|
||||
|
||||
This document provides guidelines for creating effective Supabase development
|
||||
guides that work well with AI agents and LLMs.
|
||||
|
||||
## Key Principles
|
||||
|
||||
### 1. Concrete Examples Over Abstract Advice
|
||||
|
||||
Show exact code patterns. Avoid philosophical guidance.
|
||||
|
||||
**Good:** "Use `createClient()` with environment variables"
|
||||
**Bad:** "Configure your client properly"
|
||||
|
||||
### 2. Error-First Structure
|
||||
|
||||
Always show the problematic pattern first, then the solution. This trains agents
|
||||
to recognize anti-patterns.
|
||||
|
||||
```markdown
|
||||
**Incorrect (hardcoded credentials):** [bad example]
|
||||
|
||||
**Correct (environment variables):** [good example]
|
||||
```
|
||||
|
||||
### 3. Quantified Impact
|
||||
|
||||
Include specific benefits. Helps agents prioritize recommendations.
|
||||
|
||||
**Good:** "Reduces bundle size by 40%", "Prevents credential exposure"
|
||||
**Bad:** "Better", "More secure", "Recommended"
|
||||
|
||||
### 4. Self-Contained Examples
|
||||
|
||||
Examples should be complete and runnable. Include imports and setup when needed.
|
||||
|
||||
```typescript
|
||||
// Include imports for clarity
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
|
||||
// Show complete setup
|
||||
const supabase = createClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||
);
|
||||
```
|
||||
|
||||
### 5. Semantic Naming
|
||||
|
||||
Use meaningful variable/function names. Names carry intent for LLMs.
|
||||
|
||||
**Good:** `supabase`, `authClient`, `userProfile`, `bucketName`
|
||||
**Bad:** `client1`, `data`, `result`, `x`
|
||||
|
||||
---
|
||||
|
||||
## Code Example Standards
|
||||
|
||||
### TypeScript Formatting
|
||||
|
||||
```typescript
|
||||
// Use clear formatting and proper typing
|
||||
const { data, error } = await supabase
|
||||
.from("users")
|
||||
.select("id, email, created_at")
|
||||
.eq("is_active", true);
|
||||
|
||||
// Not cramped
|
||||
const { data, error } = await supabase.from("users").select("*").eq("is_active", true);
|
||||
```
|
||||
|
||||
### Comments
|
||||
|
||||
- Explain _why_, not _what_
|
||||
- Highlight security implications
|
||||
- Point out common pitfalls
|
||||
|
||||
### Language Tags
|
||||
|
||||
- `typescript` - TypeScript/JavaScript code (preferred)
|
||||
- `javascript` - Plain JavaScript when TS isn't appropriate
|
||||
- `sql` - Database queries, RLS policies
|
||||
- `bash` - CLI commands, environment setup
|
||||
|
||||
---
|
||||
|
||||
## Framework-Specific Guides
|
||||
|
||||
When creating guides for specific frameworks, include:
|
||||
|
||||
1. **Installation command** - `npm install @supabase/supabase-js`
|
||||
2. **Environment variables** - Required `.env` configuration
|
||||
3. **Client setup** - Framework-specific initialization
|
||||
4. **Common mistakes** - Framework-specific pitfalls
|
||||
|
||||
### Supported Frameworks
|
||||
|
||||
Prefix reference files appropriately:
|
||||
|
||||
- `auth-nextjs.md` - Next.js App Router
|
||||
- `auth-react.md` - React SPA
|
||||
- `auth-remix.md` - Remix
|
||||
- `client-nuxt.md` - Nuxt/Vue
|
||||
|
||||
---
|
||||
|
||||
## Impact Level Guidelines
|
||||
|
||||
| Level | Use When |
|
||||
| --------------- | ----------------------------------------------------- |
|
||||
| **CRITICAL** | Security vulnerabilities, auth bypasses, data leaks |
|
||||
| **HIGH** | Core functionality, performance issues, best practices|
|
||||
| **MEDIUM-HIGH** | Integration patterns, common mistakes |
|
||||
| **MEDIUM** | Optimization, alternative approaches |
|
||||
| **LOW-MEDIUM** | Configuration tweaks, tooling setup |
|
||||
| **LOW** | Advanced patterns, edge cases |
|
||||
|
||||
---
|
||||
|
||||
## Reference Standards
|
||||
|
||||
**Primary Sources:**
|
||||
|
||||
- Supabase documentation (https://supabase.com/docs)
|
||||
- Supabase GitHub examples
|
||||
- Framework-specific documentation
|
||||
|
||||
**Format:**
|
||||
|
||||
```markdown
|
||||
Reference: [Supabase Auth Docs](https://supabase.com/docs/guides/auth)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Review Checklist
|
||||
|
||||
Before submitting a reference:
|
||||
|
||||
- [ ] Title is clear and action-oriented
|
||||
- [ ] Impact level matches the importance
|
||||
- [ ] impactDescription includes specific benefit
|
||||
- [ ] Explanation is concise (1-2 sentences)
|
||||
- [ ] Has at least 1 **Incorrect** code example
|
||||
- [ ] Has at least 1 **Correct** code example
|
||||
- [ ] Code uses semantic naming
|
||||
- [ ] Comments explain _why_, not _what_
|
||||
- [ ] Trade-offs mentioned if applicable
|
||||
- [ ] Reference links included
|
||||
- [ ] `npm run validate` passes
|
||||
- [ ] `npm run build` generates correct output
|
||||
@@ -1,37 +0,0 @@
|
||||
# Section Definitions
|
||||
|
||||
This file defines the reference categories for Supabase development guides. References are automatically assigned to sections based on their filename prefix.
|
||||
|
||||
---
|
||||
|
||||
## 1. Getting Started (setup)
|
||||
**Impact:** CRITICAL
|
||||
**Description:** Project setup, connection strings, initial configuration, and first steps with Supabase.
|
||||
|
||||
## 2. Auth (auth)
|
||||
**Impact:** CRITICAL
|
||||
**Description:** Authentication, authorization, Row Level Security, social login, and session management.
|
||||
|
||||
## 3. Database (database)
|
||||
**Impact:** CRITICAL
|
||||
**Description:** Postgres database, migrations, queries, RLS policies, and data modeling.
|
||||
|
||||
## 4. Storage (storage)
|
||||
**Impact:** HIGH
|
||||
**Description:** File uploads, buckets, access control, and media handling.
|
||||
|
||||
## 5. Edge Functions (functions)
|
||||
**Impact:** HIGH
|
||||
**Description:** Serverless functions, Deno runtime, webhooks, and background tasks.
|
||||
|
||||
## 6. Realtime (realtime)
|
||||
**Impact:** MEDIUM-HIGH
|
||||
**Description:** Real-time subscriptions, presence, broadcast, and live updates.
|
||||
|
||||
## 7. Client Libraries (client)
|
||||
**Impact:** MEDIUM
|
||||
**Description:** supabase-js SDK, client configuration, and framework integrations.
|
||||
|
||||
## 8. CLI & Tools (cli)
|
||||
**Impact:** LOW-MEDIUM
|
||||
**Description:** Supabase CLI, local development, migrations, CI/CD, and MCP integration.
|
||||
@@ -1,33 +1,53 @@
|
||||
---
|
||||
title: Clear, Action-Oriented Title (e.g., "Set Up Authentication with Next.js")
|
||||
impact: MEDIUM
|
||||
impactDescription: Enables secure user authentication in minutes
|
||||
title: Clear, Action-Oriented Title (e.g., "Authentication with Next.js")
|
||||
tags: auth, nextjs, setup
|
||||
---
|
||||
|
||||
## [Reference Title]
|
||||
# [Feature/Topic Name]
|
||||
|
||||
[1-2 sentence explanation of what this guide covers and why it matters.]
|
||||
Brief description of what this feature does and when to use it.
|
||||
|
||||
**Incorrect (describe the problem):**
|
||||
For official documentation:
|
||||
|
||||
```typescript
|
||||
// Comment explaining what makes this problematic
|
||||
const supabase = createClient("https://xxx.supabase.co", "hardcoded-key");
|
||||
// Hardcoded credentials are a security risk
|
||||
```bash
|
||||
curl -H "Accept: text/markdown" https://supabase.com/docs/guides/{feature}
|
||||
```
|
||||
|
||||
**Correct (describe the solution):**
|
||||
## Quick Setup
|
||||
|
||||
```typescript
|
||||
// Comment explaining why this is better
|
||||
const supabase = createClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||
);
|
||||
// Environment variables keep credentials secure
|
||||
// Installation and basic usage
|
||||
```
|
||||
|
||||
[Optional: Additional context, setup steps, or configuration details]
|
||||
## Common Patterns
|
||||
|
||||
Reference: [Supabase Docs](https://supabase.com/docs)
|
||||
### Pattern 1
|
||||
|
||||
```typescript
|
||||
// Code example
|
||||
```
|
||||
|
||||
### Pattern 2
|
||||
|
||||
```typescript
|
||||
// Code example
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
1. **Mistake description**: Brief explanation and how to fix it
|
||||
2. **Another common issue**: Explanation
|
||||
|
||||
## Sub-Resources
|
||||
|
||||
| Topic | Resource |
|
||||
| ----------- | ------------------------------ |
|
||||
| Setup guide | `{feature}/setup.md` |
|
||||
| Mistakes | `{feature}/common-mistakes.md` |
|
||||
|
||||
## Documentation Resources
|
||||
|
||||
| Topic | URL |
|
||||
| --------------- | ------------------------------------------ |
|
||||
| Official Guide | https://supabase.com/docs/guides/{feature} |
|
||||
| API Reference | https://supabase.com/docs/reference |
|
||||
|
||||
Reference in New Issue
Block a user