[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EESA7EVSSDDGATTFS1M3QS":3,"skill-same:01M6EESA7EVSSDDGATTFS1M3QS":71},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":30,"frontMatter":31,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":37,"ownerHtmlUrl":38,"ownerBlogUrl":6,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M6EESA7EVSSDDGATTFS1M3QS","database-schema-designer",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",66,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fdatabase-schema-designer\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[23,24,25,26,27],"database","database schema designer","designer","schema","database schema","2026-11-10 10:12:30",false,"# Database Schema Designer\n\n## Overview\n\nThis skill designs database schemas from requirements, including table structures, relationships, indexes, constraints, row-level security policies, and migration scripts. It produces production-ready SQL with proper normalization and performance considerations.\n\n## Instructions\n\n### Step 1: Understand the Domain\n\nIdentify the core entities, their relationships, and access patterns:\n- What are the main entities? (users, orders, products, etc.)\n- What are the relationships? (one-to-many, many-to-many)\n- What queries will be most frequent? (reads vs writes, filtering patterns)\n- Is multi-tenancy needed? What isolation level?\n\n### Step 2: Design the Schema\n\nApply these principles:\n- **3NF by default** — normalize to third normal form unless denormalization is justified by read performance\n- **UUIDs for public IDs** — use UUID v7 (time-ordered) for primary keys exposed to clients; serial for internal-only\n- **Timestamps everywhere** — `created_at` and `updated_at` on all tables\n- **Soft deletes when appropriate** — `deleted_at TIMESTAMPTZ` for recoverable records\n- **JSONB for flexible fields** — use for tenant-specific settings, metadata, but not for frequently queried fields\n\n### Step 3: Add Indexes\n\n```sql\n-- Always index foreign keys\nCREATE INDEX idx_tasks_project_id ON tasks(project_id);\n\n-- Composite indexes for common query patterns\nCREATE INDEX idx_tasks_project_status ON tasks(project_id, status) WHERE deleted_at IS NULL;\n\n-- Partial indexes for filtered queries\nCREATE INDEX idx_tasks_active ON tasks(assigned_to, due_date) WHERE status != 'done';\n```\n\n### Step 4: Implement Tenant Isolation (if multi-tenant)\n\nFor shared-database multi-tenancy:\n\n```sql\n-- Add tenant_id to all tenant-scoped tables\nALTER TABLE projects ADD COLUMN tenant_id UUID NOT NULL REFERENCES tenants(id);\n\n-- Enable RLS\nALTER TABLE projects ENABLE ROW LEVEL SECURITY;\n\n-- Create isolation policy\nCREATE POLICY tenant_isolation ON projects\n    FOR ALL\n    USING (tenant_id = current_setting('app.current_tenant_id')::UUID)\n    WITH CHECK (tenant_id = current_setting('app.current_tenant_id')::UUID);\n\n-- Ensure tenant_id is in composite indexes\nCREATE INDEX idx_projects_tenant ON projects(tenant_id, created_at DESC);\n```\n\n### Step 5: Generate Migration Files\n\nOutput as numbered migration files compatible with common tools:\n```\nmigrations\u002F\n  001_create_tenants.sql\n  002_create_users.sql\n  003_create_projects.sql\n  004_enable_rls_policies.sql\n```\n\nEach migration should be idempotent where possible (`CREATE TABLE IF NOT EXISTS`, `CREATE INDEX IF NOT EXISTS`).\n\n## Examples\n\n### Example 1: Project Management Schema\n\n**User prompt:**\n```\nDesign a schema for a project management app with projects, tasks, members, and comments.\n```\n\n**Agent output:**\n```sql\nCREATE TABLE projects (\n    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    tenant_id UUID NOT NULL REFERENCES tenants(id),\n    name VARCHAR(255) NOT NULL,\n    description TEXT,\n    status VARCHAR(20) NOT NULL DEFAULT 'active'\n        CHECK (status IN ('active', 'archived', 'deleted')),\n    created_by UUID NOT NULL REFERENCES users(id),\n    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),\n    updated_at TIMESTAMPTZ NOT NULL DEFAULT now()\n);\n\nCREATE TABLE tasks (\n    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,\n    tenant_id UUID NOT NULL REFERENCES tenants(id),\n    title VARCHAR(500) NOT NULL,\n    description TEXT,\n    status VARCHAR(20) NOT NULL DEFAULT 'todo'\n        CHECK (status IN ('todo', 'in_progress', 'review', 'done')),\n    priority SMALLINT NOT NULL DEFAULT 2 CHECK (priority BETWEEN 0 AND 4),\n    assigned_to UUID REFERENCES users(id),\n    due_date DATE,\n    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),\n    updated_at TIMESTAMPTZ NOT NULL DEFAULT now()\n);\n\n-- Indexes for common access patterns\nCREATE INDEX idx_tasks_project_status ON tasks(project_id, status);\nCREATE INDEX idx_tasks_assigned_due ON tasks(assigned_to, due_date)\n    WHERE status NOT IN ('done');\nCREATE INDEX idx_tasks_tenant ON tasks(tenant_id, created_at DESC);\n```\n\n### Example 2: Adding RLS to Existing Tables\n\n**User prompt:**\n```\nAdd row-level security to our existing users and orders tables for multi-tenancy.\n```\n\n**Agent output:**\n```sql\n-- Step 1: Add tenant_id if missing\nALTER TABLE orders ADD COLUMN tenant_id UUID;\nUPDATE orders SET tenant_id = (SELECT tenant_id FROM users WHERE users.id = orders.user_id);\nALTER TABLE orders ALTER COLUMN tenant_id SET NOT NULL;\n\n-- Step 2: Enable RLS\nALTER TABLE orders ENABLE ROW LEVEL SECURITY;\nALTER TABLE users ENABLE ROW LEVEL SECURITY;\n\n-- Step 3: Create policies\nCREATE POLICY tenant_orders ON orders FOR ALL\n    USING (tenant_id = current_setting('app.current_tenant_id')::UUID);\n\nCREATE POLICY tenant_users ON users FOR ALL\n    USING (tenant_id = current_setting('app.current_tenant_id')::UUID);\n\n-- Step 4: Superuser bypass (for admin\u002Fmigration scripts)\nALTER TABLE orders FORCE ROW LEVEL SECURITY;\nCREATE POLICY admin_bypass ON orders FOR ALL TO admin_role USING (true);\n```\n\n## Guidelines\n\n- **RLS policies must cover ALL operations** — use `FOR ALL` or create separate policies for SELECT, INSERT, UPDATE, DELETE\n- **Test RLS thoroughly** — write integration tests that attempt cross-tenant access and verify it fails\n- **Index tenant_id first in composite indexes** — PostgreSQL uses leftmost columns for index scans\n- **Don't over-normalize** — if you always fetch user.name with orders, a denormalized `order.user_name` saves a JOIN on read-heavy tables\n- **Use CHECK constraints** — they're free documentation and prevent invalid data at the database level\n- **Foreign keys with ON DELETE** — always specify CASCADE, SET NULL, or RESTRICT explicitly\n- **Consider partitioning at scale** — for tables exceeding 100M rows, partition by tenant_id or date range\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fdatabase-schema-designer",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill database-schema-designer",{"tool":47,"command":48},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill database-schema-designer",{"tool":50,"command":51},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill database-schema-designer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fdatabase-schema-designer\u002FSKILL.md",true,[55,61,67],{"path":56,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":59,"sourceHtmlUrl":60},"checklist.md","REFERENCE","参考文档",1298,"https:\u002F\u002Fgithub.com\u002Fjsacko\u002FOpenDFIR\u002Fblob\u002Fmain\u002F.continue\u002Fskills\u002Fbmad-sprint-planning\u002Fchecklist.md",{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"customize.toml","OTHER","其他",1606,"https:\u002F\u002Fgithub.com\u002Fjsacko\u002FOpenDFIR\u002Fblob\u002Fmain\u002F.continue\u002Fskills\u002Fbmad-sprint-planning\u002Fcustomize.toml",{"path":68,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":69,"sourceHtmlUrl":70},"sprint-status-template.yaml",1790,"https:\u002F\u002Fgithub.com\u002Fjsacko\u002FOpenDFIR\u002Fblob\u002Fmain\u002F.continue\u002Fskills\u002Fbmad-sprint-planning\u002Fsprint-status-template.yaml",[72,84,94,103,109,116],{"skillNo":73,"name":74,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":80,"publishedAt":28},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[77],{"categoryNo":78,"categoryName":79,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[81,82,83],"model","model hierarchy","model hierarchy skill",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":90,"publishedAt":28},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[89],{"categoryNo":78,"categoryName":79,"taxonomyType":20,"taxonomyTypeDesc":21},[91,92,93],"MCP","zoom","zoom mcp",{"skillNo":95,"name":96,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":28},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[100,101,102,92],"sdk","zoom apps sdk","apps",{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":28},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[105],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":115,"publishedAt":28},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[114],{"categoryNo":78,"categoryName":79,"taxonomyType":20,"taxonomyTypeDesc":21},[111],{"skillNo":117,"name":118,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":28},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[118]]