[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DW1VBPK5B32G3ADD8YGRZD":3,"skill-same:01M6DW1VBPK5B32G3ADD8YGRZD":72},{"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":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":6,"updatedAt":51,"install":52,"resources":65},"01M6DW1VBPK5B32G3ADD8YGRZD","ddd-ts-fp",null,"ACTIVATE when modeling DDD aggregates, value objects and domain logic in TypeScript using functional patterns. ACTIVATE for 'aggregate', 'smart constructor', 'make*', 'validation pipeline', 'enrichment', 'domain handler' in TypeScript. Provides TypeScript-specific examples for cross-language functional DDD principles defined in craft:ddd-fp-principles. DO NOT use for: infrastructure code, general FP patterns (see ts-functional), OOP modeling (see ts-oop).","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\u002Ftypescript\u002Fskills\u002Fddd-ts-fp\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"ddd ts fp","ddd","activate","ddd principles","modeling","logic","domain","aggregates","objects","patterns","do","typescript","craft","general","use","pipeline","enrichment","examples","validation","code","2026-11-10 10:12:30",false,"---\nname: ddd-ts-fp\ndescription: \"ACTIVATE when modeling DDD aggregates, value objects and domain logic in TypeScript using functional patterns. ACTIVATE for 'aggregate', 'smart constructor', 'make*', 'validation pipeline', 'enrichment', 'domain handler' in TypeScript. Provides TypeScript-specific examples for cross-language functional DDD principles defined in craft:ddd-fp-principles. DO NOT use for: infrastructure code, general FP patterns (see ts-functional), OOP modeling (see ts-oop).\"\n---\n\n# DDD Functional Patterns — TypeScript\n\n> The **cross-language functional DDD principles** (immutable aggregates, curried operations, smart constructors, validation\u002Fenrichment pipelines, handler orchestration) are defined in `craft:ddd-fp-principles`. This skill keeps TypeScript-specific syntax and patterns.\n\n## TS-specific: Immutable Aggregate as `readonly` Type\n\n```typescript\ntype Receipt = {\n  readonly id: ReceiptId;\n  readonly tenantId: TenantId;\n  readonly addresses: readonly Address[];\n  readonly period: Period;\n  readonly amount: number;\n  readonly createdAt: Date;\n};\n\nconst addAddress =\n  (address: Address) =>\n  (receipt: Receipt): Receipt => ({\n    ...receipt,\n    addresses: [...receipt.addresses, address],\n  });\n```\n\nEach operation is a **curried function** returning a new aggregate (or a `Result`). Compose with `pipe` and `chain`.\nMeasure: no domain operation in this file's own examples takes its data and the aggregate in one non-curried argument list; every operation curries at least once before receiving the aggregate.\n\n> When implementing aggregate operations, pipe composition, or nested immutable updates, read `references\u002Fddd-functional-examples.md` for complete patterns.\n\n## TS-specific: Validation Pipeline\n\nA single check keeps the type; the **composition** is what mints the branded one. That is where the proof enters the type system, so nothing downstream has to trust a call order.\n\n```typescript\ntype Check\u003CT> = (input: T) => Result\u003CT, DomainError>;\ntype Validator\u003CRaw, Valid extends Raw> = (input: Raw) => Result\u003CValid, DomainError>;\n\n\u002F\u002F Each check keeps the type; the last step BUILDS the narrower shape out of the\n\u002F\u002F primitives it just proved, so the pipeline narrows by construction, never by assertion.\nconst validateCreateReceipt: Validator\u003CCreateReceiptCommand, ValidCreateReceiptCommand> = (cmd) =>\n  pipe(\n    cmd,\n    validatePeriod,\n    chain(validateAmount),\n    chain(validateLease),\n    chain(buildValidCreateReceipt),\n  );\n```\n\n> When building validation or enrichment pipelines, read `references\u002Fddd-functional-examples.md` for complete pipeline implementations.\n\n## TS-specific: Enrichment Pipeline\n\nSame pipe\u002Fchain machinery, applied at the system boundary to **transform external data into domain objects**.\n\n> When building enrichment pipelines, read `references\u002Fddd-functional-examples.md` for examples with enrichers.\n\n## TS-specific: Handler Pattern\n\nThe handler orchestrates: retrieval, validation, transformation, persistence.\n\n```\nvalidate(command)\n  → load(aggregate)\n  → pure domain operations\n  → persist\n```\n\n> When writing domain handlers, read `references\u002Fddd-functional-examples.md` for the complete handler pattern with error handling.\n\n## TS-specific: Handler Parameter Order\n\n```typescript\nexport type AddAddressHandler = (command: AddAddressCommand) => Promise\u003CResult\u003CReceipt, DomainError>>;\n\nconst addAddressHandler =\n  (clock: Clock) =>\n  async (command: AddAddressCommand): Promise\u003CResult\u003CReceipt, DomainError>> => {\n    const validated = validateAddAddress(command);\n    if (isFailure(validated)) return validated;\n\n    return buildReceipt(clock.now())(validated.value);\n  };\n```\n\nDependencies (`clock`) come first as separate arguments, never as one destructured object.\nMeasure: no handler example in this skill destructures its dependencies into a single options object; each dependency is its own curried argument.\n\nThe command comes last. A model-level operation instead takes its data first and the aggregate last: `addAddress(address)(receipt)`.\n\n## TS-specific: Result vs Bare Model\n\nAn operation returns a Result only when it can fail; a total transition returns the bare model.\nMeasure: no total operation in this skill's examples wraps its return type in Result, and no fallible operation returns the bare model.\n\n```typescript\n\u002F\u002F Fallible — the amount could be negative\nconst withAmount = (amount: number) => (receipt: Receipt): Result\u003CReceipt, DomainError> => ...;\n\n\u002F\u002F Total — appending never fails\nconst addAddress = (address: Address) => (receipt: Receipt): Receipt => ...;\n```\n\n## TS-specific: Entity Folder and Aggregate-Only Operations\n\nAn entity carrying identity has its own Models\u002FEntities\u002F\u003CName>\u002F folder, and its operations take and return the aggregate, never the entity.\nMeasure: no entity operation in this skill's examples takes or returns the bare entity; `updateAddress` both receives and returns `Customer`, never `Address`.\n\n```typescript\n\u002F\u002F plugins\u002F..\u002FModels\u002FEntities\u002FAddress\u002FupdateAddress.ts\nconst updateAddress =\n  (addressId: AddressId, patch: AddressPatch) =>\n  (customer: Customer): Customer => ({\n    ...customer,\n    addresses: customer.addresses.map((a) => (a.id === addressId ? { ...a, ...patch } : a)),\n  });\n```\n\n## TS-specific: Validator and Maker\n\nValidator files carry the invariants and return a branded command; the maker maps and normalizes a value the type system already proves valid, so it never fails.\nMeasure: no maker in this skill's examples returns a Result; `makeAddress`'s signature is total because `ValidAddAddressCommand` is the proof, not a runtime check.\n\n```typescript\n\u002F\u002F ValidAddAddressCommand.ts — a real shape, not a tag on the raw one\ntype ValidAddAddressCommand = {\n  readonly street: NonEmptyString;\n  readonly city: NonEmptyString;\n};\n\n\u002F\u002F AddressValidator.ts — fallible, and it builds the narrower value rather than asserting it\nconst validateAddress = (command: AddAddressCommand): Result\u003CValidAddAddressCommand, DomainError> =>\n  pipe(\n    nonEmpty(command.street),\n    chain((street) => map(nonEmpty(command.city), (city) => ({ street, city }))),\n  );\n\n\u002F\u002F makeAddress.ts — curried on its context, total because its input is the proof\nconst makeAddress =\n  (addressId: AddressId, createdAt: Date) =>\n  (command: ValidAddAddressCommand): Address => ({\n    id: addressId,\n    street: command.street,\n    city: command.city,\n    createdAt,\n  });\n```\n\n`makeAddress(addressId, createdAt)(rawCommand)` does not compile, and that is the entire point of the split. A maker that accepted `AddAddressCommand` would be total in its signature only — the invariant would live in a call-order convention nothing enforces. See `craft:ddd-fp-principles` §3 for why a single fallible constructor is the default, and what justifies splitting it.\n\nThe object literal is **constructed**, so the compiler checks it and the validator asserts nothing. Every remaining assertion sits in the primitive's own constructor — `nonEmpty` returns `Brand\u003Cstring, 'NonEmptyString'>`, minted once in the kernel (`ts-conventions` — Branded Types). That is what keeps `as` out of the domain, per C138, instead of widening the rule to admit it.\n\n## TS-specific: CQRS Model Copies\n\nEach CQRS side owns its own copy of the model; the read copy is deliberately narrowed.\nMeasure: the Query-side `Address` type in this file's example carries fewer fields than the Command-side one, never the same shape imported from one file.\n\n```typescript\n\u002F\u002F Command\u002FModels\u002FAddress.ts — full write shape\ntype Address = { readonly street: string; readonly city: string; readonly geo: GeoPoint \u002F* … *\u002F };\n\n\u002F\u002F Query\u002FModels\u002FAddress.ts — narrowed read shape\ntype Address = { readonly street: string; readonly city: string };\n```\n\n## TS-specific: Command DTO Duplication Across Features\n\nThe command DTO repeats per feature; two features are never factored together just because their types are identical.\nMeasure: `onboard-customer`'s `AddAddressCommand` and `relocate-customer`'s `AddAddressCommand` stay two files in this skill's example, never one shared import.\n\n```typescript\n\u002F\u002F features\u002Fonboard-customer\u002FAddAddressCommand.ts\ntype AddAddressCommand = { readonly street: string; readonly city: string };\n\n\u002F\u002F features\u002Frelocate-customer\u002FAddAddressCommand.ts — same shape, its own file\ntype AddAddressCommand = { readonly street: string; readonly city: string };\n```\n\n## TS-specific: Repository Receives the Whole Aggregate\n\nThe repository receives the whole aggregate, never a patch nor a list of fields.\nCost: a repository interface that declares an update method accepting a patch or list of fields forces every caller to reconstruct the invariant the aggregate already proved, one call site at a time.\n\n```typescript\nexport type CustomerRepository = {\n  save: (customer: Customer) => Promise\u003Cvoid>;\n};\n\n\u002F\u002F ❌ AVOID — no partial-update method\n\u002F\u002F update: (id: CustomerId, patch: Partial\u003CCustomer>) => Promise\u003Cvoid>;\n```\n\n## Quick Reference (TS-specific FP)\n\n| Element | Convention |\n|---------|------------|\n| Aggregate | Immutable `readonly` type, no class |\n| Operations | Pure curried functions |\n| Validator | Fallible; owns the invariants and returns a branded type |\n| Maker | Total; takes the branded type, which is what earns the totality |\n| Updates | Spread operator, never mutate |\n| Composition | `pipe(aggregate, op1, op2, op3)` |\n| Fallible composition | `pipe(aggregate, op1, chain(op2))` |\n| Validation | Composable `Validator\u003CRaw, Valid>` pipeline; narrows the type |\n| Enrichment | Pipeline at system boundary |\n| Handler | Orchestrator: validate → load → domain → persist |\n| Handler args | Dependencies positional, then the Command\u002FQuery last |\n| Model args | Data first, aggregate last (`op(data)(aggregate)`) |\n| Command handler type | `export type XHandler = (command: XCommand) => Promise\u003CResult\u003CT, E>>` |\n","# DDD Functional Patterns — TypeScript\n\n> The **cross-language functional DDD principles** (immutable aggregates, curried operations, smart constructors, validation\u002Fenrichment pipelines, handler orchestration) are defined in `craft:ddd-fp-principles`. This skill keeps TypeScript-specific syntax and patterns.\n\n## TS-specific: Immutable Aggregate as `readonly` Type\n\n```typescript\ntype Receipt = {\n  readonly id: ReceiptId;\n  readonly tenantId: TenantId;\n  readonly addresses: readonly Address[];\n  readonly period: Period;\n  readonly amount: number;\n  readonly createdAt: Date;\n};\n\nconst addAddress =\n  (address: Address) =>\n  (receipt: Receipt): Receipt => ({\n    ...receipt,\n    addresses: [...receipt.addresses, address],\n  });\n```\n\nEach operation is a **curried function** returning a new aggregate (or a `Result`). Compose with `pipe` and `chain`.\nMeasure: no domain operation in this file's own examples takes its data and the aggregate in one non-curried argument list; every operation curries at least once before receiving the aggregate.\n\n> When implementing aggregate operations, pipe composition, or nested immutable updates, read `references\u002Fddd-functional-examples.md` for complete patterns.\n\n## TS-specific: Validation Pipeline\n\nA single check keeps the type; the **composition** is what mints the branded one. That is where the proof enters the type system, so nothing downstream has to trust a call order.\n\n```typescript\ntype Check\u003CT> = (input: T) => Result\u003CT, DomainError>;\ntype Validator\u003CRaw, Valid extends Raw> = (input: Raw) => Result\u003CValid, DomainError>;\n\n\u002F\u002F Each check keeps the type; the last step BUILDS the narrower shape out of the\n\u002F\u002F primitives it just proved, so the pipeline narrows by construction, never by assertion.\nconst validateCreateReceipt: Validator\u003CCreateReceiptCommand, ValidCreateReceiptCommand> = (cmd) =>\n  pipe(\n    cmd,\n    validatePeriod,\n    chain(validateAmount),\n    chain(validateLease),\n    chain(buildValidCreateReceipt),\n  );\n```\n\n> When building validation or enrichment pipelines, read `references\u002Fddd-functional-examples.md` for complete pipeline implementations.\n\n## TS-specific: Enrichment Pipeline\n\nSame pipe\u002Fchain machinery, applied at the system boundary to **transform external data into domain objects**.\n\n> When building enrichment pipelines, read `references\u002Fddd-functional-examples.md` for examples with enrichers.\n\n## TS-specific: Handler Pattern\n\nThe handler orchestrates: retrieval, validation, transformation, persistence.\n\n```\nvalidate(command)\n  → load(aggregate)\n  → pure domain operations\n  → persist\n```\n\n> When writing domain handlers, read `references\u002Fddd-functional-examples.md` for the complete handler pattern with error handling.\n\n## TS-specific: Handler Parameter Order\n\n```typescript\nexport type AddAddressHandler = (command: AddAddressCommand) => Promise\u003CResult\u003CReceipt, DomainError>>;\n\nconst addAddressHandler =\n  (clock: Clock) =>\n  async (command: AddAddressCommand): Promise\u003CResult\u003CReceipt, DomainError>> => {\n    const validated = validateAddAddress(command);\n    if (isFailure(validated)) return validated;\n\n    return buildReceipt(clock.now())(validated.value);\n  };\n```\n\nDependencies (`clock`) come first as separate arguments, never as one destructured object.\nMeasure: no handler example in this skill destructures its dependencies into a single options object; each dependency is its own curried argument.\n\nThe command comes last. A model-level operation instead takes its data first and the aggregate last: `addAddress(address)(receipt)`.\n\n## TS-specific: Result vs Bare Model\n\nAn operation returns a Result only when it can fail; a total transition returns the bare model.\nMeasure: no total operation in this skill's examples wraps its return type in Result, and no fallible operation returns the bare model.\n\n```typescript\n\u002F\u002F Fallible — the amount could be negative\nconst withAmount = (amount: number) => (receipt: Receipt): Result\u003CReceipt, DomainError> => ...;\n\n\u002F\u002F Total — appending never fails\nconst addAddress = (address: Address) => (receipt: Receipt): Receipt => ...;\n```\n\n## TS-specific: Entity Folder and Aggregate-Only Operations\n\nAn entity carrying identity has its own Models\u002FEntities\u002F\u003CName>\u002F folder, and its operations take and return the aggregate, never the entity.\nMeasure: no entity operation in this skill's examples takes or returns the bare entity; `updateAddress` both receives and returns `Customer`, never `Address`.\n\n```typescript\n\u002F\u002F plugins\u002F..\u002FModels\u002FEntities\u002FAddress\u002FupdateAddress.ts\nconst updateAddress =\n  (addressId: AddressId, patch: AddressPatch) =>\n  (customer: Customer): Customer => ({\n    ...customer,\n    addresses: customer.addresses.map((a) => (a.id === addressId ? { ...a, ...patch } : a)),\n  });\n```\n\n## TS-specific: Validator and Maker\n\nValidator files carry the invariants and return a branded command; the maker maps and normalizes a value the type system already proves valid, so it never fails.\nMeasure: no maker in this skill's examples returns a Result; `makeAddress`'s signature is total because `ValidAddAddressCommand` is the proof, not a runtime check.\n\n```typescript\n\u002F\u002F ValidAddAddressCommand.ts — a real shape, not a tag on the raw one\ntype ValidAddAddressCommand = {\n  readonly street: NonEmptyString;\n  readonly city: NonEmptyString;\n};\n\n\u002F\u002F AddressValidator.ts — fallible, and it builds the narrower value rather than asserting it\nconst validateAddress = (command: AddAddressCommand): Result\u003CValidAddAddressCommand, DomainError> =>\n  pipe(\n    nonEmpty(command.street),\n    chain((street) => map(nonEmpty(command.city), (city) => ({ street, city }))),\n  );\n\n\u002F\u002F makeAddress.ts — curried on its context, total because its input is the proof\nconst makeAddress =\n  (addressId: AddressId, createdAt: Date) =>\n  (command: ValidAddAddressCommand): Address => ({\n    id: addressId,\n    street: command.street,\n    city: command.city,\n    createdAt,\n  });\n```\n\n`makeAddress(addressId, createdAt)(rawCommand)` does not compile, and that is the entire point of the split. A maker that accepted `AddAddressCommand` would be total in its signature only — the invariant would live in a call-order convention nothing enforces. See `craft:ddd-fp-principles` §3 for why a single fallible constructor is the default, and what justifies splitting it.\n\nThe object literal is **constructed**, so the compiler checks it and the validator asserts nothing. Every remaining assertion sits in the primitive's own constructor — `nonEmpty` returns `Brand\u003Cstring, 'NonEmptyString'>`, minted once in the kernel (`ts-conventions` — Branded Types). That is what keeps `as` out of the domain, per C138, instead of widening the rule to admit it.\n\n## TS-specific: CQRS Model Copies\n\nEach CQRS side owns its own copy of the model; the read copy is deliberately narrowed.\nMeasure: the Query-side `Address` type in this file's example carries fewer fields than the Command-side one, never the same shape imported from one file.\n\n```typescript\n\u002F\u002F Command\u002FModels\u002FAddress.ts — full write shape\ntype Address = { readonly street: string; readonly city: string; readonly geo: GeoPoint \u002F* … *\u002F };\n\n\u002F\u002F Query\u002FModels\u002FAddress.ts — narrowed read shape\ntype Address = { readonly street: string; readonly city: string };\n```\n\n## TS-specific: Command DTO Duplication Across Features\n\nThe command DTO repeats per feature; two features are never factored together just because their types are identical.\nMeasure: `onboard-customer`'s `AddAddressCommand` and `relocate-customer`'s `AddAddressCommand` stay two files in this skill's example, never one shared import.\n\n```typescript\n\u002F\u002F features\u002Fonboard-customer\u002FAddAddressCommand.ts\ntype AddAddressCommand = { readonly street: string; readonly city: string };\n\n\u002F\u002F features\u002Frelocate-customer\u002FAddAddressCommand.ts — same shape, its own file\ntype AddAddressCommand = { readonly street: string; readonly city: string };\n```\n\n## TS-specific: Repository Receives the Whole Aggregate\n\nThe repository receives the whole aggregate, never a patch nor a list of fields.\nCost: a repository interface that declares an update method accepting a patch or list of fields forces every caller to reconstruct the invariant the aggregate already proved, one call site at a time.\n\n```typescript\nexport type CustomerRepository = {\n  save: (customer: Customer) => Promise\u003Cvoid>;\n};\n\n\u002F\u002F ❌ AVOID — no partial-update method\n\u002F\u002F update: (id: CustomerId, patch: Partial\u003CCustomer>) => Promise\u003Cvoid>;\n```\n\n## Quick Reference (TS-specific FP)\n\n| Element | Convention |\n|---------|------------|\n| Aggregate | Immutable `readonly` type, no class |\n| Operations | Pure curried functions |\n| Validator | Fallible; owns the invariants and returns a branded type |\n| Maker | Total; takes the branded type, which is what earns the totality |\n| Updates | Spread operator, never mutate |\n| Composition | `pipe(aggregate, op1, op2, op3)` |\n| Fallible composition | `pipe(aggregate, op1, chain(op2))` |\n| Validation | Composable `Validator\u003CRaw, Valid>` pipeline; narrows the type |\n| Enrichment | Pipeline at system boundary |\n| Handler | Orchestrator: validate → load → domain → persist |\n| Handler args | Dependencies positional, then the Command\u002FQuery last |\n| Model args | Data first, aggregate last (`op(data)(aggregate)`) |\n| Command handler type | `export type XHandler = (command: XCommand) => Promise\u003CResult\u003CT, E>>` |\n",{"name":5,"description":7},"main","479b264ec17cc5fafbf36287a1087472d3a386d3","plugins\u002Ftypescript\u002Fskills\u002Fddd-ts-fp",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":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add FabienSalles\u002Fclaude-marketplace --skill ddd-ts-fp",{"tool":58,"command":59},"bunx","bunx skills add FabienSalles\u002Fclaude-marketplace --skill ddd-ts-fp",{"tool":61,"command":62},"pnpm","pnpm dlx skills add FabienSalles\u002Fclaude-marketplace --skill ddd-ts-fp","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fddd-ts-fp\u002FSKILL.md",true,[66],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fddd-functional-examples.md","REFERENCE","参考文档",7228,"https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fddd-ts-fp\u002Freferences\u002Fddd-functional-examples.md",[73,97,112,128,148,164],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":39},"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",[],[80,81,82,83,84,85,86,87,88,89,33,90,91,21,29,92,93,94,95,96],"test","vitest","conventions","vitest test conventions","testing","writing","tdd","workflow","file","testing patterns","files","nestjs","project","tests","module","fn","testing principles",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":39},"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",[],[86,87,104,81,105,85,106,88,36,107,33,108,90,21,29,109,92,93,110,111],"tdd workflow","vitest tdd workflow","dev","fix","red-green-refactor","green","feature","app",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":39},"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",[],[119,120,85,30,38,36,121,122,123,124,125,33,126,32,127,91,31,21,29,28],"refactoring","ts refactoring","refactor","simplify","Rules","node","redesign","up","clean",{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":39},"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",[],[135,136,137,80,20,138,33,139,140,91,141,21,29,142,25,143,144,145,146,147],"ports","ts ports adapters","memory","Composition","container","functions","Literal","dependency-injection","tokens","as","type","id","adapter",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":39},"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",[],[155,156,157,30,20,36,158,159,119,123,160,33,161,31,21,29,27,162,163,144],"oop","ts oop","design","methodology","immutable","ask","refactoring methodology","record","collections",{"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},"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",[],[171,137,20,172,173,138,135,33,174,175,176,21,29,177,25,178,179,145,147,180],"ts layer boundaries","controller","boundary","router","only","endpoints","structure","cqrs","worker","import"]