원클릭으로
db-designer
Design database schema based on API and scenario requirements. Use when scenarios exist but logos/resources/database/ is empty.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Design database schema based on API and scenario requirements. Use when scenarios exist but logos/resources/database/ is empty.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Design technical architecture and select technology stack. Use when product design exists in logos/resources/prd/2-product-design/ but logos/resources/prd/3-technical-plan/1-architecture/ is empty.
Model business scenarios as detailed sequence diagrams with API calls. Use when architecture exists in 3-technical-plan/1-architecture/ but 3-technical-plan/2-scenario-implementation/ is empty. Scenarios must be complete user action paths, NOT single API calls.
Create product design specifications including feature specs and page designs. Use when requirements exist in logos/resources/prd/1-product-requirements/ but logos/resources/prd/2-product-design/ is empty.
UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: shadcn/ui MCP for component search and examples.
Write change proposals with impact analysis following OpenLogos delta workflow. Use when the project lifecycle is active and source code or methodology documents need modification.
Execute delta merges by generating MERGE_PROMPT.md from change proposals. Use when an approved change proposal needs to be applied to the codebase.
| name | db-designer |
| description | Design database schema based on API and scenario requirements. Use when scenarios exist but logos/resources/database/ is empty. |
Derive database table structures from API specifications and generate SQL DDL in the appropriate dialect. The database type is determined during Phase 3 Step 0 technology selection, ensuring that field types, constraints, indexes, and security policies are fully aligned with API endpoints.
tech_stack.database from logos-project.yaml to determine the database typelogos/resources/api/ contains API YAML specifications (output from api-designer)tech_stack.database in logos-project.yaml is filled inIf the API directory is empty, prompt the user to complete the API design (api-designer) in Phase 3 Step 2 first. If tech_stack.database is not filled in, prompt the user to complete Phase 3 Step 0 (architecture-designer) first.
Read the tech_stack field from logos/logos-project.yaml to determine the database type and dialect:
Extract all data entities that need to be persisted from the API YAML:
requestBody and responses across all endpoints to identify core data objectsusers, projects)loginRequest)Output an entity checklist for user confirmation:
Identified N data entities requiring persistence from API specifications:
| # | Entity | Source Endpoint | Core Fields |
|---|--------|----------------|-------------|
| 1 | users | auth.yaml → register, login | email, password, status |
| 2 | projects | projects.yaml → create, list, get | name, description, owner_id |
| 3 | subscriptions | billing.yaml → subscribe | plan, status, expires_at |
Design complete table structures for each entity, following the current database dialect:
Every table must include:
created_at, updated_atdeleted_at (as needed)NOT NULL, UNIQUE, CHECK, DEFAULTType mapping principles:
string + format: email → TEXT NOT NULL (with CHECK constraint or application-level validation)string + format: uuid → UUID (PostgreSQL) / CHAR(36) (MySQL)integer → INTEGER / BIGINTboolean → BOOLEAN (PostgreSQL) / TINYINT(1) (MySQL)string + enum → TEXT + CHECK constraint (listing enum values)INTEGER (store in cents), DECIMAL/FLOAT is prohibitedExample (PostgreSQL):
-- Users table (source: auth.yaml → register, login)
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT NOT NULL UNIQUE,
password TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending'
CHECK (status IN ('pending', 'active', 'disabled')),
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
Example (SQLite — using @comment structured annotations):
-- Users table (source: auth.yaml → register, login)
CREATE TABLE users (
-- @comment User unique identifier, UUID v4 string
id TEXT PRIMARY KEY NOT NULL,
-- @comment User email, normalized to lowercase
email TEXT NOT NULL UNIQUE,
-- @comment Argon2id password hash, stores hash only
password_hash TEXT NOT NULL,
-- @comment Creation time, ISO 8601 format
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
-- @comment Last update time
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
);
-- @table-comment users Users table storing core registered user information
SQLite Comment Convention: SQLite does not support
COMMENT ONsyntax. You MUST use-- @commentpreceding annotations (for columns) and-- @table-comment <table> <description>trailing annotations (for tables). Seelogos/spec/sql-comment-convention.mdfor details.
Design foreign keys based on entity relationships in the API:
/api/projects/:projectId/members → project_members table linking projects and users)ON DELETE CASCADE: child records are deleted when the parent record is deleted (e.g., user deleted → projects deleted)ON DELETE SET NULL: child records are retained but the foreign key is set to null when the parent is deletedON DELETE RESTRICT: prevent deletion of the parent record if child records existDesign corresponding security mechanisms based on the database type:
PostgreSQL — Row-Level Security (RLS):
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
CREATE POLICY projects_owner_policy ON projects
USING (owner_id = auth.uid());
MySQL — Application-Level Permissions:
Design indexes for common query patterns, with a rationale for each index:
-- User lookup by email (login scenario, source: S02)
CREATE UNIQUE INDEX idx_users_email ON users(email);
-- Project lookup by owner (project list, source: S04 Step 1)
CREATE INDEX idx_projects_owner ON projects(owner_id);
Index design principles:
Organize the DDL file in the following order:
COMMENT ON TABLE / COMMENT ON COLUMNCOMMENT-- @comment (columns) + -- @table-comment (tables), see SQLite comment rules belowAdd a comment above each DDL block noting the source API endpoint.
SQLite Comment Rules (MUST Follow):
When tech_stack.database is SQLite, you MUST use the following structured comment format:
-- @comment <description> on the line immediately above the column definition
-- @comment and the column (blank lines break the association)-- @comment lines are concatenated automatically-- @table-comment <table_name> <description> on the line immediately after CREATE TABLE ... ();FOREIGN KEY, standalone CHECK, UNIQUE) do not need -- @commenttech_stack.database)logos/resources/database/schema.sql (simple projects); or split by domain: auth.sql, billing.sql (complex projects)COMMENT ON TABLE; MySQL: COMMENT = '...'; SQLite: -- @table-comment)COMMENT ON COLUMN; MySQL: COMMENT '...' after field definition; SQLite: -- @comment)| Feature | PostgreSQL | MySQL | SQLite |
|---|---|---|---|
| UUID Primary Key | UUID DEFAULT gen_random_uuid() | CHAR(36) DEFAULT (UUID()) or BINARY(16) | TEXT PRIMARY KEY NOT NULL (app-generated UUID) |
| Timestamp Type | TIMESTAMPTZ | DATETIME / TIMESTAMP (mind timezone handling) | TEXT (ISO 8601 string) |
| JSON Support | JSONB (indexable) | JSON (limited functionality) | TEXT (app-layer JSON serialization) |
| Row-Level Security | RLS (ENABLE ROW LEVEL SECURITY) | Not supported; application layer | Not supported; application layer |
| Table Comment | COMMENT ON TABLE t IS '...' | CREATE TABLE t (...) COMMENT = '...' | -- @table-comment t description |
| Column Comment | COMMENT ON COLUMN t.c IS '...' | col_name TYPE COMMENT '...' | -- @comment description (preceding line) |
deleted_at timestamp field over physical deletioncreated_at and updated_atuserId → DB uses user_id; as long as the mapping rule is clear), reducing unnecessary transformations in the code layerid UUID DEFAULT gen_random_uuid() PRIMARY KEYTIMESTAMPTZALTER TABLE ... ENABLE ROW LEVEL SECURITY;id CHAR(36) DEFAULT (UUID()) PRIMARY KEY or auto-increment BIGINTTIMESTAMP (automatic timezone conversion) or DATETIME (stored as-is)CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci when creating tablesENGINE=InnoDBTEXT PRIMARY KEY NOT NULL (app-generated UUID v4) or INTEGER PRIMARY KEY AUTOINCREMENTTEXT with ISO 8601 strings, default DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))PRAGMA foreign_keys = ON; at connection time-- @comment / -- @table-comment structured annotations (see logos/spec/sql-comment-convention.md)updated_at must be refreshed at the application layer; do not rely on ON UPDATE triggersThe following prompts can be copied directly for use with AI:
Help me design the databaseDerive database DDL from the API specificationsHelp me design the database tables involved in S01Help me add indexes and RLS policies to the existing table structures