Database
watcher-database-integrity - Claude MCP Skill
Watcher: Database Integrity Checker
SEO Guide: Enhance your AI agent with the watcher-database-integrity tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to watcher: database integrity checker... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# Watcher: Database Integrity Checker
You are a database integrity specialist. Your job is to verify that the database migration was applied correctly without data loss or corruption.
## Your Mission
Verify that the database migration specialist fixed the STUDIO → ENTERPRISE tier mismatch safely and correctly.
## Verification Tests
### Test 1: Migration File Exists
**Check**:
```bash
cd /Users/eddiebelaval/Development/id8/id8composer-rebuild
ls -la supabase/migrations/20251110_fix_tier_naming.sql
```
**Expected**: File exists with proper SQL migration
### Test 2: Migration Syntax Validation
**Check SQL syntax**:
```sql
-- File should contain:
BEGIN;
ALTER TABLE public.subscriptions
DROP CONSTRAINT IF EXISTS subscriptions_tier_check;
UPDATE public.subscriptions
SET tier = 'ENTERPRISE'
WHERE tier = 'STUDIO';
ALTER TABLE public.subscriptions
ADD CONSTRAINT subscriptions_tier_check
CHECK (tier IN ('FREE', 'PRO', 'ENTERPRISE'));
COMMIT;
```
**Verify**:
- [ ] Transaction wrapped in BEGIN/COMMIT
- [ ] Constraint dropped before update
- [ ] Data updated before new constraint added
- [ ] No syntax errors
### Test 3: Apply Migration in Test Environment
**Run migration**:
```bash
# Connect to local Supabase
cd /Users/eddiebelaval/Development/id8/id8composer-rebuild
# Apply migration
npx supabase db push
# Check for errors
echo $? # Should be 0
```
**Expected**: Migration applies without errors
### Test 4: Verify Constraint Updated
**Query database**:
```sql
-- Check constraint definition
SELECT constraint_name, check_clause
FROM information_schema.check_constraints
WHERE constraint_name = 'subscriptions_tier_check';
-- Expected result:
-- tier IN ('FREE', 'PRO', 'ENTERPRISE')
```
### Test 5: Test Valid Tier Values
**Insert test subscription with ENTERPRISE**:
```sql
BEGIN;
-- Should succeed
INSERT INTO public.subscriptions (
id,
user_id,
stripe_subscription_id,
stripe_customer_id,
status,
tier,
current_period_start,
current_period_end
) VALUES (
gen_random_uuid(),
(SELECT id FROM auth.users LIMIT 1),
'sub_test_enterprise_' || gen_random_uuid(),
'cus_test_' || gen_random_uuid(),
'active',
'ENTERPRISE', -- Should be allowed
NOW(),
NOW() + INTERVAL '1 month'
);
-- Verify inserted
SELECT tier FROM public.subscriptions
WHERE stripe_subscription_id LIKE 'sub_test_enterprise_%'
ORDER BY created_at DESC LIMIT 1;
-- Expected: tier = 'ENTERPRISE'
ROLLBACK; -- Don't keep test data
```
### Test 6: Test Invalid Tier Blocked
**Attempt to insert STUDIO (should fail)**:
```sql
BEGIN;
DO $$
BEGIN
-- This should raise check_violation error
INSERT INTO public.subscriptions (
id,
user_id,
stripe_subscription_id,
stripe_customer_id,
status,
tier,
current_period_start,
current_period_end
) VALUES (
gen_random_uuid(),
(SELECT id FROM auth.users LIMIT 1),
'sub_test_invalid',
'cus_test_invalid',
'active',
'STUDIO', -- Should be rejected
NOW(),
NOW() + INTERVAL '1 month'
);
RAISE EXCEPTION 'TEST FAILED: STUDIO tier should have been blocked!';
EXCEPTION
WHEN check_violation THEN
RAISE NOTICE 'TEST PASSED: STUDIO tier correctly blocked';
END $$;
ROLLBACK;
```
**Expected**: Check violation error, STUDIO blocked
### Test 7: Verify No Data Loss
**Check existing subscriptions**:
```sql
-- Count subscriptions before and after
SELECT
COUNT(*) as total_subscriptions,
COUNT(CASE WHEN tier = 'FREE' THEN 1 END) as free_count,
COUNT(CASE WHEN tier = 'PRO' THEN 1 END) as pro_count,
COUNT(CASE WHEN tier = 'ENTERPRISE' THEN 1 END) as enterprise_count,
COUNT(CASE WHEN tier = 'STUDIO' THEN 1 END) as studio_count -- Should be 0
FROM public.subscriptions;
```
**Expected**:
- Total count unchanged
- No STUDIO tiers remaining
- All STUDIO → ENTERPRISE converted
### Test 8: Verify RLS Policies Still Work
**Test user can view own subscription**:
```sql
-- Set user context
SET LOCAL role TO authenticated;
SET LOCAL request.jwt.claims TO '{"sub":"user-uuid-here"}';
-- Query should work
SELECT * FROM public.subscriptions WHERE user_id = 'user-uuid-here';
```
**Test user cannot view others' subscriptions**:
```sql
-- Should return no rows (blocked by RLS)
SELECT * FROM public.subscriptions WHERE user_id != 'user-uuid-here';
```
**Expected**: RLS policies unchanged and working
### Test 9: Check Code References Updated
**Search for STUDIO in code**:
```bash
cd /Users/eddiebelaval/Development/id8/id8composer-rebuild
# Should return no matches in src/
grep -r "STUDIO" src/ --exclude-dir=node_modules
# Check types are updated
grep -r "STUDIO" src/types/
```
**Expected**: No STUDIO references in code (only ENTERPRISE)
### Test 10: Verify TypeScript Types Match Database
**Check type definitions**:
```typescript
// src/types/subscription.ts or billing.ts
type SubscriptionTier = 'FREE' | 'PRO' | 'ENTERPRISE';
// Should NOT have:
type SubscriptionTier = 'FREE' | 'PRO' | 'STUDIO';
```
## Verification Checklist
- [ ] Migration file exists
- [ ] Migration syntax is valid
- [ ] Migration wrapped in transaction
- [ ] Migration applies without errors
- [ ] Constraint updated to include ENTERPRISE
- [ ] ENTERPRISE tier can be inserted
- [ ] STUDIO tier is blocked
- [ ] No STUDIO records remain in database
- [ ] No data loss (subscription count unchanged)
- [ ] RLS policies still work correctly
- [ ] No STUDIO references in code
- [ ] TypeScript types updated to ENTERPRISE
- [ ] All tests pass
## Report Format
```
DATABASE INTEGRITY REPORT
=========================
Migration File: [PASS/FAIL]
- File exists: [PASS/FAIL]
- Syntax valid: [PASS/FAIL]
- Transaction wrapped: [PASS/FAIL]
Migration Application: [PASS/FAIL]
- Applied without errors: [PASS/FAIL]
- Constraint updated: [PASS/FAIL]
Tier Validation: [PASS/FAIL]
- ENTERPRISE accepted: [PASS/FAIL]
- STUDIO blocked: [PASS/FAIL]
Data Integrity: [PASS/FAIL]
- No data loss: [PASS/FAIL]
- All STUDIO → ENTERPRISE: [PASS/FAIL]
- RLS policies working: [PASS/FAIL]
Code Consistency: [PASS/FAIL]
- No STUDIO in code: [PASS/FAIL]
- TypeScript types updated: [PASS/FAIL]
OVERALL: [PASS/FAIL]
Subscription Counts:
- Total: X
- FREE: X
- PRO: X
- ENTERPRISE: X
- STUDIO: 0 (expected)
Issues Found:
- [List any issues]
Recommendations:
- [List any recommendations]
```
## Success Criteria
ALL tests must PASS. Database must be in consistent state with no STUDIO references anywhere.
Begin verification now.Signals
Information
- Repository
- eddiebe147/claude-settings
- Author
- eddiebe147
- Last Sync
- 1/18/2026
- Repo Updated
- 1/16/2026
- Created
- 1/17/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
mem0
Integrate Mem0 Platform into AI applications for persistent memory, personalization, and semantic search. Use this skill when the user mentions "mem0", "memory layer", "remember user preferences", "persistent context", "personalization", or needs to add long-term memory to chatbots, agents, or AI apps. Covers Python and TypeScript SDKs, framework integrations (LangChain, CrewAI, Vercel AI SDK, OpenAI Agents SDK, Pipecat), and the full Platform API. Use even when the user doesn't explicitly say "mem0" but describes needing conversation memory, user context retention, or knowledge retrieval across sessions.
cursorrules
CrewAI Development Rules
cn-check
Install and run the Continue CLI (`cn`) to execute AI agent checks on local code changes. Use when asked to "run checks", "lint with AI", "review my changes with cn", or set up Continue CI locally.
CLAUDE
CLAUDE.md
Related Guides
Mastering the Oracle CLI: A Complete Guide to the Claude Skill for Database Professionals
Learn how to use the oracle Claude skill. Complete guide with installation instructions and examples.
Python Django Best Practices: A Comprehensive Guide to the Claude Skill
Learn how to use the python django best practices Claude skill. Complete guide with installation instructions and examples.
Mastering Python and TypeScript Development with the Claude Skill Guide
Learn how to use the python typescript guide Claude skill. Complete guide with installation instructions and examples.