Database First
REQUIRED before implementing any game feature, scoring logic, state transition, or decision-making. ALL business logic lives in PostgreSQL - frontend is presentation only. Load this to understand where code belongs: database function vs component. Covers RPC patterns, SECURITY DEFINER, and anti-patterns.
Install
/plugin marketplace add Freddy-CHEN-ux/00_claude_skillsThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add Freddy-CHEN-ux/00_claude_skills --skill database-firstgit clone --depth 1 https://github.com/Freddy-CHEN-ux/00_claude_skills.git /tmp/00_claude_skills
mkdir -p ~/.claude/skills
cp -r /tmp/00_claude_skills/skills/database-first ~/.claude/skills/database-firstPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Database-First Architecture
The Iron Law of this project: **ALL business logic lives in PostgreSQL.**
> **Announce:** "I'm using database-first to ensure this logic goes in the right place."
## The Rule
```
FRONTEND (src/) → Presentation + User Input ONLY
DATABASE (supabase/db/) → Game Logic + State + Decisions
EDGE FUNCTIONS → LLM/Embedding Integration ONLY
```
## Where Does This Code Go?
| Feature | Database | Frontend |
|---------|----------|----------|
| Calculate confidence score | `game_logic.calculate_confidence()` | NEVER |
| Determine next question | `game_logic.get_next_turn()` | NEVER |
| Filter candidates | `game_logic.filter_*_candidates()` | NEVER |
| Check win condition | `game_logic.check_guess_decision()` | NEVER |
| Validate game state | DB constraints + RLS | NEVER |
| Render question UI | NEVER | Vue component |
| Display map markers | NEVER | MapLibre layer |
| Fetch game state | RPC returns it | Store calls RPC |
| Handle user input | NEVER | Vue event handler |
## Anti-Pattern: Logic in Frontend
```typescript
// WRONG: Scoring logic in Vue component
const confidence = computed(() => {
const probabilities = candidates.value.map(c => c.score)
const maxProb = Math.max(...probabilities)
const margin = maxProb - (probabilities[1] || 0)
// THIS IS GAME LOGIC - SHOULD BE IN DATABASE
return { maxProb, margin }
})
```
**Why it's wrong:**
- Different clients would calculate differently
- Can't use for learning/training dataDetails
- Skill name
database-first- Repository
- Freddy-CHEN-ux/00_claude_skills
- Path
skills/database-first/SKILL.md- Repo updated
- 10 January 2026
FAQ
What does the Database First skill do?
REQUIRED before implementing any game feature, scoring logic, state transition, or decision-making. ALL business logic lives in PostgreSQL - frontend is presentation only. Load this to understand where code belongs: database function vs component. Covers RPC patterns, SECURITY DEFINER, and anti-patterns.
How do I install the Database First skill?
Claude Code plugin: /plugin marketplace add Freddy-CHEN-ux/00_claude_skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Database First popular?
It lives in Freddy-CHEN-ux/00_claude_skills, which has 8 GitHub stars and 3 forks.
Related skills
Add Integration
8Freddy-CHEN-ux/00_claude_skills
Build a new API integration for Nexus. Load when user mentions "add integration", "new integration", "integrate with", "connect to [service]", or "build [service] integration". Interactive workflow that discovers API endpoints, plans the integration, and creates a project for implementation.
AI Agents
8Freddy-CHEN-ux/00_claude_skills
Production-grade AI agent patterns with MCP integration, agentic RAG, handoff orchestration, multi-layer guardrails, and observability (modern best practices)
AI LLM
8Freddy-CHEN-ux/00_claude_skills
Production LLM engineering skill. Covers strategy selection (prompting vs RAG vs fine-tuning), dataset design, PEFT/LoRA, evaluation workflows, deployment handoff to inference serving, and lifecycle operations with cost/safety controls.
Gameplay SQL
8Freddy-CHEN-ux/00_claude_skills
Test game mechanics via SQL. Use game_* tools for gameplay flow.
Database Backup
8Freddy-CHEN-ux/00_claude_skills
Backup database before tests, migrations, or other database operations
Postgres Vectors
8Freddy-CHEN-ux/00_claude_skills
Use when working with embeddings, semantic similarity, vector search, or the <-> <#> <=> operators. Load for pgvector queries, HNSW index creation, embedding storage, or similarity calculations. Covers distance operators, index strategies, and common pitfalls with 384-dimensional vectors.
Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.