[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MXRQ3FNAGP2KNES5WEF0J5":3,"skill-same:01M6MXRQ3FNAGP2KNES5WEF0J5":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":26,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M6MXRQ3FNAGP2KNES5WEF0J5","db-designer",null,"Design database schema based on API and scenario requirements. Use when scenarios exist but logos\u002Fresources\u002Fdatabase\u002F is empty.","miniidealab\u002Fopenlogos","miniidealab","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F4251156?v=4","01M6MX6BM454XESZCRPBQQHKRT","FredHuang","01M6MX6BR4417H4QA658D4GW9X",581,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fplugin\u002Fskills\u002Fdb-designer\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",[27,28,29,30,31,32,33,34,35,36,37,38,39,40],"designer","db","db designer","design","database","api","use","schema","but","empty","requirements","scenario","database schema","resources","2026-11-10 10:12:30",false,"---\nname: db-designer\ndescription: \"Design database schema based on API and scenario requirements. Use when scenarios exist but logos\u002Fresources\u002Fdatabase\u002F is empty.\"\n---\n\n# Skill: DB Designer\n\n> 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.\n\n## Trigger Conditions\n\n- User requests database design or SQL writing\n- User mentions \"Phase 3 Step 2\", \"DB design\", \"table structure\"\n- API YAML specifications already exist and database design needs to be derived\n- User provides a data model that needs to be converted to DDL\n\n## Core Capabilities\n\n1. Derive table structures from API request\u002Fresponse structures\n2. Read `tech_stack.database` from `logos-project.yaml` to determine the database type\n3. Generate SQL DDL in the corresponding database dialect\n4. Design indexes with rationale for each\n5. Design security policies (RLS \u002F application-level permissions)\n6. Add comments to every table and every field\n\n## Prerequisites\n\n- `logos\u002Fresources\u002Fapi\u002F` contains API YAML specifications (output from api-designer)\n- `tech_stack.database` in `logos-project.yaml` is filled in\n\nIf 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.\n\n## Execution Steps\n\n### Step 1: Determine Database Type\n\nRead the `tech_stack` field from `logos\u002Flogos-project.yaml` to determine the database type and dialect:\n\n- PostgreSQL → Use features like UUID, TIMESTAMPTZ, RLS, JSONB, etc.\n- MySQL → Use features like InnoDB, utf8mb4, TIMESTAMP, etc.\n- SQLite → Use simplified types like INTEGER PRIMARY KEY, TEXT, etc.\n- Other → Confirm with the user and select the closest dialect\n\n### Step 2: Extract Data Entities\n\nExtract all data entities that need to be persisted from the API YAML:\n\n1. Scan `requestBody` and `responses` across all endpoints to identify core data objects\n2. Distinguish between \"needs persistence\" and \"transfer-only\" data:\n   - Objects with CRUD operations → need a table (e.g., `users`, `projects`)\n   - Objects that only appear in requests\u002Fresponses but are not stored directly → no table needed (e.g., `loginRequest`)\n3. Annotate each object with its source API endpoint\n\nOutput an entity checklist for user confirmation:\n\n```markdown\nIdentified N data entities requiring persistence from API specifications:\n\n| # | Entity | Source Endpoint | Core Fields |\n|---|--------|----------------|-------------|\n| 1 | users | auth.yaml → register, login | email, password, status |\n| 2 | projects | projects.yaml → create, list, get | name, description, owner_id |\n| 3 | subscriptions | billing.yaml → subscribe | plan, status, expires_at |\n```\n\n### Step 3: Design Table Structures\n\nDesign complete table structures for each entity, following the current database dialect:\n\n**Every table must include**:\n- Primary key (UUID or auto-increment ID, depending on dialect)\n- Business fields (mapped from API schema, with types converted to database types)\n- Audit fields: `created_at`, `updated_at`\n- Soft delete field: `deleted_at` (as needed)\n- Field constraints: `NOT NULL`, `UNIQUE`, `CHECK`, `DEFAULT`\n\n**Type mapping principles**:\n- API `string + format: email` → `TEXT NOT NULL` (with CHECK constraint or application-level validation)\n- API `string + format: uuid` → `UUID` (PostgreSQL) \u002F `CHAR(36)` (MySQL)\n- API `integer` → `INTEGER` \u002F `BIGINT`\n- API `boolean` → `BOOLEAN` (PostgreSQL) \u002F `TINYINT(1)` (MySQL)\n- API `string + enum` → `TEXT + CHECK` constraint (listing enum values)\n- Monetary fields → `INTEGER` (store in cents), **DECIMAL\u002FFLOAT is prohibited**\n\n**Example (PostgreSQL)**:\n\n```sql\n-- Users table (source: auth.yaml → register, login)\nCREATE TABLE users (\n  id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  email       TEXT NOT NULL UNIQUE,\n  password    TEXT NOT NULL,\n  status      TEXT NOT NULL DEFAULT 'pending'\n                CHECK (status IN ('pending', 'active', 'disabled')),\n  created_at  TIMESTAMPTZ NOT NULL DEFAULT now(),\n  updated_at  TIMESTAMPTZ NOT NULL DEFAULT now()\n);\n```\n\n**Example (SQLite — using `@comment` structured annotations)**:\n\n```sql\n-- Users table (source: auth.yaml → register, login)\nCREATE TABLE users (\n  -- @comment User unique identifier, UUID v4 string\n  id TEXT PRIMARY KEY NOT NULL,\n  -- @comment User email, normalized to lowercase\n  email TEXT NOT NULL UNIQUE,\n  -- @comment Argon2id password hash, stores hash only\n  password_hash TEXT NOT NULL,\n  -- @comment Creation time, ISO 8601 format\n  created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),\n  -- @comment Last update time\n  updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))\n);\n-- @table-comment users Users table storing core registered user information\n```\n\n> **SQLite Comment Convention**: SQLite does not support `COMMENT ON` syntax. You MUST use `-- @comment` preceding annotations (for columns) and `-- @table-comment \u003Ctable> \u003Cdescription>` trailing annotations (for tables). See `logos\u002Fspec\u002Fsql-comment-convention.md` for details.\n\n### Step 4: Design Table Relationships\n\nDesign foreign keys based on entity relationships in the API:\n\n1. Derive relationships from nested paths and reference fields in API endpoints (e.g., `\u002Fapi\u002Fprojects\u002F:projectId\u002Fmembers` → `project_members` table linking `projects` and `users`)\n2. Determine relationship types (one-to-many, many-to-many)\n3. Design foreign key constraints and cascade strategies:\n   - `ON DELETE CASCADE`: child records are deleted when the parent record is deleted (e.g., user deleted → projects deleted)\n   - `ON DELETE SET NULL`: child records are retained but the foreign key is set to null when the parent is deleted\n   - `ON DELETE RESTRICT`: prevent deletion of the parent record if child records exist\n\n### Step 5: Design Security Policies\n\nDesign corresponding security mechanisms based on the database type:\n\n**PostgreSQL — Row-Level Security (RLS)**:\n\n```sql\nALTER TABLE projects ENABLE ROW LEVEL SECURITY;\n\nCREATE POLICY projects_owner_policy ON projects\n  USING (owner_id = auth.uid());\n```\n\n- Enable RLS on all tables containing user data\n- Design at least one Policy per table (owner \u002F admin \u002F public)\n- Document the correspondence between RLS policies and the API authentication scheme\n\n**MySQL — Application-Level Permissions**:\n\n- Annotate data access permissions in table comments (owner-only \u002F admin \u002F public)\n- Do not implement permission control in DDL; delegate to the application layer\n\n### Step 6: Design Indexes\n\nDesign indexes for common query patterns, with a rationale for each index:\n\n```sql\n-- User lookup by email (login scenario, source: S02)\nCREATE UNIQUE INDEX idx_users_email ON users(email);\n\n-- Project lookup by owner (project list, source: S04 Step 1)\nCREATE INDEX idx_projects_owner ON projects(owner_id);\n```\n\nIndex design principles:\n- Foreign key columns: indexes are mandatory (to avoid full table scans on JOINs)\n- Unique constraint columns: unique indexes are created automatically\n- High-frequency query columns: determine based on API query parameters\n- Composite indexes: consider for multi-condition queries (leftmost prefix rule)\n- Avoid over-indexing: limit index count on write-heavy tables\n\n### Step 7: Output Complete DDL\n\nOrganize the DDL file in the following order:\n\n1. File header comment (source, database type, generation timestamp)\n2. Base tables (tables without foreign key dependencies first)\n3. Association tables (tables with foreign key dependencies after)\n4. Indexes\n5. Security policies (RLS \u002F Policy)\n6. Table and field comments:\n   - PostgreSQL: use `COMMENT ON TABLE` \u002F `COMMENT ON COLUMN`\n   - MySQL: use inline `COMMENT`\n   - SQLite: use `-- @comment` (columns) + `-- @table-comment` (tables), see SQLite comment rules below\n\nAdd a comment above each DDL block noting the source API endpoint.\n\n**SQLite Comment Rules (MUST Follow)**:\n\nWhen `tech_stack.database` is SQLite, you MUST use the following structured comment format:\n\n1. **Column comments**: write `-- @comment \u003Cdescription>` on the line **immediately above** the column definition\n   - **No blank lines** allowed between `-- @comment` and the column (blank lines break the association)\n   - Multi-line: consecutive `-- @comment` lines are concatenated automatically\n2. **Table comments**: write `-- @table-comment \u003Ctable_name> \u003Cdescription>` on the line **immediately after** `CREATE TABLE ... ();`\n3. Constraint lines (`FOREIGN KEY`, standalone `CHECK`, `UNIQUE`) do **not** need `-- @comment`\n\n## Output Specification\n\n- File format: SQL (dialect determined by `tech_stack.database`)\n- Storage location: `logos\u002Fresources\u002Fdatabase\u002F`\n- Single file output: `schema.sql` (simple projects); or split by domain: `auth.sql`, `billing.sql` (complex projects)\n- Every table must have a comment (PostgreSQL: `COMMENT ON TABLE`; MySQL: `COMMENT = '...'`; SQLite: `-- @table-comment`)\n- Every field must have a comment (PostgreSQL: `COMMENT ON COLUMN`; MySQL: `COMMENT '...'` after field definition; SQLite: `-- @comment`)\n- Add a SQL comment above each DDL block noting the source API endpoint\n\n## Database Dialect Quick Reference\n\n| Feature | PostgreSQL | MySQL | SQLite |\n|---------|-----------|-------|--------|\n| UUID Primary Key | `UUID DEFAULT gen_random_uuid()` | `CHAR(36) DEFAULT (UUID())` or `BINARY(16)` | `TEXT PRIMARY KEY NOT NULL` (app-generated UUID) |\n| Timestamp Type | `TIMESTAMPTZ` | `DATETIME` \u002F `TIMESTAMP` (mind timezone handling) | `TEXT` (ISO 8601 string) |\n| JSON Support | `JSONB` (indexable) | `JSON` (limited functionality) | `TEXT` (app-layer JSON serialization) |\n| Row-Level Security | RLS (`ENABLE ROW LEVEL SECURITY`) | Not supported; application layer | Not supported; application layer |\n| Table Comment | `COMMENT ON TABLE t IS '...'` | `CREATE TABLE t (...) COMMENT = '...'` | `-- @table-comment t description` |\n| Column Comment | `COMMENT ON COLUMN t.c IS '...'` | `col_name TYPE COMMENT '...'` | `-- @comment description` (preceding line) |\n\n## Best Practices\n\n### General (All Databases)\n\n- **Store monetary values as INTEGER in cents**: DECIMAL\u002FFLOAT is prohibited to avoid floating-point precision issues\n- **Soft delete**: prefer a `deleted_at` timestamp field over physical deletion\n- **Audit fields**: every table should include `created_at` and `updated_at`\n- **Timestamp fields with timezone**: avoid timezone pitfalls\n- **Field names aligned with API**: DB column names should match API YAML field names as closely as possible (e.g., API uses `userId` → DB uses `user_id`; as long as the mapping rule is clear), reducing unnecessary transformations in the code layer\n- **Core tables first, auxiliary tables later**: don't try to design all tables at once — output core business tables for user review first, then add auxiliary tables\n\n### PostgreSQL-Specific\n\n- **Primary key**: `id UUID DEFAULT gen_random_uuid() PRIMARY KEY`\n- **Timestamp type**: use `TIMESTAMPTZ`\n- **RLS**: enable on all tables with `ALTER TABLE ... ENABLE ROW LEVEL SECURITY;`\n- **JSONB**: prefer JSONB for unstructured storage and create GIN indexes\n\n### MySQL-Specific\n\n- **Primary key**: `id CHAR(36) DEFAULT (UUID()) PRIMARY KEY` or auto-increment BIGINT\n- **Timestamp type**: use `TIMESTAMP` (automatic timezone conversion) or `DATETIME` (stored as-is)\n- **Character set**: specify `CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci` when creating tables\n- **Engine**: always use `ENGINE=InnoDB`\n\n### SQLite-Specific\n\n- **Primary key**: `TEXT PRIMARY KEY NOT NULL` (app-generated UUID v4) or `INTEGER PRIMARY KEY AUTOINCREMENT`\n- **Timestamp type**: use `TEXT` with ISO 8601 strings, default `DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`\n- **Foreign keys**: must execute `PRAGMA foreign_keys = ON;` at connection time\n- **Comments**: MUST use `-- @comment` \u002F `-- @table-comment` structured annotations (see `logos\u002Fspec\u002Fsql-comment-convention.md`)\n- **No triggers**: `updated_at` must be refreshed at the application layer; do not rely on `ON UPDATE` triggers\n\n## Recommended Prompts\n\nThe following prompts can be copied directly for use with AI:\n\n- `Help me design the database`\n- `Derive database DDL from the API specifications`\n- `Help me design the database tables involved in S01`\n- `Help me add indexes and RLS policies to the existing table structures`\n","# Skill: DB Designer\n\n> 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.\n\n## Trigger Conditions\n\n- User requests database design or SQL writing\n- User mentions \"Phase 3 Step 2\", \"DB design\", \"table structure\"\n- API YAML specifications already exist and database design needs to be derived\n- User provides a data model that needs to be converted to DDL\n\n## Core Capabilities\n\n1. Derive table structures from API request\u002Fresponse structures\n2. Read `tech_stack.database` from `logos-project.yaml` to determine the database type\n3. Generate SQL DDL in the corresponding database dialect\n4. Design indexes with rationale for each\n5. Design security policies (RLS \u002F application-level permissions)\n6. Add comments to every table and every field\n\n## Prerequisites\n\n- `logos\u002Fresources\u002Fapi\u002F` contains API YAML specifications (output from api-designer)\n- `tech_stack.database` in `logos-project.yaml` is filled in\n\nIf 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.\n\n## Execution Steps\n\n### Step 1: Determine Database Type\n\nRead the `tech_stack` field from `logos\u002Flogos-project.yaml` to determine the database type and dialect:\n\n- PostgreSQL → Use features like UUID, TIMESTAMPTZ, RLS, JSONB, etc.\n- MySQL → Use features like InnoDB, utf8mb4, TIMESTAMP, etc.\n- SQLite → Use simplified types like INTEGER PRIMARY KEY, TEXT, etc.\n- Other → Confirm with the user and select the closest dialect\n\n### Step 2: Extract Data Entities\n\nExtract all data entities that need to be persisted from the API YAML:\n\n1. Scan `requestBody` and `responses` across all endpoints to identify core data objects\n2. Distinguish between \"needs persistence\" and \"transfer-only\" data:\n   - Objects with CRUD operations → need a table (e.g., `users`, `projects`)\n   - Objects that only appear in requests\u002Fresponses but are not stored directly → no table needed (e.g., `loginRequest`)\n3. Annotate each object with its source API endpoint\n\nOutput an entity checklist for user confirmation:\n\n```markdown\nIdentified N data entities requiring persistence from API specifications:\n\n| # | Entity | Source Endpoint | Core Fields |\n|---|--------|----------------|-------------|\n| 1 | users | auth.yaml → register, login | email, password, status |\n| 2 | projects | projects.yaml → create, list, get | name, description, owner_id |\n| 3 | subscriptions | billing.yaml → subscribe | plan, status, expires_at |\n```\n\n### Step 3: Design Table Structures\n\nDesign complete table structures for each entity, following the current database dialect:\n\n**Every table must include**:\n- Primary key (UUID or auto-increment ID, depending on dialect)\n- Business fields (mapped from API schema, with types converted to database types)\n- Audit fields: `created_at`, `updated_at`\n- Soft delete field: `deleted_at` (as needed)\n- Field constraints: `NOT NULL`, `UNIQUE`, `CHECK`, `DEFAULT`\n\n**Type mapping principles**:\n- API `string + format: email` → `TEXT NOT NULL` (with CHECK constraint or application-level validation)\n- API `string + format: uuid` → `UUID` (PostgreSQL) \u002F `CHAR(36)` (MySQL)\n- API `integer` → `INTEGER` \u002F `BIGINT`\n- API `boolean` → `BOOLEAN` (PostgreSQL) \u002F `TINYINT(1)` (MySQL)\n- API `string + enum` → `TEXT + CHECK` constraint (listing enum values)\n- Monetary fields → `INTEGER` (store in cents), **DECIMAL\u002FFLOAT is prohibited**\n\n**Example (PostgreSQL)**:\n\n```sql\n-- Users table (source: auth.yaml → register, login)\nCREATE TABLE users (\n  id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  email       TEXT NOT NULL UNIQUE,\n  password    TEXT NOT NULL,\n  status      TEXT NOT NULL DEFAULT 'pending'\n                CHECK (status IN ('pending', 'active', 'disabled')),\n  created_at  TIMESTAMPTZ NOT NULL DEFAULT now(),\n  updated_at  TIMESTAMPTZ NOT NULL DEFAULT now()\n);\n```\n\n**Example (SQLite — using `@comment` structured annotations)**:\n\n```sql\n-- Users table (source: auth.yaml → register, login)\nCREATE TABLE users (\n  -- @comment User unique identifier, UUID v4 string\n  id TEXT PRIMARY KEY NOT NULL,\n  -- @comment User email, normalized to lowercase\n  email TEXT NOT NULL UNIQUE,\n  -- @comment Argon2id password hash, stores hash only\n  password_hash TEXT NOT NULL,\n  -- @comment Creation time, ISO 8601 format\n  created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),\n  -- @comment Last update time\n  updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))\n);\n-- @table-comment users Users table storing core registered user information\n```\n\n> **SQLite Comment Convention**: SQLite does not support `COMMENT ON` syntax. You MUST use `-- @comment` preceding annotations (for columns) and `-- @table-comment \u003Ctable> \u003Cdescription>` trailing annotations (for tables). See `logos\u002Fspec\u002Fsql-comment-convention.md` for details.\n\n### Step 4: Design Table Relationships\n\nDesign foreign keys based on entity relationships in the API:\n\n1. Derive relationships from nested paths and reference fields in API endpoints (e.g., `\u002Fapi\u002Fprojects\u002F:projectId\u002Fmembers` → `project_members` table linking `projects` and `users`)\n2. Determine relationship types (one-to-many, many-to-many)\n3. Design foreign key constraints and cascade strategies:\n   - `ON DELETE CASCADE`: child records are deleted when the parent record is deleted (e.g., user deleted → projects deleted)\n   - `ON DELETE SET NULL`: child records are retained but the foreign key is set to null when the parent is deleted\n   - `ON DELETE RESTRICT`: prevent deletion of the parent record if child records exist\n\n### Step 5: Design Security Policies\n\nDesign corresponding security mechanisms based on the database type:\n\n**PostgreSQL — Row-Level Security (RLS)**:\n\n```sql\nALTER TABLE projects ENABLE ROW LEVEL SECURITY;\n\nCREATE POLICY projects_owner_policy ON projects\n  USING (owner_id = auth.uid());\n```\n\n- Enable RLS on all tables containing user data\n- Design at least one Policy per table (owner \u002F admin \u002F public)\n- Document the correspondence between RLS policies and the API authentication scheme\n\n**MySQL — Application-Level Permissions**:\n\n- Annotate data access permissions in table comments (owner-only \u002F admin \u002F public)\n- Do not implement permission control in DDL; delegate to the application layer\n\n### Step 6: Design Indexes\n\nDesign indexes for common query patterns, with a rationale for each index:\n\n```sql\n-- User lookup by email (login scenario, source: S02)\nCREATE UNIQUE INDEX idx_users_email ON users(email);\n\n-- Project lookup by owner (project list, source: S04 Step 1)\nCREATE INDEX idx_projects_owner ON projects(owner_id);\n```\n\nIndex design principles:\n- Foreign key columns: indexes are mandatory (to avoid full table scans on JOINs)\n- Unique constraint columns: unique indexes are created automatically\n- High-frequency query columns: determine based on API query parameters\n- Composite indexes: consider for multi-condition queries (leftmost prefix rule)\n- Avoid over-indexing: limit index count on write-heavy tables\n\n### Step 7: Output Complete DDL\n\nOrganize the DDL file in the following order:\n\n1. File header comment (source, database type, generation timestamp)\n2. Base tables (tables without foreign key dependencies first)\n3. Association tables (tables with foreign key dependencies after)\n4. Indexes\n5. Security policies (RLS \u002F Policy)\n6. Table and field comments:\n   - PostgreSQL: use `COMMENT ON TABLE` \u002F `COMMENT ON COLUMN`\n   - MySQL: use inline `COMMENT`\n   - SQLite: use `-- @comment` (columns) + `-- @table-comment` (tables), see SQLite comment rules below\n\nAdd a comment above each DDL block noting the source API endpoint.\n\n**SQLite Comment Rules (MUST Follow)**:\n\nWhen `tech_stack.database` is SQLite, you MUST use the following structured comment format:\n\n1. **Column comments**: write `-- @comment \u003Cdescription>` on the line **immediately above** the column definition\n   - **No blank lines** allowed between `-- @comment` and the column (blank lines break the association)\n   - Multi-line: consecutive `-- @comment` lines are concatenated automatically\n2. **Table comments**: write `-- @table-comment \u003Ctable_name> \u003Cdescription>` on the line **immediately after** `CREATE TABLE ... ();`\n3. Constraint lines (`FOREIGN KEY`, standalone `CHECK`, `UNIQUE`) do **not** need `-- @comment`\n\n## Output Specification\n\n- File format: SQL (dialect determined by `tech_stack.database`)\n- Storage location: `logos\u002Fresources\u002Fdatabase\u002F`\n- Single file output: `schema.sql` (simple projects); or split by domain: `auth.sql`, `billing.sql` (complex projects)\n- Every table must have a comment (PostgreSQL: `COMMENT ON TABLE`; MySQL: `COMMENT = '...'`; SQLite: `-- @table-comment`)\n- Every field must have a comment (PostgreSQL: `COMMENT ON COLUMN`; MySQL: `COMMENT '...'` after field definition; SQLite: `-- @comment`)\n- Add a SQL comment above each DDL block noting the source API endpoint\n\n## Database Dialect Quick Reference\n\n| Feature | PostgreSQL | MySQL | SQLite |\n|---------|-----------|-------|--------|\n| UUID Primary Key | `UUID DEFAULT gen_random_uuid()` | `CHAR(36) DEFAULT (UUID())` or `BINARY(16)` | `TEXT PRIMARY KEY NOT NULL` (app-generated UUID) |\n| Timestamp Type | `TIMESTAMPTZ` | `DATETIME` \u002F `TIMESTAMP` (mind timezone handling) | `TEXT` (ISO 8601 string) |\n| JSON Support | `JSONB` (indexable) | `JSON` (limited functionality) | `TEXT` (app-layer JSON serialization) |\n| Row-Level Security | RLS (`ENABLE ROW LEVEL SECURITY`) | Not supported; application layer | Not supported; application layer |\n| Table Comment | `COMMENT ON TABLE t IS '...'` | `CREATE TABLE t (...) COMMENT = '...'` | `-- @table-comment t description` |\n| Column Comment | `COMMENT ON COLUMN t.c IS '...'` | `col_name TYPE COMMENT '...'` | `-- @comment description` (preceding line) |\n\n## Best Practices\n\n### General (All Databases)\n\n- **Store monetary values as INTEGER in cents**: DECIMAL\u002FFLOAT is prohibited to avoid floating-point precision issues\n- **Soft delete**: prefer a `deleted_at` timestamp field over physical deletion\n- **Audit fields**: every table should include `created_at` and `updated_at`\n- **Timestamp fields with timezone**: avoid timezone pitfalls\n- **Field names aligned with API**: DB column names should match API YAML field names as closely as possible (e.g., API uses `userId` → DB uses `user_id`; as long as the mapping rule is clear), reducing unnecessary transformations in the code layer\n- **Core tables first, auxiliary tables later**: don't try to design all tables at once — output core business tables for user review first, then add auxiliary tables\n\n### PostgreSQL-Specific\n\n- **Primary key**: `id UUID DEFAULT gen_random_uuid() PRIMARY KEY`\n- **Timestamp type**: use `TIMESTAMPTZ`\n- **RLS**: enable on all tables with `ALTER TABLE ... ENABLE ROW LEVEL SECURITY;`\n- **JSONB**: prefer JSONB for unstructured storage and create GIN indexes\n\n### MySQL-Specific\n\n- **Primary key**: `id CHAR(36) DEFAULT (UUID()) PRIMARY KEY` or auto-increment BIGINT\n- **Timestamp type**: use `TIMESTAMP` (automatic timezone conversion) or `DATETIME` (stored as-is)\n- **Character set**: specify `CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci` when creating tables\n- **Engine**: always use `ENGINE=InnoDB`\n\n### SQLite-Specific\n\n- **Primary key**: `TEXT PRIMARY KEY NOT NULL` (app-generated UUID v4) or `INTEGER PRIMARY KEY AUTOINCREMENT`\n- **Timestamp type**: use `TEXT` with ISO 8601 strings, default `DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`\n- **Foreign keys**: must execute `PRAGMA foreign_keys = ON;` at connection time\n- **Comments**: MUST use `-- @comment` \u002F `-- @table-comment` structured annotations (see `logos\u002Fspec\u002Fsql-comment-convention.md`)\n- **No triggers**: `updated_at` must be refreshed at the application layer; do not rely on `ON UPDATE` triggers\n\n## Recommended Prompts\n\nThe following prompts can be copied directly for use with AI:\n\n- `Help me design the database`\n- `Derive database DDL from the API specifications`\n- `Help me design the database tables involved in S01`\n- `Help me add indexes and RLS policies to the existing table structures`\n",{"name":5,"description":7},"master","abf55fdedadaeb660f928aa7258b9ec35d4ab003","plugin\u002Fskills\u002Fdb-designer",10,"https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos","https:\u002F\u002Fgithub.com\u002Fminiidealab","2026-10-18 11:36:11",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add miniidealab\u002Fopenlogos --skill db-designer",{"tool":59,"command":60},"bunx","bunx skills add miniidealab\u002Fopenlogos --skill db-designer",{"tool":62,"command":63},"pnpm","pnpm dlx skills add miniidealab\u002Fopenlogos --skill db-designer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fplugin\u002Fskills\u002Fdb-designer\u002FSKILL.md",true,[],[68,109,121,130,138,146],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":89,"publishedAt":41},"01M6MXX45142DGRFD9ZYPT5YC9","ui-ux-pro-max","UI\u002FUX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn\u002Fui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI\u002FUX 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\u002Fui MCP for component search and examples.","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fskills\u002Fui-ux-pro-max\u002FSKILL.md",[74,77,78,81,86],{"categoryNo":75,"categoryName":76,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":79,"categoryName":80,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":82,"categoryName":83,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",{"categoryNo":87,"categoryName":88,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000033","数据分析师",[90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,30,106,107,108],"ui ux","pro","max","ui ux pro max","ui","ux","projects","mode","card","app","tsx","fix","improve","Tailwind","Charts","Animation","actions","MCP","search",{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":117,"publishedAt":41},"01M6MXWY8HJV93BBR8FPNJXAMV","test-writer","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-writer\u002FSKILL.md",[114],{"categoryNo":115,"categoryName":116,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",[118,119,120],"writer","test writer","test",{"skillNo":122,"name":123,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":127,"publishedAt":41},"01M6MXWSAMN9AD3T8F6N099ZGY","test-orchestrator","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-orchestrator\u002FSKILL.md",[126],{"categoryNo":115,"categoryName":116,"taxonomyType":21,"taxonomyTypeDesc":22},[128,129,120],"orchestrator","test orchestrator",{"skillNo":131,"name":132,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":41},"01M6MXWN29FY7K9ASMFRSPWQCN","slice-planner","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fskills\u002Fslice-planner\u002FSKILL.md",[],[136,137],"slice planner","planner",{"skillNo":139,"name":140,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":41},"01M6MXWFR1C1V66NSRTAM1FZPR","scenario-architect","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fskills\u002Fscenario-architect\u002FSKILL.md",[],[144,38,145],"architect","scenario architect",{"skillNo":147,"name":148,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":41},"01M6MXWD6ZCGPT4FDT580S8K96","project-init","https:\u002F\u002Fgithub.com\u002Fminiidealab\u002Fopenlogos\u002Fblob\u002Fmaster\u002Fskills\u002Fproject-init\u002FSKILL.md",[],[152,153,154],"project init","init","project"]