skills/adamfehse/database-manager/SKILL.md
Manages Supabase database schema, migrations, and queries for CookMode V2. Use this when the user needs to create/modify tables, write migrations, update RLS policies, or troubleshoot database issues.
npx skillsauth add aiskillstore/marketplace database-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You specialize in Supabase PostgreSQL database operations for CookMode V2. You help users manage schema, write migrations, configure Row Level Security (RLS), and troubleshoot database issues.
Invoke this skill when the user wants to:
ingredient_checks
step_checks
recipe_status
recipe_order_counts
recipe_chef_names
name and color fields/supabase-schema.sql/supabase-migration-*.sqlCREATE TABLE ingredient_checks (
recipe_slug TEXT NOT NULL,
ingredient_index INTEGER NOT NULL,
component_name TEXT NOT NULL,
ingredient_text TEXT,
is_checked BOOLEAN DEFAULT FALSE,
updated_at TIMESTAMP DEFAULT NOW(),
PRIMARY KEY (recipe_slug, ingredient_index, component_name)
);
CREATE TABLE step_checks (
recipe_slug TEXT NOT NULL,
step_index INTEGER NOT NULL,
step_text TEXT,
is_checked BOOLEAN DEFAULT FALSE,
updated_at TIMESTAMP DEFAULT NOW(),
PRIMARY KEY (recipe_slug, step_index)
);
CREATE TABLE recipe_status (
recipe_slug TEXT PRIMARY KEY,
status TEXT CHECK (status IN ('gathered', 'complete', 'plated', 'packed')),
updated_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE recipe_order_counts (
recipe_slug TEXT PRIMARY KEY,
order_count INTEGER DEFAULT 1 CHECK (order_count >= 1 AND order_count <= 50),
updated_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE recipe_chef_names (
recipe_slug TEXT PRIMARY KEY,
name TEXT NOT NULL,
color TEXT NOT NULL DEFAULT '#9333ea',
updated_at TIMESTAMP DEFAULT NOW()
);
CookMode V2 currently uses permissive RLS - all users can read/write all data.
-- Enable RLS
ALTER TABLE ingredient_checks ENABLE ROW LEVEL SECURITY;
-- Allow all operations (current policy)
CREATE POLICY "Enable all access" ON ingredient_checks
FOR ALL USING (true);
Note: This is suitable for trusted kitchen environments. For multi-tenant setups, implement user-specific policies.
Tables with real-time sync enabled:
ingredient_checksstep_checksrecipe_statusrecipe_order_countsrecipe_chef_namesConfigured in /js/hooks/useRealtime.js:15-80
supabase-migration-{feature-name}.sql-- Migration: Add new feature
-- Date: 2025-01-XX
-- Description: Brief description of changes
-- ============================================
-- NEW TABLE
-- ============================================
CREATE TABLE IF NOT EXISTS new_table (
id SERIAL PRIMARY KEY,
recipe_slug TEXT NOT NULL,
data TEXT,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
-- ============================================
-- INDEXES
-- ============================================
CREATE INDEX idx_new_table_recipe ON new_table(recipe_slug);
-- ============================================
-- ROW LEVEL SECURITY
-- ============================================
ALTER TABLE new_table ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Enable all access" ON new_table
FOR ALL USING (true);
-- ============================================
-- ROLLBACK (Manual)
-- ============================================
-- DROP TABLE IF EXISTS new_table CASCADE;
-- Add new column
ALTER TABLE recipe_status
ADD COLUMN priority INTEGER DEFAULT 0;
-- Modify column
ALTER TABLE recipe_chef_names
ALTER COLUMN color SET DEFAULT '#10b981';
-- Add constraint
ALTER TABLE recipe_order_counts
ADD CONSTRAINT valid_count CHECK (order_count > 0);
Use Supabase client in hooks:
// Select
const { data, error } = await supabase
.from('recipe_status')
.select('*')
.eq('recipe_slug', 'truffle-mashed-potatoes');
// Upsert
const { error } = await supabase
.from('recipe_order_counts')
.upsert({
recipe_slug: 'chocolate-cake',
order_count: 5
}, {
onConflict: 'recipe_slug'
});
// Delete
const { error } = await supabase
.from('step_checks')
.delete()
.eq('recipe_slug', 'old-recipe');
Supabase connection configured in /js/hooks/useSupabase.js:
useSupabase() creates client{supabase, isSupabaseConnected}Issue: Changes not syncing
Issue: Constraint violation
Issue: RLS blocking queries
-- Check table structure
\d+ ingredient_checks
-- View all policies
SELECT * FROM pg_policies WHERE tablename = 'recipe_status';
-- Check real-time configuration
SELECT * FROM pg_publication_tables WHERE pubname = 'supabase_realtime';
Current indexes target:
UI updates immediately, syncs to DB asynchronously:
// Optimistic update
setCompletedIngredients(prev => ({ ...prev, [key]: true }));
// Then sync to Supabase
await supabase.from('ingredient_checks').upsert(...);
When modifying schema:
-- Migration: Add recipe notes feature
CREATE TABLE recipe_notes (
id SERIAL PRIMARY KEY,
recipe_slug TEXT NOT NULL,
note_text TEXT NOT NULL,
created_by TEXT,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX idx_recipe_notes_slug ON recipe_notes(recipe_slug);
ALTER TABLE recipe_notes ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Enable all access" ON recipe_notes FOR ALL USING (true);
Then update /js/hooks/useRecipeData.js to fetch and manage notes.
Remember: Keep the database simple and cook-friendly, just like the UI!
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.