Back to list
CoderMariusz

supabase-queries

by CoderMariusz

MonoPilot - Manufacturing and Purchase Order Management System

1🍴 0📅 Jan 20, 2026

SKILL.md


name: supabase-queries description: Apply when writing Supabase client queries for CRUD operations, filtering, joins, and real-time subscriptions. version: 1.0.0 tokens: ~700 confidence: high sources:


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 error before using data
  • 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

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon