Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Database Manager

ASecurity

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.

416 stars
0 votes
0 copies
2 views
Added 2/7/2026
developmentjavascriptrustjavasqldatabasesecurityperformance

Works with

cli

Security Analysis

A100/100

Scanned 2/10/2026

Install to Claude Code

$npx -y skills add aiskillstore/marketplace --skill database-manager --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Database Manager?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Database Manager
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiskillstore-database-manager/badge)](https://www.skillsdirectory.com/skills/aiskillstore-database-manager)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: database-manager
description: 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.
---

# Database Manager Skill

## Your Role

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.

## When to Use This Skill

Invoke this skill when the user wants to:
- Create or modify database tables
- Write SQL migrations
- Add/update RLS policies
- Debug database errors
- Optimize queries
- Add new database features

## Current Database Schema

### Tables Overview

1. **ingredient_checks**
   - Tracks ingredient completion status
   - Real-time synced across clients

2. **step_checks**
   - Tracks instruction step completion
   - Real-time synced across clients

3. **recipe_status**
   - Workflow status: gathered, complete, plated, packed
   - One status per recipe

4. **recipe_order_counts**
   - Number of orders for each recipe (1-50)
   - Used for ingredient scaling

5. **recipe_chef_names**
   - Chef assignment with color badge
   - Includes `name` and `color` fields

### Schema Files
- **Primary**: `/supabase-schema.sql`
- **Migrations**: `/supabase-migration-*.sql`

## Table Schemas

### ingredient_checks
```sql
CREATE 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)
);
```

### step_checks
```sql
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)
);
```

### recipe_status
```sql
CREATE TABLE recipe_status (
    recipe_slug TEXT PRIMARY KEY,
    status TEXT CHECK (status IN ('gathered', 'complete', 'plated', 'packed')),
    updated_at TIMESTAMP DEFAULT NOW()
);
```

### recipe_order_counts
```sql
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()
);
```

### recipe_chef_names
```sql
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()
);
```

## Row Level Security (RLS)

CookMode V2 currently uses **permissive RLS** - all users can read/write all data.

```sql
-- 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.

## Real-Time Subscriptions

Tables with real-time sync enabled:
- `ingredient_checks`
- `step_checks`
- `recipe_status`
- `recipe_order_counts`
- `recipe_chef_names`

Configured in `/js/hooks/useRealtime.js:15-80`

## Migration Best Practices

### Creating a Migration

1. **Name convention**: `supabase-migration-{feature-name}.sql`
2. **Include rollback**: Add comments for manual rollback steps
3. **Test locally**: Verify migration before applying

### Migration Template

```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;
```

## Common Database Operations

### Adding a New Table

1. Define schema with constraints
2. Add indexes for performance
3. Enable RLS and create policies
4. Document in this skill
5. Update hooks if real-time needed

### Modifying Existing Table

```sql
-- 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);
```

### Querying Data

Use Supabase client in hooks:

```javascript
// 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');
```

## Database Connection

### Configuration
Supabase connection configured in `/js/hooks/useSupabase.js`:
- **URL**: From environment or config
- **Anon Key**: Public key for client-side access
- **Real-time**: WebSocket connection for live updates

### Initialization Flow
1. `useSupabase()` creates client
2. Returns `{supabase, isSupabaseConnected}`
3. App checks connection before operations

## Troubleshooting

### Common Issues

**Issue**: Changes not syncing
- Check real-time subscription in useRealtime.js
- Verify table has RLS policy
- Check browser console for Supabase errors

**Issue**: Constraint violation
- Review table constraints (CHECK, UNIQUE, FK)
- Validate data before insert/update

**Issue**: RLS blocking queries
- Verify policies allow operation
- Check user authentication status

### Debug Queries

```sql
-- 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';
```

## Performance Considerations

### Indexes
Current indexes target:
- Primary keys (automatic)
- Foreign key columns
- Frequently filtered columns (recipe_slug)

### Optimistic Updates
UI updates immediately, syncs to DB asynchronously:
```javascript
// Optimistic update
setCompletedIngredients(prev => ({ ...prev, [key]: true }));

// Then sync to Supabase
await supabase.from('ingredient_checks').upsert(...);
```

## Schema Evolution

When modifying schema:
1. **Never drop data without backup**
2. **Use migrations for all changes**
3. **Test with realistic data volumes**
4. **Update hooks if data access changes**
5. **Document changes in CLAUDE.md**

## Example: Adding Recipe Notes Table

```sql
-- 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!

Attribution

aiskillstoreaiskillstore
View sourceMore from aiskillstore →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284072 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2192 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →