[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DW1CVSSQQ6ET781V01ZRS7":3,"skill-same:01M6DW1CVSSQQ6ET781V01ZRS7":71},{"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":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6DW1CVSSQQ6ET781V01ZRS7","drizzle-conventions",null,"ACTIVATE when defining database schemas, writing queries, creating migrations, or implementing repositories with Drizzle ORM. ACTIVATE for 'Drizzle', 'pgTable', 'drizzle-kit', 'db.query', 'db.select', '$inferSelect', 'migration'. Covers: schema definition with pgTable, relations, type inference ($inferSelect\u002F$inferInsert), Query API vs Select API vs raw SQL decision tree, repository pattern with toDomain\u002FtoPersistence, migration workflow (always drizzle-kit generate first, never manual journal). DO NOT use for: Doctrine\u002FPHP queries (see php-sql-conventions), general SQL formatting.","FabienSalles\u002Fclaude-marketplace","FabienSalles","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F937901?v=4","01M6DVJBD31CJKRB382FQFZ5FH","Fabien Salles","01M6DVJBQNY8Q18KJD1ESAD6TX",9,"MIT","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftooling\u002Fskills\u002Fdrizzle-conventions\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"drizzle conventions","conventions","never","journal","db","query","do","doctrine","activate","general","writing","schema","use","drizzle orm","orm","decision","select","api","database","workflow","2026-11-10 10:12:30",false,"---\nname: drizzle-conventions\ndescription: \"ACTIVATE when defining database schemas, writing queries, creating migrations, or implementing repositories with Drizzle ORM. ACTIVATE for 'Drizzle', 'pgTable', 'drizzle-kit', 'db.query', 'db.select', '$inferSelect', 'migration'. Covers: schema definition with pgTable, relations, type inference ($inferSelect\u002F$inferInsert), Query API vs Select API vs raw SQL decision tree, repository pattern with toDomain\u002FtoPersistence, migration workflow (always drizzle-kit generate first, never manual journal). DO NOT use for: Doctrine\u002FPHP queries (see php-sql-conventions), general SQL formatting.\"\n---\n\n# Drizzle Conventions\n\n## Schema Definition\n\nDefine tables with `pgTable()` and typed columns:\n\n```typescript\n\u002F\u002F src\u002Finfrastructure\u002Fpersistence\u002Fschema\u002Ftenant.schema.ts\nimport { pgTable, uuid, varchar, timestamp, boolean } from 'drizzle-orm\u002Fpg-core';\n\nexport const tenants = pgTable('tenants', {\n  id: uuid('id').primaryKey().defaultRandom(),\n  email: varchar('email', { length: 255 }).notNull().unique(),\n  firstName: varchar('first_name', { length: 100 }).notNull(),\n  lastName: varchar('last_name', { length: 100 }).notNull(),\n  isActive: boolean('is_active').notNull().default(true),\n  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n  updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n});\n```\n\n## Relations (Declared Separately)\n\n```typescript\n\u002F\u002F src\u002Finfrastructure\u002Fpersistence\u002Fschema\u002Frelations.ts\nimport { relations } from 'drizzle-orm';\nimport { tenants } from '.\u002Ftenant.schema';\nimport { leases } from '.\u002Flease.schema';\n\nexport const tenantsRelations = relations(tenants, ({ many }) => ({\n  leases: many(leases),\n}));\n\nexport const leasesRelations = relations(leases, ({ one }) => ({\n  tenant: one(tenants, {\n    fields: [leases.tenantId],\n    references: [tenants.id],\n  }),\n}));\n```\n\n## Type Inference\n\nUse `$inferSelect` and `$inferInsert` for type safety:\n\n```typescript\nimport { tenants } from '.\u002Fschema\u002Ftenant.schema';\n\n\u002F\u002F Inferred types from schema\ntype Tenant = typeof tenants.$inferSelect;       \u002F\u002F SELECT result type\ntype NewTenant = typeof tenants.$inferInsert;     \u002F\u002F INSERT input type\n```\n\n## Query API vs Select API vs Raw SQL\n\nDrizzle offers three abstraction levels. **Prefer the highest level possible** to maximize type safety and refactoring protection.\n\n### Query API (preferred) — `db.query.*`\n\nType-safe with automatic relations. The return is fully typed, including nested objects:\n\n```typescript\n\u002F\u002F ✅ PREFERRED - Type-safe, auto-joined relations, refactoring-safe\nconst tenantWithLeases = await db.query.tenants.findFirst({\n  where: eq(tenants.id, tenantId),\n  with: {\n    leases: true, \u002F\u002F JOIN generated automatically, returns Tenant & { leases: Lease[] }\n  },\n});\n```\n\n### Select API — `db.select().from()`\n\nFor queries without relations or complex cases (aggregations, subqueries):\n\n```typescript\n\u002F\u002F ✅ CORRECT - Type-safe, but no declarative relations\nconst activeTenants = await db\n  .select()\n  .from(tenants)\n  .where(eq(tenants.isActive, true));\n\n\u002F\u002F Aggregations\nconst counts = await db\n  .select({ count: sql\u003Cnumber>`count(*)` })\n  .from(tenants)\n  .groupBy(tenants.isActive);\n```\n\n### Raw SQL — `sql` template tag (last resort)\n\nNo return typing, no refactoring protection. **Only for cases Drizzle does not cover** (CTEs, window functions, very specific queries):\n\n```typescript\nimport { sql } from 'drizzle-orm';\n\n\u002F\u002F ✅ CORRECT - Parameterized via template tag\nconst result = await db.execute(\n  sql`SELECT * FROM tenants WHERE email = ${email}`\n);\n\n\u002F\u002F ❌ AVOID - String interpolation (SQL injection risk)\nconst result = await db.execute(\n  `SELECT * FROM tenants WHERE email = '${email}'`\n);\n```\n\n### Decision Tree\n\n```\nNeed nested relations?\n├─ YES → Query API (db.query.*.findFirst\u002FfindMany)\n│\n└─ NO → Simple query or aggregation?\n         ├─ YES → Select API (db.select().from())\n         └─ NO → CTE \u002F window \u002F exotic SQL?\n                  └─ Raw SQL (sql`...`) as last resort\n```\n\n## Insert \u002F Update \u002F Delete\n\n```typescript\n\u002F\u002F Insert\nconst [newTenant] = await db\n  .insert(tenants)\n  .values({ email, firstName, lastName })\n  .returning();\n\n\u002F\u002F Update\nawait db\n  .update(tenants)\n  .set({ isActive: false, updatedAt: new Date() })\n  .where(eq(tenants.id, tenantId));\n\n\u002F\u002F Delete\nawait db\n  .delete(tenants)\n  .where(eq(tenants.id, tenantId));\n```\n\n## Repository Pattern\n\n```typescript\n\u002F\u002F domain\u002Fport\u002Ftenant-repository.ts (interface)\nexport interface TenantRepository {\n  findById(id: TenantId): Promise\u003CTenant | null>;\n  findByEmail(email: string): Promise\u003CTenant | null>;\n  save(tenant: Tenant): Promise\u003CTenant>;\n}\n\nexport const TENANT_REPOSITORY = Symbol('TenantRepository');\n```\n\n```typescript\n\u002F\u002F infrastructure\u002Fpersistence\u002Fdrizzle-tenant-repository.ts\n@Injectable()\nexport class DrizzleTenantRepository implements TenantRepository {\n  constructor(@Inject('DRIZZLE') private readonly db: DrizzleDatabase) {}\n\n  async findById(id: TenantId): Promise\u003CTenant | null> {\n    const result = await this.db.query.tenants.findFirst({\n      where: eq(tenants.id, id),\n    });\n\n    return result ? this.toDomain(result) : null;\n  }\n\n  async save(tenant: Tenant): Promise\u003CTenant> {\n    const [row] = await this.db\n      .insert(tenants)\n      .values(this.toPersistence(tenant))\n      .onConflictDoUpdate({\n        target: tenants.id,\n        set: this.toPersistence(tenant),\n      })\n      .returning();\n\n    return this.toDomain(row);\n  }\n\n  private toDomain(row: typeof tenants.$inferSelect): Tenant { ... }\n  private toPersistence(tenant: Tenant): typeof tenants.$inferInsert { ... }\n}\n```\n\n> **See also**: `nest-ddd-conventions` for the ports & adapters pattern.\n\n## Migrations\n\n**IMPORTANT: Always start with `drizzle-kit generate`** to produce the 3 artifacts (SQL, journal entry, snapshot). Never manually write the journal (`_journal.json`) or snapshots — this causes desynchronizations: inconsistent timestamps, missing snapshots, silently ignored migrations. However, **the generated SQL can be modified** after generation (adding indexes, syntax cleanup, etc.).\n\n```bash\n# 1. Modify the schema (.schema.ts)\n# 2. Generate the migration (produces SQL + snapshot + journal entry)\npnpm drizzle-kit generate\n# 3. (Optional) Improve the generated SQL (indexes, constraints, etc.)\n# 4. Apply migrations\npnpm drizzle-kit migrate\n\n# Open Drizzle Studio (DB browser)\npnpm drizzle-kit studio\n```\n\n## Quick Reference\n\n| Rule | Convention |\n|------|-----------|\n| Schema | `pgTable()` with typed columns |\n| Relations | Declared separately from tables |\n| Type inference | `$inferSelect` \u002F `$inferInsert` |\n| Queries with relations | Query API (`db.query.*`) — preferred |\n| Simple queries \u002F aggregations | Select API (`db.select().from()`) |\n| Raw SQL | `sql` template tag — last resort |\n| Repository | Domain interface + Drizzle implementation |\n| Mapping | `toDomain()` \u002F `toPersistence()` in repository |\n| Migrations | `drizzle-kit generate` + `drizzle-kit migrate` — **never manual journal\u002Fsnapshots**, SQL editable |\n","# Drizzle Conventions\n\n## Schema Definition\n\nDefine tables with `pgTable()` and typed columns:\n\n```typescript\n\u002F\u002F src\u002Finfrastructure\u002Fpersistence\u002Fschema\u002Ftenant.schema.ts\nimport { pgTable, uuid, varchar, timestamp, boolean } from 'drizzle-orm\u002Fpg-core';\n\nexport const tenants = pgTable('tenants', {\n  id: uuid('id').primaryKey().defaultRandom(),\n  email: varchar('email', { length: 255 }).notNull().unique(),\n  firstName: varchar('first_name', { length: 100 }).notNull(),\n  lastName: varchar('last_name', { length: 100 }).notNull(),\n  isActive: boolean('is_active').notNull().default(true),\n  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n  updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n});\n```\n\n## Relations (Declared Separately)\n\n```typescript\n\u002F\u002F src\u002Finfrastructure\u002Fpersistence\u002Fschema\u002Frelations.ts\nimport { relations } from 'drizzle-orm';\nimport { tenants } from '.\u002Ftenant.schema';\nimport { leases } from '.\u002Flease.schema';\n\nexport const tenantsRelations = relations(tenants, ({ many }) => ({\n  leases: many(leases),\n}));\n\nexport const leasesRelations = relations(leases, ({ one }) => ({\n  tenant: one(tenants, {\n    fields: [leases.tenantId],\n    references: [tenants.id],\n  }),\n}));\n```\n\n## Type Inference\n\nUse `$inferSelect` and `$inferInsert` for type safety:\n\n```typescript\nimport { tenants } from '.\u002Fschema\u002Ftenant.schema';\n\n\u002F\u002F Inferred types from schema\ntype Tenant = typeof tenants.$inferSelect;       \u002F\u002F SELECT result type\ntype NewTenant = typeof tenants.$inferInsert;     \u002F\u002F INSERT input type\n```\n\n## Query API vs Select API vs Raw SQL\n\nDrizzle offers three abstraction levels. **Prefer the highest level possible** to maximize type safety and refactoring protection.\n\n### Query API (preferred) — `db.query.*`\n\nType-safe with automatic relations. The return is fully typed, including nested objects:\n\n```typescript\n\u002F\u002F ✅ PREFERRED - Type-safe, auto-joined relations, refactoring-safe\nconst tenantWithLeases = await db.query.tenants.findFirst({\n  where: eq(tenants.id, tenantId),\n  with: {\n    leases: true, \u002F\u002F JOIN generated automatically, returns Tenant & { leases: Lease[] }\n  },\n});\n```\n\n### Select API — `db.select().from()`\n\nFor queries without relations or complex cases (aggregations, subqueries):\n\n```typescript\n\u002F\u002F ✅ CORRECT - Type-safe, but no declarative relations\nconst activeTenants = await db\n  .select()\n  .from(tenants)\n  .where(eq(tenants.isActive, true));\n\n\u002F\u002F Aggregations\nconst counts = await db\n  .select({ count: sql\u003Cnumber>`count(*)` })\n  .from(tenants)\n  .groupBy(tenants.isActive);\n```\n\n### Raw SQL — `sql` template tag (last resort)\n\nNo return typing, no refactoring protection. **Only for cases Drizzle does not cover** (CTEs, window functions, very specific queries):\n\n```typescript\nimport { sql } from 'drizzle-orm';\n\n\u002F\u002F ✅ CORRECT - Parameterized via template tag\nconst result = await db.execute(\n  sql`SELECT * FROM tenants WHERE email = ${email}`\n);\n\n\u002F\u002F ❌ AVOID - String interpolation (SQL injection risk)\nconst result = await db.execute(\n  `SELECT * FROM tenants WHERE email = '${email}'`\n);\n```\n\n### Decision Tree\n\n```\nNeed nested relations?\n├─ YES → Query API (db.query.*.findFirst\u002FfindMany)\n│\n└─ NO → Simple query or aggregation?\n         ├─ YES → Select API (db.select().from())\n         └─ NO → CTE \u002F window \u002F exotic SQL?\n                  └─ Raw SQL (sql`...`) as last resort\n```\n\n## Insert \u002F Update \u002F Delete\n\n```typescript\n\u002F\u002F Insert\nconst [newTenant] = await db\n  .insert(tenants)\n  .values({ email, firstName, lastName })\n  .returning();\n\n\u002F\u002F Update\nawait db\n  .update(tenants)\n  .set({ isActive: false, updatedAt: new Date() })\n  .where(eq(tenants.id, tenantId));\n\n\u002F\u002F Delete\nawait db\n  .delete(tenants)\n  .where(eq(tenants.id, tenantId));\n```\n\n## Repository Pattern\n\n```typescript\n\u002F\u002F domain\u002Fport\u002Ftenant-repository.ts (interface)\nexport interface TenantRepository {\n  findById(id: TenantId): Promise\u003CTenant | null>;\n  findByEmail(email: string): Promise\u003CTenant | null>;\n  save(tenant: Tenant): Promise\u003CTenant>;\n}\n\nexport const TENANT_REPOSITORY = Symbol('TenantRepository');\n```\n\n```typescript\n\u002F\u002F infrastructure\u002Fpersistence\u002Fdrizzle-tenant-repository.ts\n@Injectable()\nexport class DrizzleTenantRepository implements TenantRepository {\n  constructor(@Inject('DRIZZLE') private readonly db: DrizzleDatabase) {}\n\n  async findById(id: TenantId): Promise\u003CTenant | null> {\n    const result = await this.db.query.tenants.findFirst({\n      where: eq(tenants.id, id),\n    });\n\n    return result ? this.toDomain(result) : null;\n  }\n\n  async save(tenant: Tenant): Promise\u003CTenant> {\n    const [row] = await this.db\n      .insert(tenants)\n      .values(this.toPersistence(tenant))\n      .onConflictDoUpdate({\n        target: tenants.id,\n        set: this.toPersistence(tenant),\n      })\n      .returning();\n\n    return this.toDomain(row);\n  }\n\n  private toDomain(row: typeof tenants.$inferSelect): Tenant { ... }\n  private toPersistence(tenant: Tenant): typeof tenants.$inferInsert { ... }\n}\n```\n\n> **See also**: `nest-ddd-conventions` for the ports & adapters pattern.\n\n## Migrations\n\n**IMPORTANT: Always start with `drizzle-kit generate`** to produce the 3 artifacts (SQL, journal entry, snapshot). Never manually write the journal (`_journal.json`) or snapshots — this causes desynchronizations: inconsistent timestamps, missing snapshots, silently ignored migrations. However, **the generated SQL can be modified** after generation (adding indexes, syntax cleanup, etc.).\n\n```bash\n# 1. Modify the schema (.schema.ts)\n# 2. Generate the migration (produces SQL + snapshot + journal entry)\npnpm drizzle-kit generate\n# 3. (Optional) Improve the generated SQL (indexes, constraints, etc.)\n# 4. Apply migrations\npnpm drizzle-kit migrate\n\n# Open Drizzle Studio (DB browser)\npnpm drizzle-kit studio\n```\n\n## Quick Reference\n\n| Rule | Convention |\n|------|-----------|\n| Schema | `pgTable()` with typed columns |\n| Relations | Declared separately from tables |\n| Type inference | `$inferSelect` \u002F `$inferInsert` |\n| Queries with relations | Query API (`db.query.*`) — preferred |\n| Simple queries \u002F aggregations | Select API (`db.select().from()`) |\n| Raw SQL | `sql` template tag — last resort |\n| Repository | Domain interface + Drizzle implementation |\n| Mapping | `toDomain()` \u002F `toPersistence()` in repository |\n| Migrations | `drizzle-kit generate` + `drizzle-kit migrate` — **never manual journal\u002Fsnapshots**, SQL editable |\n",{"name":5,"description":7},"main","479b264ec17cc5fafbf36287a1087472d3a386d3","plugins\u002Ftooling\u002Fskills\u002Fdrizzle-conventions",2,"https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace","https:\u002F\u002Fgithub.com\u002FFabienSalles","https:\u002F\u002Ffabiensalles.com","2026-10-13 04:33:22",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add FabienSalles\u002Fclaude-marketplace --skill drizzle-conventions",{"tool":63,"command":64},"bunx","bunx skills add FabienSalles\u002Fclaude-marketplace --skill drizzle-conventions",{"tool":66,"command":67},"pnpm","pnpm dlx skills add FabienSalles\u002Fclaude-marketplace --skill drizzle-conventions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftooling\u002Fskills\u002Fdrizzle-conventions\u002FSKILL.md",true,[],[72,96,115,135,158,175],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":81,"publishedAt":44},"01M6DW2YS1MGF65JNS1QQ15QHS","vitest-test-conventions","ACTIVATE when writing Vitest tests, creating test files, using vi.fn()\u002Fvi.mock()\u002Fvi.spyOn(), or test factories. ACTIVATE for 'Vitest', 'it.each', 'NestJS testing module', 'supertest', 'vi.fn', 'vi.mock', 'spyOn'. Provides Vitest\u002FNestJS-specific testing patterns; cross-language testing principles (DAMP, AAA, spy over mock, what NOT to test) live in craft:testing-principles. DO NOT use for: node:test files (a file importing node:test) or a project whose tests run under node --test (see node-test:node-test-conventions), TDD workflow\u002Fiterations (see vitest:vitest-tdd-workflow), PHP\u002FPHPUnit tests (see phpunit:php-test-conventions).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvitest\u002Fskills\u002Fvitest-test-conventions\u002FSKILL.md",[78],{"categoryNo":79,"categoryName":80,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",[82,83,25,84,85,34,86,43,87,88,36,89,90,32,30,91,92,93,94,95],"test","vitest","vitest test conventions","testing","tdd","file","testing patterns","files","nestjs","project","tests","module","fn","testing principles",{"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":105,"publishedAt":44},"01M6DW2VFE6NPFCGQKQ68P1MVZ","vitest-tdd-workflow","ACTIVATE when building new features, endpoints, or user stories using TDD with Vitest in a TypeScript\u002FNestJS context. ACTIVATE for '\u002Ffeature-tdd-dev', 'TDD', 'red-green-refactor' in TS context. Provides Vitest\u002FNestJS-specific TDD examples and commands; cross-language TDD workflow (cross-layer iterations, RED-GREEN-REFACTOR, working app, bug-fix-first-test, mocks-hiding-bugs) lives in craft:tdd-workflow-principles. DO NOT use for: node:test files (a file importing node:test) or a project whose tests run under node --test (see node-test:node-test-conventions), test writing conventions (see vitest:vitest-test-conventions), PHP TDD (see phpunit:php-tdd-workflow).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvitest\u002Fskills\u002Fvitest-tdd-workflow\u002FSKILL.md",[102],{"categoryNo":103,"categoryName":104,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[86,43,106,83,107,34,108,87,109,110,36,111,89,32,30,112,91,92,113,114],"tdd workflow","vitest tdd workflow","dev","examples","fix","red-green-refactor","green","feature","app",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":44},"01M6DW2RGMQE10D8C5Z5MA2RMY","ts-refactoring","ACTIVATE when refactoring TypeScript code. ACTIVATE for 'refactor', 'extract', 'redesign', 'simplify', or 'clean up' in a TypeScript \u002F Node \u002F NestJS context. This skill provides TS-specific examples for the cross-language refactoring rules defined in craft:refactoring-principles. DO NOT use for: writing new features from scratch, general OOP patterns (see ts-oop).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-refactoring\u002FSKILL.md",[],[122,123,34,124,125,109,126,127,128,129,130,36,131,33,132,90,133,32,30,134],"refactoring","ts refactoring","typescript","code","refactor","simplify","Rules","node","redesign","up","clean","craft","patterns",{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":142,"publishedAt":44},"01M6DW2MHYXNBBVYEGB058Y48J","ts-ports-adapters","ACTIVATE when a TypeScript codebase with no dependency-injection container has to declare a port and wire its adapter — a repository, a clock, an id generator, an event dispatcher the domain depends on. ACTIVATE for 'port', 'adapter', 'SPI', 'dependency inversion' or 'composition root' in a codebase that wires its dependencies by hand. Covers: the port as a type of functions in the domain layer, the adapter as an object literal annotated with it, the handler that takes its dependencies first and its data second, the composition root in the infrastructure layer, and the in-memory stub that substitutes for the adapter in a unit test. DO NOT use for: NestJS, or any container-based DI with decorators and tokens (see nest-ddd-conventions), aggregate operations and smart constructors (see ddd-ts-fp), the Result type itself (see ts-functional).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-ports-adapters\u002FSKILL.md",[141],{"categoryNo":79,"categoryName":80,"taxonomyType":21,"taxonomyTypeDesc":22},[143,144,145,82,146,147,36,148,149,90,150,32,30,151,152,153,154,155,156,157],"ports","ts ports adapters","memory","ddd","Composition","container","functions","Literal","dependency-injection","domain","tokens","as","type","id","adapter",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":44},"01M6DW2GRXZFYT05HEDB26C9B8","ts-oop","ACTIVATE when designing TypeScript classes, and the value objects or collections modelled as classes, or when the user asks about object design, encapsulation, Tell Don't Ask, or Symbol.iterator. Provides TS-specific examples for the cross-language OOP rules defined in craft:oop-principles, plus TS-specific patterns (Symbol.iterator, branded types for primitive identifiers). DO NOT use for: a value object or an aggregate modelled as an immutable record rather than a class (see ddd-ts-fp), refactoring methodology (see ts-refactoring).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-oop\u002FSKILL.md",[],[165,166,167,124,146,109,168,169,122,128,170,36,171,133,32,30,172,173,174,154],"oop","ts oop","design","methodology","immutable","ask","refactoring methodology","objects","record","collections",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":44},"01M6DW2D26XG5MJMTP9MSE43S2","ts-layer-boundaries","ACTIVATE when wiring a Worker entry point, a Router, a controller, or a domain event consumer in a TypeScript CQRS codebase, or when deciding where a port belongs. ACTIVATE for 'composition root', 'layer boundary', 'ESLint zones', 'domain must not import infrastructure'. Covers: the *Worker.ts composition root, the curried consumer, Router wiring of command endpoints, the five-gesture controller, the domain-to-infrastructure import boundary enforced by ESLint, infrastructure-only ports, in-memory doubles for every port, the read-can-reach-write asymmetry, and read endpoints going through a domain handler. DO NOT use for: the port's own shape and adapter binding (see ts-ports-adapters), the Result type (see ts-functional), domain event structure (see ts-ddd-events).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-layer-boundaries\u002FSKILL.md",[],[182,145,146,183,184,147,143,36,185,186,187,32,30,188,152,189,190,155,157,191],"ts layer boundaries","controller","boundary","router","only","endpoints","structure","cqrs","worker","import"]