mirror of
https://github.com/supabase/agent-skills.git
synced 2026-01-26 19:09:51 +08:00
Rename postgresql to postgres (keeping only existing files)
This commit is contained in:
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -1,15 +1,15 @@
|
||||
name: PostgreSQL Best Practices CI
|
||||
name: Postgres Best Practices CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'skills/postgresql-best-practices/**'
|
||||
- 'packages/postgresql-best-practices-build/**'
|
||||
- 'skills/postgres-best-practices/**'
|
||||
- 'packages/postgres-best-practices-build/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'skills/postgresql-best-practices/**'
|
||||
- 'packages/postgresql-best-practices-build/**'
|
||||
- 'skills/postgres-best-practices/**'
|
||||
- 'packages/postgres-best-practices-build/**'
|
||||
|
||||
jobs:
|
||||
validate-and-build:
|
||||
@@ -22,22 +22,22 @@ jobs:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: packages/postgresql-best-practices-build
|
||||
working-directory: packages/postgres-best-practices-build
|
||||
run: npm install
|
||||
|
||||
- name: Validate rule files
|
||||
working-directory: packages/postgresql-best-practices-build
|
||||
working-directory: packages/postgres-best-practices-build
|
||||
run: npm run validate
|
||||
|
||||
- name: Build AGENTS.md
|
||||
working-directory: packages/postgresql-best-practices-build
|
||||
working-directory: packages/postgres-best-practices-build
|
||||
run: npm run build
|
||||
|
||||
- name: Check for uncommitted changes
|
||||
run: |
|
||||
if [[ -n $(git status --porcelain skills/postgresql-best-practices/AGENTS.md) ]]; then
|
||||
if [[ -n $(git status --porcelain skills/postgres-best-practices/AGENTS.md) ]]; then
|
||||
echo "Error: AGENTS.md is not up to date"
|
||||
echo "Run 'npm run build' and commit the changes"
|
||||
git diff skills/postgresql-best-practices/AGENTS.md
|
||||
git diff skills/postgres-best-practices/AGENTS.md
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,7 @@ etc.) when working with code in this repository.
|
||||
|
||||
## Repository Overview
|
||||
|
||||
A collection of PostgreSQL best practices skills for Claude.ai and Claude Code,
|
||||
A collection of Postgres best practices skills for Claude.ai and Claude Code,
|
||||
maintained by Supabase. Skills are packaged instructions that extend agent
|
||||
capabilities for database optimization.
|
||||
|
||||
@@ -15,7 +15,7 @@ capabilities for database optimization.
|
||||
|
||||
```
|
||||
skills/
|
||||
postgresql-best-practices/
|
||||
postgres-best-practices/
|
||||
SKILL.md # Required: skill definition
|
||||
AGENTS.md # Generated: compiled rules
|
||||
metadata.json # Required: version and metadata
|
||||
@@ -26,7 +26,7 @@ skills/
|
||||
{prefix}-{name}.md # Individual rule files
|
||||
|
||||
packages/
|
||||
postgresql-best-practices-build/
|
||||
postgres-best-practices-build/
|
||||
src/ # Build system source
|
||||
package.json # NPM scripts
|
||||
```
|
||||
@@ -88,7 +88,7 @@ Skills are loaded on-demand. To minimize context usage:
|
||||
After creating or updating rules:
|
||||
|
||||
```bash
|
||||
cd packages/postgresql-best-practices-build
|
||||
cd packages/postgres-best-practices-build
|
||||
npm install
|
||||
npm run validate # Check rule format
|
||||
npm run build # Generate AGENTS.md
|
||||
|
||||
@@ -7,9 +7,9 @@ Skills follow the [Agent Skills](https://agentskills.io/) format.
|
||||
|
||||
## Available Skills
|
||||
|
||||
### postgresql-best-practices
|
||||
### postgres-best-practices
|
||||
|
||||
PostgreSQL performance optimization guidelines from Supabase. Contains rules
|
||||
Postgres performance optimization guidelines from Supabase. Contains rules
|
||||
across 8 categories, prioritized by impact.
|
||||
|
||||
**Use when:**
|
||||
@@ -39,7 +39,7 @@ relevant tasks are detected.
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
Optimize this PostgreSQL query
|
||||
Optimize this Postgres query
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "postgresql-best-practices-build",
|
||||
"name": "postgres-best-practices-build",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
@@ -60,7 +60,7 @@ function loadMetadata(): Metadata {
|
||||
version: "0.1.0",
|
||||
organization: "Supabase",
|
||||
date: new Date().toLocaleDateString("en-US", { month: "long", year: "numeric" }),
|
||||
abstract: "PostgreSQL performance optimization guide for developers.",
|
||||
abstract: "Postgres performance optimization guide for developers.",
|
||||
references: [],
|
||||
};
|
||||
}
|
||||
@@ -135,7 +135,7 @@ function buildAgents(): void {
|
||||
const output: string[] = [];
|
||||
|
||||
// Header
|
||||
output.push("# PostgreSQL Best Practices\n");
|
||||
output.push("# Postgres Best Practices\n");
|
||||
output.push(`**Version ${metadata.version}**`);
|
||||
output.push(`${metadata.organization}`);
|
||||
output.push(`${metadata.date}\n`);
|
||||
@@ -8,7 +8,7 @@ const __dirname = dirname(__filename);
|
||||
export const BUILD_DIR = join(__dirname, "..");
|
||||
|
||||
// Skill directory (relative to build package)
|
||||
export const SKILL_DIR = join(BUILD_DIR, "../../skills/postgresql-best-practices");
|
||||
export const SKILL_DIR = join(BUILD_DIR, "../../skills/postgres-best-practices");
|
||||
|
||||
// Rules directory
|
||||
export const RULES_DIR = join(SKILL_DIR, "rules");
|
||||
@@ -145,13 +145,13 @@ export function validateAllRules(): {
|
||||
const isMainModule = process.argv[1]?.endsWith("validate.ts") || process.argv[1]?.endsWith("validate.js");
|
||||
|
||||
if (isMainModule) {
|
||||
console.log("Validating PostgreSQL best practices rules...\n");
|
||||
console.log("Validating Postgres best practices rules...\n");
|
||||
|
||||
const { totalFiles, validFiles, invalidFiles, results } = validateAllRules();
|
||||
|
||||
if (totalFiles === 0) {
|
||||
console.log("No rule files found (this is expected for initial setup).");
|
||||
console.log("Create rule files in: skills/postgresql-best-practices/rules/");
|
||||
console.log("Create rule files in: skills/postgres-best-practices/rules/");
|
||||
console.log("Use the _template.md as a starting point.\n");
|
||||
process.exit(0);
|
||||
}
|
||||
107
skills/postgres-best-practices/AGENTS.md
Normal file
107
skills/postgres-best-practices/AGENTS.md
Normal file
@@ -0,0 +1,107 @@
|
||||
# PostgreSQL Best Practices
|
||||
|
||||
**Version 0.1.0**
|
||||
Supabase
|
||||
January 2026
|
||||
|
||||
> This document is optimized for AI agents and LLMs. Rules are prioritized by performance impact.
|
||||
|
||||
---
|
||||
|
||||
## Abstract
|
||||
|
||||
Comprehensive PostgreSQL performance optimization guide for developers using Supabase and PostgreSQL. Contains performance rules across 8 categories, prioritized by impact from critical (query performance, connection management) to incremental (advanced features). Each rule includes detailed explanations, incorrect vs. correct SQL examples, query plan analysis, and specific performance metrics to guide automated optimization and code generation.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Query Performance](#query-performance) - **CRITICAL**
|
||||
|
||||
2. [Connection Management](#connection-management) - **CRITICAL**
|
||||
|
||||
3. [Schema Design](#schema-design) - **HIGH**
|
||||
|
||||
4. [Concurrency & Locking](#concurrency-locking) - **MEDIUM-HIGH**
|
||||
|
||||
5. [Security & RLS](#security-rls) - **MEDIUM-HIGH**
|
||||
|
||||
6. [Data Access Patterns](#data-access-patterns) - **MEDIUM**
|
||||
|
||||
7. [Monitoring & Diagnostics](#monitoring-diagnostics) - **LOW-MEDIUM**
|
||||
|
||||
8. [Advanced Features](#advanced-features) - **LOW**
|
||||
|
||||
---
|
||||
|
||||
## 1. Query Performance
|
||||
|
||||
**Impact: CRITICAL**
|
||||
|
||||
Slow queries, missing indexes, inefficient query plans. The most common source of PostgreSQL performance issues.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 2. Connection Management
|
||||
|
||||
**Impact: CRITICAL**
|
||||
|
||||
Connection pooling, limits, and serverless strategies. Critical for applications with high concurrency or serverless deployments.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 3. Schema Design
|
||||
|
||||
**Impact: HIGH**
|
||||
|
||||
Table design, index strategies, partitioning, and data type selection. Foundation for long-term performance.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 4. Concurrency & Locking
|
||||
|
||||
**Impact: MEDIUM-HIGH**
|
||||
|
||||
Transaction management, isolation levels, deadlock prevention, and lock contention patterns.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 5. Security & RLS
|
||||
|
||||
**Impact: MEDIUM-HIGH**
|
||||
|
||||
Row-Level Security policies, privilege management, and authentication patterns.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 6. Data Access Patterns
|
||||
|
||||
**Impact: MEDIUM**
|
||||
|
||||
N+1 query elimination, batch operations, cursor-based pagination, and efficient data fetching.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 7. Monitoring & Diagnostics
|
||||
|
||||
**Impact: LOW-MEDIUM**
|
||||
|
||||
Using pg_stat_statements, EXPLAIN ANALYZE, metrics collection, and performance diagnostics.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## 8. Advanced Features
|
||||
|
||||
**Impact: LOW**
|
||||
|
||||
Full-text search, JSONB optimization, PostGIS, extensions, and advanced PostgreSQL features.
|
||||
|
||||
*No rules defined yet. See rules/_template.md for creating new rules.*
|
||||
|
||||
## References
|
||||
|
||||
- https://www.postgresql.org/docs/current/
|
||||
- https://supabase.com/docs
|
||||
- https://wiki.postgresql.org/wiki/Performance_Optimization
|
||||
- https://supabase.com/docs/guides/database/overview
|
||||
- https://supabase.com/docs/guides/auth/row-level-security
|
||||
@@ -1,12 +1,12 @@
|
||||
# PostgreSQL Best Practices - Contributor Guide
|
||||
# Postgres Best Practices - Contributor Guide
|
||||
|
||||
This repository contains PostgreSQL performance optimization rules optimized for AI agents and LLMs.
|
||||
This repository contains Postgres performance optimization rules optimized for AI agents and LLMs.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
cd packages/postgresql-best-practices-build
|
||||
cd packages/postgres-best-practices-build
|
||||
npm install
|
||||
|
||||
# Validate existing rules
|
||||
@@ -46,7 +46,7 @@ npm run build
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
skills/postgresql-best-practices/
|
||||
skills/postgres-best-practices/
|
||||
├── SKILL.md # Agent-facing skill manifest
|
||||
├── AGENTS.md # [GENERATED] Compiled rules document
|
||||
├── README.md # This file
|
||||
@@ -57,7 +57,7 @@ skills/postgresql-best-practices/
|
||||
├── _contributing.md # Writing guidelines
|
||||
└── *.md # Individual rules
|
||||
|
||||
packages/postgresql-best-practices-build/
|
||||
packages/postgres-best-practices-build/
|
||||
├── src/ # Build system source
|
||||
├── package.json # NPM scripts
|
||||
└── test-cases.json # [GENERATED] Test artifacts
|
||||
@@ -121,7 +121,7 @@ See `rules/_contributing.md` for detailed guidelines. Key principles:
|
||||
|
||||
## Supabase-Specific Content
|
||||
|
||||
Keep ~90% of content as universal PostgreSQL patterns. Add Supabase notes for:
|
||||
Keep ~90% of content as universal Postgres patterns. Add Supabase notes for:
|
||||
- Supavisor connection pooling
|
||||
- Dashboard features (index monitoring, query stats)
|
||||
- RLS best practices with Supabase auth
|
||||
@@ -1,15 +1,15 @@
|
||||
---
|
||||
name: supabase-postgresql-best-practices
|
||||
description: PostgreSQL performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing PostgreSQL queries, schema designs, or database configurations.
|
||||
name: supabase-postgres-best-practices
|
||||
description: Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
|
||||
license: MIT
|
||||
metadata:
|
||||
author: supabase
|
||||
version: "0.1.0"
|
||||
---
|
||||
|
||||
# Supabase PostgreSQL Best Practices
|
||||
# Supabase Postgres Best Practices
|
||||
|
||||
Comprehensive performance optimization guide for PostgreSQL, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.
|
||||
Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.
|
||||
|
||||
## When to Apply
|
||||
|
||||
@@ -18,7 +18,7 @@ Reference these guidelines when:
|
||||
- Implementing indexes or query optimization
|
||||
- Reviewing database performance issues
|
||||
- Configuring connection pooling or scaling
|
||||
- Optimizing for PostgreSQL-specific features
|
||||
- Optimizing for Postgres-specific features
|
||||
- Working with Row-Level Security (RLS)
|
||||
|
||||
## Rule Categories by Priority
|
||||
Reference in New Issue
Block a user