class-ai-agent 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/.agent/README.md +10 -5
  2. package/.agent/SESSION.md +18 -13
  3. package/.agent/rules/agent-continuity.md +44 -0
  4. package/.agent/rules/antigravity-overview.md +38 -0
  5. package/.agent/rules/api-conventions.md +85 -0
  6. package/.agent/rules/clean-code.md +211 -0
  7. package/.agent/rules/code-style.md +92 -0
  8. package/.agent/rules/codegraph.md +47 -0
  9. package/.agent/rules/database.md +66 -0
  10. package/.agent/rules/error-handling.md +98 -0
  11. package/.agent/rules/git-workflow.md +83 -0
  12. package/.agent/rules/monitoring.md +317 -0
  13. package/.agent/rules/naming-conventions.md +266 -0
  14. package/.agent/rules/project-structure.md +71 -0
  15. package/.agent/rules/security.md +95 -0
  16. package/.agent/rules/system-design.md +168 -0
  17. package/.agent/rules/tech-stack.md +463 -0
  18. package/.agent/rules/testing.md +110 -0
  19. package/.agents/agents/backend.md +395 -0
  20. package/.agents/agents/business-analyst.md +380 -0
  21. package/.agents/agents/code-reviewer.md +110 -0
  22. package/.agents/agents/copywriter-seo.md +236 -0
  23. package/.agents/agents/frontend.md +384 -0
  24. package/.agents/agents/project-manager.md +201 -0
  25. package/.agents/agents/qa.md +221 -0
  26. package/.agents/agents/security-auditor.md +143 -0
  27. package/.agents/agents/systems-architect.md +211 -0
  28. package/.agents/agents/test-engineer.md +123 -0
  29. package/.agents/agents/ui-ux-designer.md +210 -0
  30. package/.agents/references/accessibility-checklist.md +174 -0
  31. package/.agents/references/agent-continuity.md +42 -0
  32. package/.agents/references/codegraph.md +90 -0
  33. package/.agents/references/mcp-antigravity.md +71 -0
  34. package/.agents/references/performance-checklist.md +150 -0
  35. package/.agents/references/security-checklist.md +94 -0
  36. package/.agents/references/supabase.md +55 -0
  37. package/.agents/references/testing-patterns.md +183 -0
  38. package/.agents/skills/agent-continuity/SKILL.md +70 -0
  39. package/.agents/skills/code-review/SKILL.md +208 -0
  40. package/.agents/skills/deploy/SKILL.md +68 -0
  41. package/.agents/skills/deploy/deploy.md +735 -0
  42. package/.agents/skills/incremental-implementation/SKILL.md +210 -0
  43. package/.agents/skills/security-review/SKILL.md +71 -0
  44. package/.agents/skills/supabase/SKILL.md +135 -0
  45. package/.agents/skills/supabase/UPSTREAM.md +16 -0
  46. package/.agents/skills/supabase/assets/feedback-issue-template.md +17 -0
  47. package/.agents/skills/supabase/references/skill-feedback.md +17 -0
  48. package/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
  49. package/.agents/skills/supabase-postgres-best-practices/UPSTREAM.md +16 -0
  50. package/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
  51. package/.agents/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
  52. package/.agents/skills/supabase-postgres-best-practices/references/_template.md +34 -0
  53. package/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
  54. package/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
  55. package/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
  56. package/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
  57. package/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
  58. package/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
  59. package/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
  60. package/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
  61. package/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
  62. package/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
  63. package/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
  64. package/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
  65. package/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
  66. package/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
  67. package/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
  68. package/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
  69. package/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
  70. package/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
  71. package/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
  72. package/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
  73. package/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
  74. package/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
  75. package/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
  76. package/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
  77. package/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
  78. package/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
  79. package/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
  80. package/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
  81. package/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
  82. package/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
  83. package/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
  84. package/.agents/skills/tdd/SKILL.md +217 -0
  85. package/.agents/skills/ui-ux-pro-max/SKILL.md +288 -0
  86. package/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
  87. package/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
  88. package/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
  89. package/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
  90. package/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
  91. package/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  92. package/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  93. package/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  94. package/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  95. package/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  96. package/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  97. package/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  98. package/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  99. package/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  100. package/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  101. package/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  102. package/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  103. package/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  104. package/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  105. package/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
  106. package/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
  107. package/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  108. package/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  109. package/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  110. package/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
  111. package/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  112. package/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
  113. package/.agents/workflows/build.md +132 -0
  114. package/.agents/workflows/debug.md +242 -0
  115. package/.agents/workflows/deploy.md +43 -0
  116. package/.agents/workflows/fix-issue.md +45 -0
  117. package/.agents/workflows/handoff.md +93 -0
  118. package/.agents/workflows/plan.md +125 -0
  119. package/.agents/workflows/publish-npm.md +122 -0
  120. package/.agents/workflows/resume.md +106 -0
  121. package/.agents/workflows/review.md +53 -0
  122. package/.agents/workflows/simplify.md +221 -0
  123. package/.agents/workflows/spec.md +95 -0
  124. package/.agents/workflows/test.md +213 -0
  125. package/.claude/CLAUDE.md +23 -0
  126. package/.claude/agents/business-analyst.md +380 -0
  127. package/.claude/references/codegraph.md +26 -14
  128. package/.claude/rules/agent-continuity.md +3 -2
  129. package/.claude/rules/api-conventions.md +1 -0
  130. package/.claude/rules/clean-code.md +1 -0
  131. package/.claude/rules/code-style.md +1 -0
  132. package/.claude/rules/codegraph.md +43 -0
  133. package/.claude/rules/database.md +2 -1
  134. package/.claude/rules/error-handling.md +1 -0
  135. package/.claude/rules/git-workflow.md +1 -0
  136. package/.claude/rules/monitoring.md +1 -0
  137. package/.claude/rules/naming-conventions.md +1 -0
  138. package/.claude/rules/project-structure.md +1 -0
  139. package/.claude/rules/security.md +1 -0
  140. package/.claude/rules/system-design.md +1 -0
  141. package/.claude/rules/tech-stack.md +1 -0
  142. package/.claude/rules/testing.md +1 -0
  143. package/.claude/settings.json +3 -1
  144. package/.claude/skills/ui-ux-pro-max/SKILL.md +1 -90
  145. package/.cursor/CURSOR.md +1 -1
  146. package/.cursor/agents/business-analyst.md +380 -0
  147. package/.cursor/rules/cursor-overview.mdc +4 -3
  148. package/.cursor/rules/database.mdc +2 -2
  149. package/.kiro/KIRO.md +3 -3
  150. package/.kiro/agents/business-analyst.md +380 -0
  151. package/.kiro/steering/database.md +2 -2
  152. package/.kiro/steering/kiro-overview.md +2 -2
  153. package/AGENTS.md +23 -1
  154. package/GEMINI.md +152 -0
  155. package/README.md +65 -19
  156. package/bin/class-ai-agent.cjs +85 -9
  157. package/package.json +11 -4
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: Incremental Implementation
3
+ description: Build features in thin vertical slices with continuous verification
4
+ ---
5
+
6
+ # Incremental Implementation Skill
7
+
8
+ ## Philosophy
9
+
10
+ > "The simplest thing that could work."
11
+
12
+ Build in thin vertical slices. Each increment leaves the system working and testable.
13
+
14
+ ---
15
+
16
+ ## When to Apply
17
+
18
+ **Use this skill when:**
19
+ - Multi-file changes
20
+ - New features
21
+ - Refactoring work
22
+ - Any change > 100 lines
23
+
24
+ **Skip for:**
25
+ - Single-file, small changes
26
+ - Simple bug fixes
27
+ - Configuration updates
28
+
29
+ ---
30
+
31
+ ## The Increment Cycle
32
+
33
+ ```
34
+ ┌─────────────────────────────────────────┐
35
+ │ 1. Pick smallest complete piece │
36
+ │ ↓ │
37
+ │ 2. Write failing test (RED) │
38
+ │ ↓ │
39
+ │ 3. Implement minimal code (GREEN) │
40
+ │ ↓ │
41
+ │ 4. Refactor if needed │
42
+ │ ↓ │
43
+ │ 5. Run all tests │
44
+ │ ↓ │
45
+ │ 6. Commit with clear message │
46
+ │ ↓ │
47
+ │ 7. Repeat for next piece │
48
+ └─────────────────────────────────────────┘
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Vertical vs Horizontal Slicing
54
+
55
+ ### Vertical Slices (Correct)
56
+
57
+ Each slice delivers end-to-end functionality:
58
+
59
+ ```
60
+ Task 1: User can create a task
61
+ └── DB model + API route + UI component
62
+
63
+ Task 2: User can view task list
64
+ └── DB query + API endpoint + List component
65
+
66
+ Task 3: User can complete a task
67
+ └── DB update + API handler + Toggle UI
68
+ ```
69
+
70
+ ### Horizontal Slices (Anti-pattern)
71
+
72
+ Layers completed separately:
73
+
74
+ ```
75
+ Task 1: Create all DB models
76
+ Task 2: Create all API routes
77
+ Task 3: Create all UI components
78
+
79
+ ❌ Problem: Nothing works until everything is done
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Slicing Strategies
85
+
86
+ ### 1. Happy Path First
87
+
88
+ ```
89
+ Slice 1: Basic flow works
90
+ Slice 2: Add validation
91
+ Slice 3: Add error handling
92
+ Slice 4: Add edge cases
93
+ ```
94
+
95
+ ### 2. Risk-First
96
+
97
+ ```
98
+ Slice 1: Uncertain/complex piece (reduce risk early)
99
+ Slice 2: Dependent pieces (build on verified foundation)
100
+ Slice 3: Polish (now safe to invest time)
101
+ ```
102
+
103
+ ### 3. Contract-First
104
+
105
+ ```
106
+ Slice 1: Define API contract (types, endpoints)
107
+ Slice 2: Backend implements contract
108
+ Slice 3: Frontend implements against contract
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Rules
114
+
115
+ ### The 100-Line Rule
116
+
117
+ > Test before writing more than ~100 lines.
118
+
119
+ If you've written 100+ lines without running tests, stop and verify.
120
+
121
+ ### Touch Only What's Needed
122
+
123
+ > Don't refactor adjacent code. Don't add unrequested features.
124
+
125
+ Stay focused on the current task.
126
+
127
+ ### Keep It Building
128
+
129
+ > Project must compile and tests must pass after each increment.
130
+
131
+ Never leave the codebase broken between commits.
132
+
133
+ ### Feature Flags for Incomplete Work
134
+
135
+ ```javascript
136
+ // Use flags when merging incomplete features
137
+ if (featureFlags.newCheckout) {
138
+ return <NewCheckoutFlow />;
139
+ }
140
+ return <LegacyCheckout />;
141
+ ```
142
+
143
+ ### Safe Defaults
144
+
145
+ New code defaults to conservative, disabled behavior:
146
+ - New features off by default
147
+ - New permissions denied by default
148
+ - New validations strict by default
149
+
150
+ ### Rollback-Friendly
151
+
152
+ Each increment should be independently revertable:
153
+
154
+ ```bash
155
+ # If this commit breaks something, revert just this
156
+ git revert HEAD
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Red Flags
162
+
163
+ **Stop and reassess if you're:**
164
+
165
+ - Writing > 100 lines without testing
166
+ - Mixing unrelated changes in one commit
167
+ - Expanding scope mid-task
168
+ - Breaking the build between increments
169
+ - Creating abstractions "for later"
170
+ - Touching files outside the task scope
171
+
172
+ ---
173
+
174
+ ## Commit Strategy
175
+
176
+ Each increment = one commit:
177
+
178
+ ```bash
179
+ # Good: Atomic, focused commits
180
+ git commit -m "feat(tasks): add Task model with title and status"
181
+ git commit -m "feat(tasks): add POST /api/tasks endpoint"
182
+ git commit -m "feat(tasks): add CreateTaskForm component"
183
+
184
+ # Bad: Large, unfocused commits
185
+ git commit -m "Add task feature" # 500 lines across 10 files
186
+ ```
187
+
188
+ ---
189
+
190
+ ## When Stuck
191
+
192
+ If an increment fails:
193
+
194
+ 1. **Stop** — Don't push through
195
+ 2. **Diagnose** — What specifically failed?
196
+ 3. **Reduce scope** — Can you make a smaller increment?
197
+ 4. **Ask for help** — If truly blocked
198
+
199
+ ---
200
+
201
+ ## Verification Checklist
202
+
203
+ After each increment:
204
+
205
+ - [ ] Tests pass
206
+ - [ ] Build succeeds
207
+ - [ ] Code compiles
208
+ - [ ] Feature works (manual check if UI)
209
+ - [ ] Commit is atomic and focused
210
+ - [ ] Message follows conventions
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: security-review
3
+ description: Skill to perform a thorough security audit of the codebase
4
+ ---
5
+
6
+ # Security Review Skill
7
+
8
+ ## Purpose
9
+ Systematically scan the codebase for security vulnerabilities and produce a prioritized report.
10
+
11
+ ## Checklist
12
+
13
+ ### 🔴 Critical (Check First)
14
+ - [ ] Hardcoded secrets, API keys, passwords in source files
15
+ ```bash
16
+ grep -r "password\s*=\s*['\"]" src/
17
+ grep -r "api_key\s*=\s*['\"]" src/
18
+ ```
19
+ - [ ] `.env` files accidentally committed
20
+ ```bash
21
+ git log --all --full-history -- .env
22
+ ```
23
+ - [ ] SQL injection via string concatenation
24
+ - [ ] `eval()` or `new Function()` with user input
25
+
26
+ ### 🟡 High Priority
27
+ - [ ] Missing authentication on protected routes
28
+ - [ ] Missing authorization (privilege escalation)
29
+ - [ ] Passwords stored in plain text
30
+ - [ ] JWT secrets too short or exposed
31
+ - [ ] No rate limiting on auth endpoints
32
+ - [ ] Missing input validation
33
+
34
+ ### 🟢 Medium Priority
35
+ - [ ] Missing security headers (run Helmet scan)
36
+ - [ ] CORS configured too broadly (`origin: *`)
37
+ - [ ] Dependencies with known vulnerabilities
38
+ ```bash
39
+ npm audit
40
+ ```
41
+ - [ ] Sensitive data in logs
42
+ - [ ] Missing HTTPS enforcement
43
+
44
+ ### ℹ️ Low / Informational
45
+ - [ ] Error messages revealing stack traces to client
46
+ - [ ] Missing CSP headers
47
+ - [ ] Cookie security flags (HttpOnly, Secure, SameSite)
48
+
49
+ ## Output Format
50
+ ```markdown
51
+ # Security Review Report — [Date]
52
+
53
+ ## Critical Issues
54
+ [List with file:line references]
55
+
56
+ ## High Priority Issues
57
+ [List with file:line references]
58
+
59
+ ## Recommendations
60
+ [Prioritized action items]
61
+ ```
62
+
63
+ ## Commands
64
+ ```bash
65
+ # Dependency audit
66
+ npm audit --audit-level=moderate
67
+
68
+ # Check for secret patterns
69
+ grep -rn --include="*.js" --include="*.ts" \
70
+ -E "(password|secret|api_key|token)\s*=\s*['\"][^'\"]{8,}" src/
71
+ ```
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: supabase
3
+ description: "Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector)."
4
+ metadata:
5
+ author: supabase
6
+ version: "0.1.2"
7
+ ---
8
+
9
+ # Supabase
10
+
11
+ ## Core Principles
12
+
13
+ **1. Supabase changes frequently — verify against changelog and current docs before implementing.**
14
+ Do not rely on training data for Supabase features. Function signatures, config.toml settings, and API conventions change between versions.
15
+
16
+ First, fetch `https://supabase.com/changelog.md` (a lightweight summary index — not a heavy pull), scan for `breaking-change` tags relevant to your task, and follow the linked page for any that apply. Then look up the relevant topic using the documentation access methods below.
17
+
18
+ **2. Verify your work.**
19
+ After implementing any fix, run a test query to confirm the change works. A fix without verification is incomplete.
20
+
21
+ **3. Recover from errors, don't loop.**
22
+ If an approach fails after 2-3 attempts, stop and reconsider. Try a different method, check documentation, inspect the error more carefully, and review relevant logs when available. Supabase issues are not always solved by retrying the same command, and the answer is not always in the logs, but logs are often worth checking before proceeding.
23
+
24
+ **4. Exposing tables to the Data API:** Depending on the user's [Data API settings](https://supabase.com/dashboard/project/<ref>/integrations/data_api/settings), newly created tables may not be automatically exposed via the Data (REST) API. If this is the case, `anon` and `authenticated` roles will need to be explicitly granted access.
25
+
26
+ > Note that this is separate from RLS, which controls which _rows_ are visible once a table is accessible, not whether the table is accessible at all.
27
+
28
+ When a user reports a SQL-created table is unexpectedly inaccessible, check their Data API settings and whether the roles have been granted access via explicit `GRANT` SQL. When granting public (`anon`/`authenticated`) access, always enable RLS too. See [Exposing a Table to the Data API](https://supabase.com/docs/guides/api/securing-your-api.md) for the full setup workflow.
29
+
30
+ **5. RLS in exposed schemas.**
31
+ Enable RLS on every table in any exposed schema, which includes `public` by default. This is critical in Supabase because tables in exposed schemas can be reachable through the Data API when the `anon`/`authenticated` roles have access (see [Exposing a Table to the Data API](https://supabase.com/docs/guides/api/securing-your-api.md)). For private schemas, prefer RLS as defense in depth. After enabling RLS, create policies that match the actual access model rather than defaulting every table to the same `auth.uid()` pattern.
32
+
33
+ **6. Security checklist.**
34
+ When working on any Supabase task that touches auth, RLS, views, storage, or user data, run through this checklist. These are Supabase-specific security traps that silently create vulnerabilities:
35
+
36
+ - **Auth and session security**
37
+ - **Never use `user_metadata` claims in JWT-based authorization decisions.** In Supabase, `raw_user_meta_data` is user-editable and can appear in `auth.jwt()`, so it is unsafe for RLS policies or any other authorization logic. Store authorization data in `raw_app_meta_data` / `app_metadata` instead.
38
+ - **Deleting a user does not invalidate existing access tokens.** Sign out or revoke sessions first, keep JWT expiry short for sensitive apps, and for strict guarantees validate `session_id` against `auth.sessions` on sensitive operations.
39
+ - **If you use `app_metadata` or `auth.jwt()` for authorization, remember JWT claims are not always fresh until the user's token is refreshed.**
40
+
41
+ - **API key and client exposure**
42
+ - **Never expose the `service_role` or secret key in public clients.** Prefer publishable keys for frontend code. Legacy `anon` keys are only for compatibility. In Next.js, any `NEXT_PUBLIC_` env var is sent to the browser.
43
+
44
+ - **RLS, views, and privileged database code**
45
+ - **Views bypass RLS by default.** In Postgres 15 and above, use `CREATE VIEW ... WITH (security_invoker = true)`. In older versions of Postgres, protect your views by revoking access from the `anon` and `authenticated` roles, or by putting them in an unexposed schema.
46
+ - **UPDATE requires a SELECT policy.** In Postgres RLS, an UPDATE needs to first SELECT the row. Without a SELECT policy, updates silently return 0 rows — no error, just no change.
47
+ - **`auth.role()` is deprecated — use the `TO` clause instead.** Supabase has deprecated `auth.role()` in favour of specifying the target role directly on the policy with `TO authenticated` or `TO anon`. Beyond deprecation, `auth.role() = 'authenticated'` breaks silently when anonymous sign-ins are enabled, because anonymous users carry the `authenticated` Postgres role and pass the check regardless of whether the user is genuinely signed in.
48
+ ```sql
49
+ -- Deprecated (do not use)
50
+ create policy "example" on table_name for select
51
+ using ( auth.role() = 'authenticated' );
52
+ ```
53
+ - **`TO authenticated` alone is authentication without authorization (BOLA / IDOR).** Using `TO authenticated` only checks the role — it does not restrict which rows a user can access. The correct pattern combines `TO authenticated` with an ownership predicate in `USING`:
54
+ ```sql
55
+ create policy "example" on table_name for select
56
+ to authenticated
57
+ using ( (select auth.uid()) = user_id );
58
+ ```
59
+ - **UPDATE policies require both `USING` and `WITH CHECK`.** Without `WITH CHECK`, a user can reassign a row's `user_id` to another user:
60
+ ```sql
61
+ create policy "example" on table_name for update
62
+ to authenticated
63
+ using ( (select auth.uid()) = user_id )
64
+ with check ( (select auth.uid()) = user_id );
65
+ ```
66
+ - **`SECURITY DEFINER` functions bypass RLS.** A `SECURITY DEFINER` function runs with its creator's privileges — typically a role with `bypassrls` (e.g., `postgres`). Never add `SECURITY DEFINER` to resolve a permission error; it silently removes access control without fixing the underlying cause. Prefer `SECURITY INVOKER`.
67
+ - **`SECURITY DEFINER` functions in `public` are callable by all roles.** Postgres grants `EXECUTE` to `PUBLIC` by default for every new function, so any `SECURITY DEFINER` function in `public` is a public API endpoint callable by `anon` and `authenticated` (which inherit from `PUBLIC`) without any additional grant. When `SECURITY DEFINER` is genuinely needed (e.g., bypassing RLS on an internal lookup table), keep the function in a non-exposed schema, always include an `auth.uid()` check in the function body, and run `supabase db advisors` after making changes.
68
+
69
+ - **Storage access control**
70
+ - **Storage upsert requires INSERT + SELECT + UPDATE.** Granting only INSERT allows new uploads but file replacement (upsert) silently fails. You need all three.
71
+
72
+ - **Dependency and supply-chain security**
73
+ - **Always pin package versions and commit lockfiles** when installing Supabase packages (`supabase-js`, `@supabase/ssr`, `supabase-py`, etc.). See the [npm security guide](https://supabase.com/docs/guides/security/npm-security.md) for the full checklist.
74
+
75
+ For any security concern not covered above, fetch the Supabase product security index: `https://supabase.com/docs/guides/security/product-security.md`
76
+
77
+ ## Supabase CLI
78
+
79
+ Always discover commands via `--help` — never guess. The CLI structure changes between versions.
80
+
81
+ ```bash
82
+ supabase --help # All top-level commands
83
+ supabase <group> --help # Subcommands (e.g., supabase db --help)
84
+ supabase <group> <command> --help # Flags for a specific command
85
+ ```
86
+
87
+ **Supabase CLI Known gotchas:**
88
+
89
+ - `supabase db query` requires **CLI v2.79.0+** → use MCP `execute_sql` or `psql` as fallback
90
+ - `supabase db advisors` requires **CLI v2.81.3+** → use MCP `get_advisors` as fallback
91
+ - When you need a new migration SQL file, **always** create it with `supabase migration new <name>` first. Never invent a migration filename or rely on memory for the expected format.
92
+
93
+ **Version check and upgrade:** Run `supabase --version` to check. For CLI changelogs and version-specific features, consult the [CLI documentation](https://supabase.com/docs/reference/cli/introduction) or [GitHub releases](https://github.com/supabase/cli/releases).
94
+
95
+ ## Supabase MCP Server
96
+
97
+ For setup instructions, server URL, and configuration, see the [MCP setup guide](https://supabase.com/docs/guides/getting-started/mcp).
98
+
99
+ **Troubleshooting connection issues** — follow these steps in order:
100
+
101
+ 1. **Check if the server is reachable:**
102
+ `curl -so /dev/null -w "%{http_code}" https://mcp.supabase.com/mcp`
103
+ A `401` is expected (no token) and means the server is up. Timeout or "connection refused" means it may be down.
104
+
105
+ 2. **Check `.mcp.json` configuration:**
106
+ Verify the project root has a valid `.mcp.json` with the correct server URL. If missing, create one pointing to `https://mcp.supabase.com/mcp`.
107
+
108
+ 3. **Authenticate the MCP server:**
109
+ If the server is reachable and `.mcp.json` is correct but tools aren't visible, the user needs to authenticate. The Supabase MCP server uses OAuth 2.1 — tell the user to trigger the auth flow in their agent, complete it in the browser, and reload the session.
110
+
111
+ ## Supabase Documentation
112
+
113
+ Before implementing any Supabase feature, find the relevant documentation. Use these methods in priority order:
114
+
115
+ 1. **MCP `search_docs` tool** (preferred — returns relevant snippets directly)
116
+ 2. **Fetch docs pages as markdown** — any docs page can be fetched by appending `.md` to the URL path.
117
+ 3. **Web search** for Supabase-specific topics when you don't know which page to look at.
118
+
119
+ ## Making and Committing Schema Changes
120
+
121
+ **To make schema changes, use `execute_sql` (MCP) or `supabase db query` (CLI).** These run SQL directly on the database without creating migration history entries, so you can iterate freely and generate a clean migration when ready.
122
+
123
+ Do NOT use `apply_migration` to change a local database schema — it writes a migration history entry on every call, which means you can't iterate, and `supabase db diff` / `supabase db pull` will produce empty or conflicting diffs. If you use it, you'll be stuck with whatever SQL you passed on the first try.
124
+
125
+ **When ready to commit** your changes to a migration file:
126
+
127
+ 1. **Run advisors** → `supabase db advisors` (CLI v2.81.3+) or MCP `get_advisors`. Fix any issues.
128
+ 2. **Review the Security Checklist above** if your changes involve views, functions, triggers, or storage.
129
+ 3. **Generate the migration** → `supabase db pull <descriptive-name> --local --yes`
130
+ 4. **Verify** → `supabase migration list --local`
131
+
132
+ ## Reference Guides
133
+
134
+ - **Skill Feedback** → [references/skill-feedback.md](references/skill-feedback.md)
135
+ **MUST read when** the user reports that this skill gave incorrect guidance or is missing information.
@@ -0,0 +1,16 @@
1
+ # Upstream
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | Repository | [supabase/agent-skills](https://github.com/supabase/agent-skills) |
6
+ | Ref | `v0.1.5` |
7
+ | Commit | `30e4d716faf4b459291d607783fe866a70d0f4e9` |
8
+ | License | MIT |
9
+
10
+ Vendored by [class-ai-agent](https://github.com/khoantd/class-ai-agent). Refresh:
11
+
12
+ ```bash
13
+ npm run sync:supabase-skills
14
+ ```
15
+
16
+ Copyright (c) Supabase — see [upstream LICENSE](https://github.com/supabase/agent-skills/blob/v0.1.5/LICENSE).
@@ -0,0 +1,17 @@
1
+ ## What happened
2
+
3
+ **Task:** <!-- e.g., "Set up MFA on patient records" -->
4
+
5
+ **Skill said:** <!-- e.g., "Use auth.jwt()->'app_metadata' in the RLS policy" -->
6
+
7
+ **Expected:** <!-- e.g., "The function also needs SECURITY DEFINER + grant to supabase_auth_admin" -->
8
+
9
+ ## Source
10
+
11
+ **File:** <!-- e.g., references/security-model.md -->
12
+
13
+ **Section:** <!-- e.g., "Trust Boundaries > user_metadata vs app_metadata" -->
14
+
15
+ ## Fix suggestion
16
+
17
+ <!-- Leave blank if unsure -->
@@ -0,0 +1,17 @@
1
+ # Skill Feedback
2
+
3
+ Use this when the user reports that the skill gave incorrect guidance, is missing information, or could be improved. This is about the skill (agent instructions), not about Supabase the product.
4
+
5
+ ## Steps
6
+
7
+ 1. **Ask permission** — Ask the user if they'd like to submit feedback to the skill maintainers. If they decline, move on.
8
+
9
+ 2. **Draft the issue** — Use the template at [assets/feedback-issue-template.md](../assets/feedback-issue-template.md) to structure the feedback. Fill in the fields based on the conversation. Always identify which specific reference file and section caused the problem.
10
+
11
+ 3. **Submit** — Create a GitHub Issue on the `supabase/agent-skills` repository using the draft as the issue body. The title must follow this format: `user-feedback: <summary of the problem>`.
12
+
13
+ 4. **Share the result** — Share the issue URL with the user after submission. If submission fails, give the user this link to create the issue manually:
14
+
15
+ ```
16
+ https://github.com/supabase/agent-skills/issues/new
17
+ ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: supabase-postgres-best-practices
3
+ description: Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
4
+ license: MIT
5
+ metadata:
6
+ author: supabase
7
+ version: "1.1.1"
8
+ organization: Supabase
9
+ date: January 2026
10
+ abstract: Comprehensive Postgres performance optimization guide for developers using Supabase and Postgres. 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.
11
+ ---
12
+
13
+ # Supabase Postgres Best Practices
14
+
15
+ 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.
16
+
17
+ ## When to Apply
18
+
19
+ Reference these guidelines when:
20
+ - Writing SQL queries or designing schemas
21
+ - Implementing indexes or query optimization
22
+ - Reviewing database performance issues
23
+ - Configuring connection pooling or scaling
24
+ - Optimizing for Postgres-specific features
25
+ - Working with Row-Level Security (RLS)
26
+
27
+ ## Rule Categories by Priority
28
+
29
+ | Priority | Category | Impact | Prefix |
30
+ |----------|----------|--------|--------|
31
+ | 1 | Query Performance | CRITICAL | `query-` |
32
+ | 2 | Connection Management | CRITICAL | `conn-` |
33
+ | 3 | Security & RLS | CRITICAL | `security-` |
34
+ | 4 | Schema Design | HIGH | `schema-` |
35
+ | 5 | Concurrency & Locking | MEDIUM-HIGH | `lock-` |
36
+ | 6 | Data Access Patterns | MEDIUM | `data-` |
37
+ | 7 | Monitoring & Diagnostics | LOW-MEDIUM | `monitor-` |
38
+ | 8 | Advanced Features | LOW | `advanced-` |
39
+
40
+ ## How to Use
41
+
42
+ Read individual rule files for detailed explanations and SQL examples:
43
+
44
+ ```
45
+ references/query-missing-indexes.md
46
+ references/query-partial-indexes.md
47
+ references/_sections.md
48
+ ```
49
+
50
+ Each rule file contains:
51
+ - Brief explanation of why it matters
52
+ - Incorrect SQL example with explanation
53
+ - Correct SQL example with explanation
54
+ - Optional EXPLAIN output or metrics
55
+ - Additional context and references
56
+ - Supabase-specific notes (when applicable)
57
+
58
+ ## References
59
+
60
+ - https://www.postgresql.org/docs/current/
61
+ - https://supabase.com/docs
62
+ - https://wiki.postgresql.org/wiki/Performance_Optimization
63
+ - https://supabase.com/docs/guides/database/overview
64
+ - https://supabase.com/docs/guides/auth/row-level-security
@@ -0,0 +1,16 @@
1
+ # Upstream
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | Repository | [supabase/agent-skills](https://github.com/supabase/agent-skills) |
6
+ | Ref | `v0.1.5` |
7
+ | Commit | `30e4d716faf4b459291d607783fe866a70d0f4e9` |
8
+ | License | MIT |
9
+
10
+ Vendored by [class-ai-agent](https://github.com/khoantd/class-ai-agent). Refresh:
11
+
12
+ ```bash
13
+ npm run sync:supabase-skills
14
+ ```
15
+
16
+ Copyright (c) Supabase — see [upstream LICENSE](https://github.com/supabase/agent-skills/blob/v0.1.5/LICENSE).