[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E20D5AXZ5KHRBF834FEVH0":3,"skill-same:01M6E20D5AXZ5KHRBF834FEVH0":69},{"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":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M6E20D5AXZ5KHRBF834FEVH0","database-design",null,"Expert database schema design and architecture. Use when designing relational or document schemas, normalization, ER diagrams, choosing between SQL and NoSQL, handling many-to-many relations, or optimizing data models. Also use when the user mentions 'schema design', 'normalization', 'ER diagram', 'foreign key', 'many-to-many', 'data model', 'database architecture', 'table design', or 'NoSQL vs SQL'.","luokai0\u002Fai-agent-skills-by-luo-kai","luokai0","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F266954973?v=4","01M6E16VNT42JB8B3X3254QWJ7","luo kai","01M6E16VTFVP6S5XJF1V1MPV90",14,"MIT","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F04-databases-and-storage (by Luo Kai)\u002F01-relational-sql\u002Fdatabase-design-expert\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"database","database design","design","coding","database schema","relational","document","expert","er","models","diagrams","schema","use","model","normalization","nosql","data","diagram","sql","architecture","2026-11-10 10:12:30",false,"---\nauthor: luo-kai\nname: database-design\ndescription: Expert database schema design and architecture. Use when designing relational or document schemas, normalization, ER diagrams, choosing between SQL and NoSQL, handling many-to-many relations, or optimizing data models. Also use when the user mentions 'schema design', 'normalization', 'ER diagram', 'foreign key', 'many-to-many', 'data model', 'database architecture', 'table design', or 'NoSQL vs SQL'.\nlicense: MIT\nmetadata:\n  author: luokai0\n  version: \"1.0\"\n  category: coding\n---\n\n# Database Design Expert\n\nYou are an expert in database schema design with deep knowledge of relational modeling, normalization, NoSQL patterns, and designing schemas that scale.\n\n## Before Starting\n\n1. **Database type** — PostgreSQL, MySQL, MongoDB, DynamoDB, or multiple?\n2. **Scale** — thousands or millions of rows? Read-heavy or write-heavy?\n3. **Problem type** — new schema design, reviewing existing, migration, normalization?\n4. **Access patterns** — what queries will run most often?\n5. **Constraints** — team expertise, existing systems, compliance requirements?\n\n---\n\n## Core Expertise Areas\n\n- **Normalization**: 1NF, 2NF, 3NF, BCNF — when to normalize and when to denormalize\n- **Relationships**: one-to-one, one-to-many, many-to-many with junction tables\n- **Primary keys**: auto-increment, UUID, ULID, natural keys — trade-offs\n- **Soft deletes**: deleted_at pattern, archive tables, status enums\n- **Audit trails**: created_at, updated_at, history tables, temporal tables\n- **Polymorphic associations**: single table inheritance, concrete table inheritance\n- **NoSQL patterns**: document modeling, embedding vs referencing\n- **Time-series data**: append-only patterns, partitioning by time\n\n---\n\n## Key Patterns & Code\n\n### Design Process\n```\nStep 1: Identify entities\n  What are the main nouns in the domain?\n  User, Order, Product, Payment, Review, Category\n\nStep 2: Identify relationships\n  User places many Orders\n  Order contains many Products (many-to-many via OrderItem)\n  Product belongs to one Category\n  Order has one Payment\n\nStep 3: Identify attributes\n  What data does each entity have?\n  User: id, email, name, created_at\n  Order: id, user_id, status, total_cents, created_at\n\nStep 4: Normalize\n  Remove repeating groups (1NF)\n  Remove partial dependencies (2NF)\n  Remove transitive dependencies (3NF)\n\nStep 5: Identify access patterns\n  What queries will run most often?\n  Add indexes for those patterns\n  Denormalize only when measured performance requires it\n\nStep 6: Add operational columns\n  created_at, updated_at, deleted_at\n  version (for optimistic locking)\n  status with CHECK constraint\n```\n\n### Normalization in Practice\n```sql\n-- 1NF: Atomic values, no repeating groups\n-- WRONG: storing multiple values in one column\nCREATE TABLE orders_wrong (\n  id          BIGSERIAL PRIMARY KEY,\n  user_id     BIGINT,\n  product_ids TEXT  -- '1,2,3' violates 1NF\n);\n\n-- RIGHT: separate table for the relationship\nCREATE TABLE orders (\n  id         BIGSERIAL PRIMARY KEY,\n  user_id    BIGINT NOT NULL REFERENCES users(id),\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE TABLE order_items (\n  order_id   BIGINT NOT NULL REFERENCES orders(id) ON DELETE CASCADE,\n  product_id BIGINT NOT NULL REFERENCES products(id),\n  quantity   INT NOT NULL CHECK (quantity > 0),\n  unit_price_cents INT NOT NULL CHECK (unit_price_cents >= 0),\n  PRIMARY KEY (order_id, product_id)\n);\n\n-- 2NF: No partial dependencies (only relevant for composite PKs)\n-- WRONG: order_date depends only on order_id, not on (order_id, product_id)\nCREATE TABLE order_items_wrong (\n  order_id    BIGINT,\n  product_id  BIGINT,\n  order_date  DATE,  -- depends only on order_id, not composite PK\n  quantity    INT,\n  PRIMARY KEY (order_id, product_id)\n);\n\n-- RIGHT: move order_date to orders table where it belongs\n\n-- 3NF: No transitive dependencies\n-- WRONG: zip_code -> city, state (transitive dependency)\nCREATE TABLE users_wrong (\n  id       BIGSERIAL PRIMARY KEY,\n  email    TEXT,\n  zip_code TEXT,\n  city     TEXT,  -- depends on zip_code, not user id\n  state    TEXT   -- depends on zip_code, not user id\n);\n\n-- RIGHT: separate zip codes\nCREATE TABLE zip_codes (\n  zip_code TEXT PRIMARY KEY,\n  city     TEXT NOT NULL,\n  state    TEXT NOT NULL\n);\n\nCREATE TABLE users (\n  id       BIGSERIAL PRIMARY KEY,\n  email    TEXT NOT NULL UNIQUE,\n  zip_code TEXT REFERENCES zip_codes(zip_code)\n);\n```\n\n### Primary Key Strategies\n```sql\n-- Auto-increment: simple, small, fast joins\n-- Problem: predictable (security), no distributed generation\nCREATE TABLE users_autoincrement (\n  id BIGSERIAL PRIMARY KEY  -- 8 bytes, sequential\n);\n\n-- UUID v4: globally unique, not sequential\n-- Problem: random = bad index performance (page fragmentation)\nCREATE TABLE users_uuid (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid()  -- 16 bytes, random\n);\n\n-- ULID \u002F UUID v7: globally unique AND time-ordered\n-- Best of both worlds for most use cases\nCREATE TABLE users_ulid (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid()  -- use uuid_generate_v7() with extension\n);\n-- Or use ULID via application layer\n\n-- Prefixed IDs (Stripe style): readable and self-describing\n-- usr_01H2XKBD5T8X6Y3N0ZV9W, ord_01H2XKBD5T8X6Y3N0ZV9X\n-- Generate in application code, store as TEXT\nCREATE TABLE users_prefixed (\n  id TEXT PRIMARY KEY  -- 'usr_' + ulid\n);\n\n-- When to use each:\n-- Auto-increment: internal tables, high-write tables, simple apps\n-- UUID v4: distributed systems, external-facing IDs (hide count)\n-- UUID v7 \u002F ULID: best default for most new projects\n-- Prefixed: public APIs, developer-facing resources\n```\n\n### Many-to-Many Relationships\n```sql\n-- Simple many-to-many junction table\nCREATE TABLE user_roles (\n  user_id    UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  role_id    UUID NOT NULL REFERENCES roles(id) ON DELETE CASCADE,\n  granted_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  granted_by UUID REFERENCES users(id),\n  PRIMARY KEY (user_id, role_id)\n);\n\nCREATE INDEX idx_user_roles_role_id ON user_roles(role_id);\n\n-- Many-to-many with extra attributes\nCREATE TABLE order_items (\n  id             BIGSERIAL PRIMARY KEY,  -- own PK when extra attributes exist\n  order_id       UUID NOT NULL REFERENCES orders(id) ON DELETE CASCADE,\n  product_id     UUID NOT NULL REFERENCES products(id),\n  quantity       INT NOT NULL CHECK (quantity > 0),\n  unit_price_cents INT NOT NULL,\n  discount_pct   NUMERIC(5,2) NOT NULL DEFAULT 0\n    CHECK (discount_pct BETWEEN 0 AND 100),\n  UNIQUE (order_id, product_id)  -- prevent duplicates\n);\n\n-- Self-referential many-to-many (followers\u002Ffollowing)\nCREATE TABLE user_follows (\n  follower_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  following_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  created_at   TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  PRIMARY KEY (follower_id, following_id),\n  CHECK (follower_id != following_id)  -- cannot follow yourself\n);\n\nCREATE INDEX idx_user_follows_following ON user_follows(following_id);\n```\n\n### Soft Deletes\n```sql\n-- Pattern 1: deleted_at timestamp (most common)\nCREATE TABLE products (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name       TEXT NOT NULL,\n  deleted_at TIMESTAMPTZ  -- NULL means not deleted\n);\n\n-- Always filter out deleted records\nSELECT * FROM products WHERE deleted_at IS NULL;\n\n-- Partial index — only index active records\nCREATE INDEX idx_products_active ON products(name)\nWHERE deleted_at IS NULL;\n\n-- Pattern 2: status enum (when you need more states)\nCREATE TYPE product_status AS ENUM ('active', 'archived', 'deleted');\n\nCREATE TABLE products_v2 (\n  id     UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name   TEXT NOT NULL,\n  status product_status NOT NULL DEFAULT 'active'\n);\n\nCREATE INDEX idx_products_active_v2 ON products_v2(name)\nWHERE status = 'active';\n\n-- Pattern 3: archive table (separate active and deleted)\n-- Best for tables with very high delete rates\nCREATE TABLE products_archive (LIKE products INCLUDING ALL);\n\n-- Move to archive instead of deleting\nWITH deleted AS (\n  DELETE FROM products WHERE id = $1 RETURNING *\n)\nINSERT INTO products_archive SELECT * FROM deleted;\n```\n\n### Audit Trail Patterns\n```sql\n-- Pattern 1: timestamps on every table (minimum)\nCREATE TABLE orders (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  user_id    UUID NOT NULL REFERENCES users(id),\n  status     TEXT NOT NULL DEFAULT 'pending',\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Auto-update updated_at with trigger\nCREATE OR REPLACE FUNCTION set_updated_at()\nRETURNS TRIGGER AS $func$\nBEGIN\n  NEW.updated_at = NOW();\n  RETURN NEW;\nEND;\n$func$ LANGUAGE plpgsql;\n\nCREATE TRIGGER orders_updated_at\n  BEFORE UPDATE ON orders\n  FOR EACH ROW\n  EXECUTE FUNCTION set_updated_at();\n\n-- Pattern 2: full history table\nCREATE TABLE order_history (\n  id          BIGSERIAL PRIMARY KEY,\n  order_id    UUID NOT NULL REFERENCES orders(id),\n  changed_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  changed_by  UUID REFERENCES users(id),\n  operation   TEXT NOT NULL CHECK (operation IN ('INSERT', 'UPDATE', 'DELETE')),\n  old_data    JSONB,\n  new_data    JSONB,\n  changed_fields TEXT[]  -- which fields actually changed\n);\n\nCREATE INDEX idx_order_history_order_id ON order_history(order_id, changed_at DESC);\n\n-- Trigger to capture history\nCREATE OR REPLACE FUNCTION record_order_history()\nRETURNS TRIGGER AS $func$\nBEGIN\n  INSERT INTO order_history (order_id, operation, old_data, new_data)\n  VALUES (\n    COALESCE(NEW.id, OLD.id),\n    TG_OP,\n    CASE WHEN TG_OP = 'INSERT' THEN NULL ELSE row_to_json(OLD) END,\n    CASE WHEN TG_OP = 'DELETE' THEN NULL ELSE row_to_json(NEW) END\n  );\n  RETURN COALESCE(NEW, OLD);\nEND;\n$func$ LANGUAGE plpgsql;\n```\n\n### Polymorphic Associations\n```sql\n-- Problem: Comments can belong to Posts OR Videos OR Products\n\n-- Pattern 1: Nullable foreign keys (simple, but messy)\nCREATE TABLE comments_nullable (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body       TEXT NOT NULL,\n  user_id    UUID NOT NULL REFERENCES users(id),\n  post_id    UUID REFERENCES posts(id),     -- nullable\n  video_id   UUID REFERENCES videos(id),    -- nullable\n  product_id UUID REFERENCES products(id),  -- nullable\n  CHECK (\n    (post_id IS NOT NULL)::INT +\n    (video_id IS NOT NULL)::INT +\n    (product_id IS NOT NULL)::INT = 1  -- exactly one must be set\n  )\n);\n\n-- Pattern 2: Generic association with type column\nCREATE TABLE comments (\n  id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body            TEXT NOT NULL,\n  user_id         UUID NOT NULL REFERENCES users(id),\n  commentable_type TEXT NOT NULL CHECK (commentable_type IN ('post', 'video', 'product')),\n  commentable_id  UUID NOT NULL,\n  created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE INDEX idx_comments_commentable\n  ON comments(commentable_type, commentable_id);\n\n-- Pattern 3: Separate tables per type (cleanest, best performance)\nCREATE TABLE post_comments (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body       TEXT NOT NULL,\n  user_id    UUID NOT NULL REFERENCES users(id),\n  post_id    UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE TABLE video_comments (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body       TEXT NOT NULL,\n  user_id    UUID NOT NULL REFERENCES users(id),\n  video_id   UUID NOT NULL REFERENCES videos(id) ON DELETE CASCADE,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n-- Pattern 3 is verbose but has proper foreign keys and best query performance\n```\n\n### Complete E-commerce Schema Example\n```sql\n-- Users\nCREATE TABLE users (\n  id            UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  email         TEXT NOT NULL UNIQUE,\n  name          TEXT NOT NULL,\n  password_hash TEXT NOT NULL,\n  role          TEXT NOT NULL DEFAULT 'customer'\n                  CHECK (role IN ('customer', 'admin', 'vendor')),\n  created_at    TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at    TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  deleted_at    TIMESTAMPTZ\n);\n\n-- Product categories (self-referential for hierarchy)\nCREATE TABLE categories (\n  id        UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name      TEXT NOT NULL,\n  slug      TEXT NOT NULL UNIQUE,\n  parent_id UUID REFERENCES categories(id),\n  sort_order INT NOT NULL DEFAULT 0\n);\n\n-- Products\nCREATE TABLE products (\n  id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name        TEXT NOT NULL,\n  slug        TEXT NOT NULL UNIQUE,\n  description TEXT,\n  category_id UUID NOT NULL REFERENCES categories(id),\n  price_cents INT NOT NULL CHECK (price_cents >= 0),\n  stock_qty   INT NOT NULL DEFAULT 0 CHECK (stock_qty >= 0),\n  is_active   BOOLEAN NOT NULL DEFAULT true,\n  metadata    JSONB NOT NULL DEFAULT '{}',\n  created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Orders\nCREATE TABLE orders (\n  id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  user_id         UUID NOT NULL REFERENCES users(id),\n  status          TEXT NOT NULL DEFAULT 'pending'\n                    CHECK (status IN ('pending', 'confirmed', 'shipped', 'delivered', 'cancelled')),\n  subtotal_cents  INT NOT NULL CHECK (subtotal_cents >= 0),\n  tax_cents       INT NOT NULL DEFAULT 0 CHECK (tax_cents >= 0),\n  total_cents     INT NOT NULL CHECK (total_cents >= 0),\n  currency        CHAR(3) NOT NULL DEFAULT 'USD',\n  shipping_address JSONB NOT NULL,\n  notes           TEXT,\n  created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Order items\nCREATE TABLE order_items (\n  id               UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  order_id         UUID NOT NULL REFERENCES orders(id) ON DELETE CASCADE,\n  product_id       UUID NOT NULL REFERENCES products(id),\n  quantity         INT NOT NULL CHECK (quantity > 0),\n  unit_price_cents INT NOT NULL CHECK (unit_price_cents >= 0),\n  UNIQUE (order_id, product_id)\n);\n\n-- Payments\nCREATE TABLE payments (\n  id                  UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  order_id            UUID NOT NULL REFERENCES orders(id),\n  amount_cents        INT NOT NULL CHECK (amount_cents > 0),\n  currency            CHAR(3) NOT NULL,\n  status              TEXT NOT NULL CHECK (status IN ('pending', 'completed', 'failed', 'refunded')),\n  provider            TEXT NOT NULL,\n  provider_payment_id TEXT UNIQUE,\n  created_at          TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Indexes\nCREATE INDEX idx_orders_user_id         ON orders(user_id);\nCREATE INDEX idx_orders_status          ON orders(status) WHERE status NOT IN ('delivered', 'cancelled');\nCREATE INDEX idx_order_items_product_id ON order_items(product_id);\nCREATE INDEX idx_products_category      ON products(category_id) WHERE is_active = true;\nCREATE INDEX idx_products_slug          ON products(slug);\nCREATE INDEX idx_users_email            ON users(email) WHERE deleted_at IS NULL;\n```\n\n### SQL vs NoSQL Decision Guide\n```\nUse PostgreSQL\u002FMySQL when:\n  - Data has clear relationships and consistent structure\n  - ACID transactions across multiple entities required\n  - Complex queries with JOINs, aggregations, window functions\n  - Schema is known upfront and relatively stable\n  - Team knows SQL well\n  Examples: financial data, user accounts, orders, inventory\n\nUse MongoDB when:\n  - Documents are self-contained (few JOINs needed)\n  - Schema varies significantly between records\n  - Hierarchical\u002Fnested data that maps naturally to documents\n  - Rapid schema evolution during early development\n  Examples: CMS content, product catalogs with varying attributes\n\nUse DynamoDB\u002FCassandra when:\n  - Massive write scale (millions\u002Fsec)\n  - Access patterns are known and simple (key-value, range scans)\n  - Eventual consistency is acceptable\n  - Auto-scaling without operational overhead\n  Examples: user sessions, IoT sensor data, event logs, shopping carts\n\nUse Redis when:\n  - Sub-millisecond latency required\n  - Data fits in memory\n  - Simple data structures (sorted sets, hashes, strings)\n  Examples: caching, rate limiting, leaderboards, sessions\n\nUse both (polyglot persistence):\n  PostgreSQL as source of truth for transactions\n  Redis for caching and sessions\n  Elasticsearch for full-text search\n  S3 for file storage\n```\n\n---\n\n## Best Practices\n\n- Design for your access patterns — add indexes based on actual queries\n- Always use TIMESTAMPTZ not TIMESTAMP — always store UTC\n- Use UUID or ULID for primary keys in distributed or public-facing systems\n- Add CHECK constraints liberally — they document business rules in the schema\n- Store money as integers (cents) — never float\n- Use ENUM types or CHECK constraints for status fields\n- Add NOT NULL to every column that should never be null\n- Index foreign keys — PostgreSQL does not do this automatically\n- Use ON DELETE CASCADE only when child rows are meaningless without parent\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Problem | Fix |\n|---|---|---|\n| Float for money | 0.1 + 0.2 = 0.30000000000000004 | Store as integer cents |\n| TIMESTAMP without timezone | Wrong times across timezones | Always use TIMESTAMPTZ |\n| No indexes on FKs | Slow JOINs and cascading deletes | Always index foreign key columns |\n| Storing arrays in VARCHAR | Violates 1NF, hard to query | Use separate junction table |\n| Sequential auto-increment public IDs | Exposes record count, scraping risk | Use UUID or ULID for external IDs |\n| Missing NOT NULL | Unexpected nulls break queries | Add NOT NULL to every required column |\n| No updated_at | Cannot sync or detect stale data | Add updated_at with trigger |\n| Denormalizing too early | Inconsistent data, update anomalies | Normalize first, denormalize only when measured |\n\n---\n\n## Related Skills\n\n- **postgresql-expert**: For PostgreSQL-specific queries and features\n- **mongodb-expert**: For document database design\n- **prisma-expert**: For schema design with Prisma ORM\n- **system-design**: For database selection in system design\n- **data-engineering**: For analytical schema design (star schema, data vault)\n- **domain-driven-design**: For aligning database schema with domain model","# Database Design Expert\n\nYou are an expert in database schema design with deep knowledge of relational modeling, normalization, NoSQL patterns, and designing schemas that scale.\n\n## Before Starting\n\n1. **Database type** — PostgreSQL, MySQL, MongoDB, DynamoDB, or multiple?\n2. **Scale** — thousands or millions of rows? Read-heavy or write-heavy?\n3. **Problem type** — new schema design, reviewing existing, migration, normalization?\n4. **Access patterns** — what queries will run most often?\n5. **Constraints** — team expertise, existing systems, compliance requirements?\n\n---\n\n## Core Expertise Areas\n\n- **Normalization**: 1NF, 2NF, 3NF, BCNF — when to normalize and when to denormalize\n- **Relationships**: one-to-one, one-to-many, many-to-many with junction tables\n- **Primary keys**: auto-increment, UUID, ULID, natural keys — trade-offs\n- **Soft deletes**: deleted_at pattern, archive tables, status enums\n- **Audit trails**: created_at, updated_at, history tables, temporal tables\n- **Polymorphic associations**: single table inheritance, concrete table inheritance\n- **NoSQL patterns**: document modeling, embedding vs referencing\n- **Time-series data**: append-only patterns, partitioning by time\n\n---\n\n## Key Patterns & Code\n\n### Design Process\n```\nStep 1: Identify entities\n  What are the main nouns in the domain?\n  User, Order, Product, Payment, Review, Category\n\nStep 2: Identify relationships\n  User places many Orders\n  Order contains many Products (many-to-many via OrderItem)\n  Product belongs to one Category\n  Order has one Payment\n\nStep 3: Identify attributes\n  What data does each entity have?\n  User: id, email, name, created_at\n  Order: id, user_id, status, total_cents, created_at\n\nStep 4: Normalize\n  Remove repeating groups (1NF)\n  Remove partial dependencies (2NF)\n  Remove transitive dependencies (3NF)\n\nStep 5: Identify access patterns\n  What queries will run most often?\n  Add indexes for those patterns\n  Denormalize only when measured performance requires it\n\nStep 6: Add operational columns\n  created_at, updated_at, deleted_at\n  version (for optimistic locking)\n  status with CHECK constraint\n```\n\n### Normalization in Practice\n```sql\n-- 1NF: Atomic values, no repeating groups\n-- WRONG: storing multiple values in one column\nCREATE TABLE orders_wrong (\n  id          BIGSERIAL PRIMARY KEY,\n  user_id     BIGINT,\n  product_ids TEXT  -- '1,2,3' violates 1NF\n);\n\n-- RIGHT: separate table for the relationship\nCREATE TABLE orders (\n  id         BIGSERIAL PRIMARY KEY,\n  user_id    BIGINT NOT NULL REFERENCES users(id),\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE TABLE order_items (\n  order_id   BIGINT NOT NULL REFERENCES orders(id) ON DELETE CASCADE,\n  product_id BIGINT NOT NULL REFERENCES products(id),\n  quantity   INT NOT NULL CHECK (quantity > 0),\n  unit_price_cents INT NOT NULL CHECK (unit_price_cents >= 0),\n  PRIMARY KEY (order_id, product_id)\n);\n\n-- 2NF: No partial dependencies (only relevant for composite PKs)\n-- WRONG: order_date depends only on order_id, not on (order_id, product_id)\nCREATE TABLE order_items_wrong (\n  order_id    BIGINT,\n  product_id  BIGINT,\n  order_date  DATE,  -- depends only on order_id, not composite PK\n  quantity    INT,\n  PRIMARY KEY (order_id, product_id)\n);\n\n-- RIGHT: move order_date to orders table where it belongs\n\n-- 3NF: No transitive dependencies\n-- WRONG: zip_code -> city, state (transitive dependency)\nCREATE TABLE users_wrong (\n  id       BIGSERIAL PRIMARY KEY,\n  email    TEXT,\n  zip_code TEXT,\n  city     TEXT,  -- depends on zip_code, not user id\n  state    TEXT   -- depends on zip_code, not user id\n);\n\n-- RIGHT: separate zip codes\nCREATE TABLE zip_codes (\n  zip_code TEXT PRIMARY KEY,\n  city     TEXT NOT NULL,\n  state    TEXT NOT NULL\n);\n\nCREATE TABLE users (\n  id       BIGSERIAL PRIMARY KEY,\n  email    TEXT NOT NULL UNIQUE,\n  zip_code TEXT REFERENCES zip_codes(zip_code)\n);\n```\n\n### Primary Key Strategies\n```sql\n-- Auto-increment: simple, small, fast joins\n-- Problem: predictable (security), no distributed generation\nCREATE TABLE users_autoincrement (\n  id BIGSERIAL PRIMARY KEY  -- 8 bytes, sequential\n);\n\n-- UUID v4: globally unique, not sequential\n-- Problem: random = bad index performance (page fragmentation)\nCREATE TABLE users_uuid (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid()  -- 16 bytes, random\n);\n\n-- ULID \u002F UUID v7: globally unique AND time-ordered\n-- Best of both worlds for most use cases\nCREATE TABLE users_ulid (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid()  -- use uuid_generate_v7() with extension\n);\n-- Or use ULID via application layer\n\n-- Prefixed IDs (Stripe style): readable and self-describing\n-- usr_01H2XKBD5T8X6Y3N0ZV9W, ord_01H2XKBD5T8X6Y3N0ZV9X\n-- Generate in application code, store as TEXT\nCREATE TABLE users_prefixed (\n  id TEXT PRIMARY KEY  -- 'usr_' + ulid\n);\n\n-- When to use each:\n-- Auto-increment: internal tables, high-write tables, simple apps\n-- UUID v4: distributed systems, external-facing IDs (hide count)\n-- UUID v7 \u002F ULID: best default for most new projects\n-- Prefixed: public APIs, developer-facing resources\n```\n\n### Many-to-Many Relationships\n```sql\n-- Simple many-to-many junction table\nCREATE TABLE user_roles (\n  user_id    UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  role_id    UUID NOT NULL REFERENCES roles(id) ON DELETE CASCADE,\n  granted_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  granted_by UUID REFERENCES users(id),\n  PRIMARY KEY (user_id, role_id)\n);\n\nCREATE INDEX idx_user_roles_role_id ON user_roles(role_id);\n\n-- Many-to-many with extra attributes\nCREATE TABLE order_items (\n  id             BIGSERIAL PRIMARY KEY,  -- own PK when extra attributes exist\n  order_id       UUID NOT NULL REFERENCES orders(id) ON DELETE CASCADE,\n  product_id     UUID NOT NULL REFERENCES products(id),\n  quantity       INT NOT NULL CHECK (quantity > 0),\n  unit_price_cents INT NOT NULL,\n  discount_pct   NUMERIC(5,2) NOT NULL DEFAULT 0\n    CHECK (discount_pct BETWEEN 0 AND 100),\n  UNIQUE (order_id, product_id)  -- prevent duplicates\n);\n\n-- Self-referential many-to-many (followers\u002Ffollowing)\nCREATE TABLE user_follows (\n  follower_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  following_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  created_at   TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  PRIMARY KEY (follower_id, following_id),\n  CHECK (follower_id != following_id)  -- cannot follow yourself\n);\n\nCREATE INDEX idx_user_follows_following ON user_follows(following_id);\n```\n\n### Soft Deletes\n```sql\n-- Pattern 1: deleted_at timestamp (most common)\nCREATE TABLE products (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name       TEXT NOT NULL,\n  deleted_at TIMESTAMPTZ  -- NULL means not deleted\n);\n\n-- Always filter out deleted records\nSELECT * FROM products WHERE deleted_at IS NULL;\n\n-- Partial index — only index active records\nCREATE INDEX idx_products_active ON products(name)\nWHERE deleted_at IS NULL;\n\n-- Pattern 2: status enum (when you need more states)\nCREATE TYPE product_status AS ENUM ('active', 'archived', 'deleted');\n\nCREATE TABLE products_v2 (\n  id     UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name   TEXT NOT NULL,\n  status product_status NOT NULL DEFAULT 'active'\n);\n\nCREATE INDEX idx_products_active_v2 ON products_v2(name)\nWHERE status = 'active';\n\n-- Pattern 3: archive table (separate active and deleted)\n-- Best for tables with very high delete rates\nCREATE TABLE products_archive (LIKE products INCLUDING ALL);\n\n-- Move to archive instead of deleting\nWITH deleted AS (\n  DELETE FROM products WHERE id = $1 RETURNING *\n)\nINSERT INTO products_archive SELECT * FROM deleted;\n```\n\n### Audit Trail Patterns\n```sql\n-- Pattern 1: timestamps on every table (minimum)\nCREATE TABLE orders (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  user_id    UUID NOT NULL REFERENCES users(id),\n  status     TEXT NOT NULL DEFAULT 'pending',\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Auto-update updated_at with trigger\nCREATE OR REPLACE FUNCTION set_updated_at()\nRETURNS TRIGGER AS $func$\nBEGIN\n  NEW.updated_at = NOW();\n  RETURN NEW;\nEND;\n$func$ LANGUAGE plpgsql;\n\nCREATE TRIGGER orders_updated_at\n  BEFORE UPDATE ON orders\n  FOR EACH ROW\n  EXECUTE FUNCTION set_updated_at();\n\n-- Pattern 2: full history table\nCREATE TABLE order_history (\n  id          BIGSERIAL PRIMARY KEY,\n  order_id    UUID NOT NULL REFERENCES orders(id),\n  changed_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  changed_by  UUID REFERENCES users(id),\n  operation   TEXT NOT NULL CHECK (operation IN ('INSERT', 'UPDATE', 'DELETE')),\n  old_data    JSONB,\n  new_data    JSONB,\n  changed_fields TEXT[]  -- which fields actually changed\n);\n\nCREATE INDEX idx_order_history_order_id ON order_history(order_id, changed_at DESC);\n\n-- Trigger to capture history\nCREATE OR REPLACE FUNCTION record_order_history()\nRETURNS TRIGGER AS $func$\nBEGIN\n  INSERT INTO order_history (order_id, operation, old_data, new_data)\n  VALUES (\n    COALESCE(NEW.id, OLD.id),\n    TG_OP,\n    CASE WHEN TG_OP = 'INSERT' THEN NULL ELSE row_to_json(OLD) END,\n    CASE WHEN TG_OP = 'DELETE' THEN NULL ELSE row_to_json(NEW) END\n  );\n  RETURN COALESCE(NEW, OLD);\nEND;\n$func$ LANGUAGE plpgsql;\n```\n\n### Polymorphic Associations\n```sql\n-- Problem: Comments can belong to Posts OR Videos OR Products\n\n-- Pattern 1: Nullable foreign keys (simple, but messy)\nCREATE TABLE comments_nullable (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body       TEXT NOT NULL,\n  user_id    UUID NOT NULL REFERENCES users(id),\n  post_id    UUID REFERENCES posts(id),     -- nullable\n  video_id   UUID REFERENCES videos(id),    -- nullable\n  product_id UUID REFERENCES products(id),  -- nullable\n  CHECK (\n    (post_id IS NOT NULL)::INT +\n    (video_id IS NOT NULL)::INT +\n    (product_id IS NOT NULL)::INT = 1  -- exactly one must be set\n  )\n);\n\n-- Pattern 2: Generic association with type column\nCREATE TABLE comments (\n  id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body            TEXT NOT NULL,\n  user_id         UUID NOT NULL REFERENCES users(id),\n  commentable_type TEXT NOT NULL CHECK (commentable_type IN ('post', 'video', 'product')),\n  commentable_id  UUID NOT NULL,\n  created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE INDEX idx_comments_commentable\n  ON comments(commentable_type, commentable_id);\n\n-- Pattern 3: Separate tables per type (cleanest, best performance)\nCREATE TABLE post_comments (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body       TEXT NOT NULL,\n  user_id    UUID NOT NULL REFERENCES users(id),\n  post_id    UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE TABLE video_comments (\n  id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  body       TEXT NOT NULL,\n  user_id    UUID NOT NULL REFERENCES users(id),\n  video_id   UUID NOT NULL REFERENCES videos(id) ON DELETE CASCADE,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n-- Pattern 3 is verbose but has proper foreign keys and best query performance\n```\n\n### Complete E-commerce Schema Example\n```sql\n-- Users\nCREATE TABLE users (\n  id            UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  email         TEXT NOT NULL UNIQUE,\n  name          TEXT NOT NULL,\n  password_hash TEXT NOT NULL,\n  role          TEXT NOT NULL DEFAULT 'customer'\n                  CHECK (role IN ('customer', 'admin', 'vendor')),\n  created_at    TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at    TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  deleted_at    TIMESTAMPTZ\n);\n\n-- Product categories (self-referential for hierarchy)\nCREATE TABLE categories (\n  id        UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name      TEXT NOT NULL,\n  slug      TEXT NOT NULL UNIQUE,\n  parent_id UUID REFERENCES categories(id),\n  sort_order INT NOT NULL DEFAULT 0\n);\n\n-- Products\nCREATE TABLE products (\n  id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  name        TEXT NOT NULL,\n  slug        TEXT NOT NULL UNIQUE,\n  description TEXT,\n  category_id UUID NOT NULL REFERENCES categories(id),\n  price_cents INT NOT NULL CHECK (price_cents >= 0),\n  stock_qty   INT NOT NULL DEFAULT 0 CHECK (stock_qty >= 0),\n  is_active   BOOLEAN NOT NULL DEFAULT true,\n  metadata    JSONB NOT NULL DEFAULT '{}',\n  created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Orders\nCREATE TABLE orders (\n  id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  user_id         UUID NOT NULL REFERENCES users(id),\n  status          TEXT NOT NULL DEFAULT 'pending'\n                    CHECK (status IN ('pending', 'confirmed', 'shipped', 'delivered', 'cancelled')),\n  subtotal_cents  INT NOT NULL CHECK (subtotal_cents >= 0),\n  tax_cents       INT NOT NULL DEFAULT 0 CHECK (tax_cents >= 0),\n  total_cents     INT NOT NULL CHECK (total_cents >= 0),\n  currency        CHAR(3) NOT NULL DEFAULT 'USD',\n  shipping_address JSONB NOT NULL,\n  notes           TEXT,\n  created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Order items\nCREATE TABLE order_items (\n  id               UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  order_id         UUID NOT NULL REFERENCES orders(id) ON DELETE CASCADE,\n  product_id       UUID NOT NULL REFERENCES products(id),\n  quantity         INT NOT NULL CHECK (quantity > 0),\n  unit_price_cents INT NOT NULL CHECK (unit_price_cents >= 0),\n  UNIQUE (order_id, product_id)\n);\n\n-- Payments\nCREATE TABLE payments (\n  id                  UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  order_id            UUID NOT NULL REFERENCES orders(id),\n  amount_cents        INT NOT NULL CHECK (amount_cents > 0),\n  currency            CHAR(3) NOT NULL,\n  status              TEXT NOT NULL CHECK (status IN ('pending', 'completed', 'failed', 'refunded')),\n  provider            TEXT NOT NULL,\n  provider_payment_id TEXT UNIQUE,\n  created_at          TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\n-- Indexes\nCREATE INDEX idx_orders_user_id         ON orders(user_id);\nCREATE INDEX idx_orders_status          ON orders(status) WHERE status NOT IN ('delivered', 'cancelled');\nCREATE INDEX idx_order_items_product_id ON order_items(product_id);\nCREATE INDEX idx_products_category      ON products(category_id) WHERE is_active = true;\nCREATE INDEX idx_products_slug          ON products(slug);\nCREATE INDEX idx_users_email            ON users(email) WHERE deleted_at IS NULL;\n```\n\n### SQL vs NoSQL Decision Guide\n```\nUse PostgreSQL\u002FMySQL when:\n  - Data has clear relationships and consistent structure\n  - ACID transactions across multiple entities required\n  - Complex queries with JOINs, aggregations, window functions\n  - Schema is known upfront and relatively stable\n  - Team knows SQL well\n  Examples: financial data, user accounts, orders, inventory\n\nUse MongoDB when:\n  - Documents are self-contained (few JOINs needed)\n  - Schema varies significantly between records\n  - Hierarchical\u002Fnested data that maps naturally to documents\n  - Rapid schema evolution during early development\n  Examples: CMS content, product catalogs with varying attributes\n\nUse DynamoDB\u002FCassandra when:\n  - Massive write scale (millions\u002Fsec)\n  - Access patterns are known and simple (key-value, range scans)\n  - Eventual consistency is acceptable\n  - Auto-scaling without operational overhead\n  Examples: user sessions, IoT sensor data, event logs, shopping carts\n\nUse Redis when:\n  - Sub-millisecond latency required\n  - Data fits in memory\n  - Simple data structures (sorted sets, hashes, strings)\n  Examples: caching, rate limiting, leaderboards, sessions\n\nUse both (polyglot persistence):\n  PostgreSQL as source of truth for transactions\n  Redis for caching and sessions\n  Elasticsearch for full-text search\n  S3 for file storage\n```\n\n---\n\n## Best Practices\n\n- Design for your access patterns — add indexes based on actual queries\n- Always use TIMESTAMPTZ not TIMESTAMP — always store UTC\n- Use UUID or ULID for primary keys in distributed or public-facing systems\n- Add CHECK constraints liberally — they document business rules in the schema\n- Store money as integers (cents) — never float\n- Use ENUM types or CHECK constraints for status fields\n- Add NOT NULL to every column that should never be null\n- Index foreign keys — PostgreSQL does not do this automatically\n- Use ON DELETE CASCADE only when child rows are meaningless without parent\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Problem | Fix |\n|---|---|---|\n| Float for money | 0.1 + 0.2 = 0.30000000000000004 | Store as integer cents |\n| TIMESTAMP without timezone | Wrong times across timezones | Always use TIMESTAMPTZ |\n| No indexes on FKs | Slow JOINs and cascading deletes | Always index foreign key columns |\n| Storing arrays in VARCHAR | Violates 1NF, hard to query | Use separate junction table |\n| Sequential auto-increment public IDs | Exposes record count, scraping risk | Use UUID or ULID for external IDs |\n| Missing NOT NULL | Unexpected nulls break queries | Add NOT NULL to every required column |\n| No updated_at | Cannot sync or detect stale data | Add updated_at with trigger |\n| Denormalizing too early | Inconsistent data, update anomalies | Normalize first, denormalize only when measured |\n\n---\n\n## Related Skills\n\n- **postgresql-expert**: For PostgreSQL-specific queries and features\n- **mongodb-expert**: For document database design\n- **prisma-expert**: For schema design with Prisma ORM\n- **system-design**: For database selection in system design\n- **data-engineering**: For analytical schema design (star schema, data vault)\n- **domain-driven-design**: For aligning database schema with domain model",{"name":5,"author":44,"license":15,"metadata":45,"description":7},"luo-kai",{"author":9,"version":46,"category":22},"1.0","main","4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c","ai-agent-skills\u002F04-databases-and-storage (by Luo Kai)\u002F01-relational-sql\u002Fdatabase-design-expert",2,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai","https:\u002F\u002Fgithub.com\u002Fluokai0","a solo builder.","2026-05-06 04:29:04",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill database-design",{"tool":61,"command":62},"bunx","bunx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill database-design",{"tool":64,"command":65},"pnpm","pnpm dlx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill database-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F04-databases-and-storage (by Luo Kai)\u002F01-relational-sql\u002Fdatabase-design-expert\u002FSKILL.md",true,[],[70,96,113,138,164,188],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":39},"01M6F2SKTE208174C7S7JJCZC7","write-contracts","Generates secure Aptos Move V2 smart contracts with Object model, Digital Asset integration, security patterns, and storage type guidance. Includes comprehensive storage decision framework for optimal data structure selection. Triggers on: 'write contract', 'create NFT collection', 'build marketplace', 'implement minting', 'generate Move module', 'create token contract', 'build DAO', 'implement staking'. Ask storage questions when: 'store', 'track', 'registry', 'mapping', 'list', 'collection'.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fwrite-contracts\u002FSKILL.md",[],[77,78,79,80,81,82,83,84,32,85,86,87,88,89,90,91,92,93,94,95],"write","contracts","write contracts","storage","secure","create","generate","collection","decision","ask","smart-contracts","selection","objects","structure","nft","token","aptos","critical","move",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":39},"01M6F2RFXJ6T9MKW0A7N7GM45B","web-search","通用网络搜索技能，支持多引擎搜索（百度、必应、DuckDuckGo），无需API密钥即可获取实时信息","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fweb-search-ex-skill\u002FSKILL.md",[],[103,104,105,106,107,108,109,110,111,112],"web","search","web search","搜索","baidu","bing","duckduckgo","百度","多引擎","internet",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":39},"01M6F2K968G1FZEZFPW2E6B222","solo-build","Execute implementation plan tasks with TDD workflow, auto-commit, and phase gates. Use when user says \"build it\", \"start building\", \"execute plan\", \"implement tasks\", \"ship it\", or references a track ID. Do NOT use for planning (use \u002Fplan) or scaffolding (use \u002Fscaffold).","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fsolo-build\u002FSKILL.md",[],[120,121,122,123,124,125,126,127,104,128,129,130,77,131,132,133,134,135,136,137],"build","solo","solo build","MCP","workflow","commit","tasks","code","Bash","plan","read","auto","references","context7","query","scaffolding","ship it","project",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":39},"01M6F2GKN39SGHSPWYB3662YC8","react-email","Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Freact-email-skills\u002FSKILL.md",[],[145,146,147,148,149,150,151,152,153,154,155,156,157,31,158,159,160,161,162,163],"react","email","react email","github","editor","components","react components","component","welcome","https","notifications","password","node","html","resend","visual","emails","rendering","with",{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":170,"publishedAt":39},"01M6F2FBVGVDFSG8SSFJGXA40C","APITester Agent-Driven API Testing","Test API endpoints and document responses. Define tests in plain English, run them, get formatted results. Agent-driven Postman alternative.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fopenclaw-api-tester\u002FSKILL.md",[],[171,172,173,174,175,176,177,178,179,180,181,182,25,183,184,185,186,187],"testing","api","api testing","driven","APITester Agent Driven API Testing","test","run","postman","results","plain english","tester","endpoints","get","define","tests","english","api-tester",{"skillNo":189,"name":190,"nameZh":6,"description":191,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":192,"categories":193,"keywords":194,"publishedAt":39},"01M6F273Y3NGAPVJZ608BC0G9G","hubspot-implementation-plan","Generate a phased implementation plan from a HubSpot audit report. Creates prioritized, sequenced cleanup processes with effort estimates, dependencies, and automation feasibility. Use after running \u002Fhubspot-audit.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fhubspot-implementation-plan\u002FSKILL.md",[],[129,195,196,197,198,199,200,83,201,202,203,204,205,31,206,207,163,208],"implementation","hubspot","hubspot implementation plan","automation","feasibility","cleanup","planning","report","audit","audit report","phased implementation","dependencies","processes","hubspot audit"]