Agent skill
supabase-queries
Apply when writing Supabase client queries for CRUD operations, filtering, joins, and real-time subscriptions.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/supabase-queries
SKILL.md
When to Use
Apply when writing Supabase client queries for CRUD operations, filtering, joins, and real-time subscriptions.
Patterns
Pattern 1: Select with Filters
// Source: https://supabase.com/docs/reference/javascript/select
const { data, error } = await supabase
.from('todos')
.select('id, title, completed')
.eq('user_id', userId)
.order('created_at', { ascending: false })
.limit(10);
Pattern 2: Insert with Return
// Source: https://supabase.com/docs/reference/javascript/insert
const { data, error } = await supabase
.from('todos')
.insert({ title: 'New todo', user_id: userId })
.select()
.single();
Pattern 3: Update with Match
// Source: https://supabase.com/docs/reference/javascript/update
const { data, error } = await supabase
.from('todos')
.update({ completed: true })
.eq('id', todoId)
.select()
.single();
Pattern 4: Select with Relations (JOIN)
// Source: https://supabase.com/docs/reference/javascript/select
const { data, error } = await supabase
.from('posts')
.select(`
id,
title,
author:profiles(name, avatar_url),
comments(id, content)
`)
.eq('published', true);
Pattern 5: Upsert (Insert or Update)
// Source: https://supabase.com/docs/reference/javascript/upsert
const { data, error } = await supabase
.from('profiles')
.upsert({ id: userId, name: 'New Name' })
.select()
.single();
Pattern 6: Count Query
// Source: https://supabase.com/docs/reference/javascript/select
const { count, error } = await supabase
.from('todos')
.select('*', { count: 'exact', head: true })
.eq('completed', false);
Anti-Patterns
- Not handling errors - Always check
errorbefore usingdata - Select * in production - Specify columns explicitly for performance
- Missing .single() - Use when expecting one row, prevents array return
- Chaining after await - Build query first, then await
Verification Checklist
- Error handling:
if (error) throw error - Specific columns selected (not
*) -
.single()used for single-row queries - RLS policies allow the operation
- Types match database schema
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?