[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CRM83WB13HCBDFG1P1N4F1":3,"skill-same:01M7CRM83WB13HCBDFG1P1N4F1":49},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7CRM83WB13HCBDFG1P1N4F1","node-typescript-testing",null,"Use when writing tests for a TypeScript service on Node.js - Vitest or the repository's Jest \u002F node:test, fakes at port boundaries, HTTP through app.inject or supertest, Testcontainers Postgres for queries, fake timers, test-first","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Fnode-typescript-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: node-typescript-testing\ncategory: testing\ndescription: Use when writing tests for a TypeScript service on Node.js - Vitest or the repository's Jest \u002F node:test, fakes at port boundaries, HTTP through app.inject or supertest, Testcontainers Postgres for queries, fake timers, test-first\ntech_stack: TypeScript (Node.js)\n---\n# TypeScript Service Testing\n\n## Overview\n\nTest-first, same discipline as everywhere (see tdd-workflow): write the failing test, watch it fail, minimal code to pass. This skill is the Node.js mechanics for a backend.\n\n**Core principle:** unit-test services and the domain with fakes for their ports; prove routes, validation and SQL against the real framework and a real database, without opening a port where the framework lets you.\n\n## Test levels\n\n| Level | What it covers | Tools |\n|-------|-----------------|-------|\n| Unit | Domain functions and types | the repository's runner: Vitest, Jest or `node:test` |\n| Unit with fakes | Service, its ports faked | `vi.fn()` \u002F `jest.fn()` objects satisfying the port interface |\n| HTTP | Route registration, validation, error shape, auth | Fastify `app.inject()`, Nest `Test.createTestingModule` + supertest, supertest on an Express app |\n| Persistence | Queries and migrations against real Postgres | `@testcontainers\u002Fpostgresql` + the repository's migrate command |\n\nNever add a second runner. A new project uses Vitest.\n\n## Unit test with a faked port\n\n```ts\ndescribe(\"TaskService.create\", () => {\n  const repo = { add: vi.fn\u003CTaskRepository[\"add\"]>().mockResolvedValue(undefined) };\n  const service = new TaskService(repo);\n\n  beforeEach(() => repo.add.mockClear());\n\n  it(\"persists and returns the task\", async () => {\n    const task = await service.create(\"Write the report\", \"user-1\");\n    expect(task).toMatchObject({ title: \"Write the report\", ownerId: \"user-1\" });\n    expect(repo.add).toHaveBeenCalledWith(task);\n  });\n\n  it.each([\"\", \"   \", \"x\".repeat(201)])(\"rejects the title %j\", async (title) => {\n    await expect(service.create(title, \"user-1\")).rejects.toThrow(InvalidTaskTitle);\n    expect(repo.add).not.toHaveBeenCalled();\n  });\n});\n```\n\n## HTTP test without a port (Fastify)\n\n```ts\nit(\"answers 400 in the problem shape for a blank title\", async () => {\n  const app = buildApp({ taskService: fakeService });\n  const res = await app.inject({ method: \"POST\", url: \"\u002Ftasks\", payload: { title: \"\" }, headers: auth(\"user-1\") });\n  expect(res.statusCode).toBe(400);\n  expect(res.headers[\"content-type\"]).toContain(\"application\u002Fproblem+json\");\n  expect(res.json()).toMatchObject({ errors: { title: expect.any(String) } });\n});\n```\n\n## Rules\n\n- **Fake the port, not the module.** Pass fakes through the constructor or the app factory. `vi.mock(\"..\u002Fdb\")` of your own modules couples the test to file layout; keep module mocks for third-party clients the code cannot inject.\n- Assert on the returned value or the response body first; a call assertion alone proves only that the fake ran.\n- `it.each` \u002F `test.each` for boundary tables. One behaviour per test, named for it.\n- **Time:** `vi.useFakeTimers()` + `vi.setSystemTime(...)` (or Jest's) for anything date- or timeout-dependent; restore in `afterEach`. Never `setTimeout` waits in a test.\n- **Real Postgres for SQL:** one container per test file or suite (`beforeAll`), the repository's migrations applied, data truncated or rolled back between tests. Not SQLite, not pg-mem, for queries that ship to Postgres.\n- Every async assertion is awaited (`await expect(...).rejects`); a forgotten `await` passes silently.\n- Tests compile under the same `strict` config as the source; no `as any` to build a fixture — write a small builder.\n- Focused run while iterating: `npx vitest run src\u002Ftasks\u002Ftask.service.test.ts` or `-t \"rejects the title\"`; the full `npm test` plus `npm run typecheck` before you stop. Coverage with the runner's own (`vitest run --coverage`); mutation testing, where the repository runs it, is StrykerJS.\n\n## Common Mistakes\n\n- A test that passes because the promise it checks was never awaited.\n- Fake timers left on and leaking into the next test file.\n- Snapshotting a whole response body with ids and timestamps in it — brittle, and it approves whatever the code returned.\n- Starting the real server on a fixed port in tests that run in parallel.\n\n## Red Flags\n\n- `it.skip` \u002F `it.only` committed.\n- A unit test that needs Docker or the network.\n- Mocks asserting the implementation's private call order rather than its behaviour.\n","# TypeScript Service Testing\n\n## Overview\n\nTest-first, same discipline as everywhere (see tdd-workflow): write the failing test, watch it fail, minimal code to pass. This skill is the Node.js mechanics for a backend.\n\n**Core principle:** unit-test services and the domain with fakes for their ports; prove routes, validation and SQL against the real framework and a real database, without opening a port where the framework lets you.\n\n## Test levels\n\n| Level | What it covers | Tools |\n|-------|-----------------|-------|\n| Unit | Domain functions and types | the repository's runner: Vitest, Jest or `node:test` |\n| Unit with fakes | Service, its ports faked | `vi.fn()` \u002F `jest.fn()` objects satisfying the port interface |\n| HTTP | Route registration, validation, error shape, auth | Fastify `app.inject()`, Nest `Test.createTestingModule` + supertest, supertest on an Express app |\n| Persistence | Queries and migrations against real Postgres | `@testcontainers\u002Fpostgresql` + the repository's migrate command |\n\nNever add a second runner. A new project uses Vitest.\n\n## Unit test with a faked port\n\n```ts\ndescribe(\"TaskService.create\", () => {\n  const repo = { add: vi.fn\u003CTaskRepository[\"add\"]>().mockResolvedValue(undefined) };\n  const service = new TaskService(repo);\n\n  beforeEach(() => repo.add.mockClear());\n\n  it(\"persists and returns the task\", async () => {\n    const task = await service.create(\"Write the report\", \"user-1\");\n    expect(task).toMatchObject({ title: \"Write the report\", ownerId: \"user-1\" });\n    expect(repo.add).toHaveBeenCalledWith(task);\n  });\n\n  it.each([\"\", \"   \", \"x\".repeat(201)])(\"rejects the title %j\", async (title) => {\n    await expect(service.create(title, \"user-1\")).rejects.toThrow(InvalidTaskTitle);\n    expect(repo.add).not.toHaveBeenCalled();\n  });\n});\n```\n\n## HTTP test without a port (Fastify)\n\n```ts\nit(\"answers 400 in the problem shape for a blank title\", async () => {\n  const app = buildApp({ taskService: fakeService });\n  const res = await app.inject({ method: \"POST\", url: \"\u002Ftasks\", payload: { title: \"\" }, headers: auth(\"user-1\") });\n  expect(res.statusCode).toBe(400);\n  expect(res.headers[\"content-type\"]).toContain(\"application\u002Fproblem+json\");\n  expect(res.json()).toMatchObject({ errors: { title: expect.any(String) } });\n});\n```\n\n## Rules\n\n- **Fake the port, not the module.** Pass fakes through the constructor or the app factory. `vi.mock(\"..\u002Fdb\")` of your own modules couples the test to file layout; keep module mocks for third-party clients the code cannot inject.\n- Assert on the returned value or the response body first; a call assertion alone proves only that the fake ran.\n- `it.each` \u002F `test.each` for boundary tables. One behaviour per test, named for it.\n- **Time:** `vi.useFakeTimers()` + `vi.setSystemTime(...)` (or Jest's) for anything date- or timeout-dependent; restore in `afterEach`. Never `setTimeout` waits in a test.\n- **Real Postgres for SQL:** one container per test file or suite (`beforeAll`), the repository's migrations applied, data truncated or rolled back between tests. Not SQLite, not pg-mem, for queries that ship to Postgres.\n- Every async assertion is awaited (`await expect(...).rejects`); a forgotten `await` passes silently.\n- Tests compile under the same `strict` config as the source; no `as any` to build a fixture — write a small builder.\n- Focused run while iterating: `npx vitest run src\u002Ftasks\u002Ftask.service.test.ts` or `-t \"rejects the title\"`; the full `npm test` plus `npm run typecheck` before you stop. Coverage with the runner's own (`vitest run --coverage`); mutation testing, where the repository runs it, is StrykerJS.\n\n## Common Mistakes\n\n- A test that passes because the promise it checks was never awaited.\n- Fake timers left on and leaking into the next test file.\n- Snapshotting a whole response body with ids and timestamps in it — brittle, and it approves whatever the code returned.\n- Starting the real server on a fixed port in tests that run in parallel.\n\n## Red Flags\n\n- `it.skip` \u002F `it.only` committed.\n- A unit test that needs Docker or the network.\n- Mocks asserting the implementation's private call order rather than its behaviour.\n",{"name":5,"category":24,"tech_stack":25,"description":7},"testing","TypeScript (Node.js)","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Fnode-typescript-testing",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill node-typescript-testing",{"tool":41,"command":42},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill node-typescript-testing",{"tool":44,"command":45},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill node-typescript-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Fnode-typescript-testing\u002FSKILL.md",true,[],[50,56,63,70,77,84],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"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":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]