{"slug":"mocking-microcks-typescript","title":"mocking-microcks-typescript","summary":"Use when the mocking-strategy-roster resolved (microcks, TypeScript) — the default mocking strategy that serves a downstream HTTP API from its OpenAPI contract in a Microcks container (@microcks/microcks-testcontainers) for a Vitest gateway integration test. Emits mock wiring onl","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:42:32.093872Z","repo":{"url":"https://github.com/SebastienDegodez/skraft-plugin","stars":17,"forks":3,"license":"GPL-3.0","updatedAt":"2026-11-29T00:18:21Z"},"bodyHtml":"<hr>\n<h2>name: mocking-microcks-typescript\ndescription: Use when the mocking-strategy-roster resolved (microcks, TypeScript) — the default mocking strategy that serves a downstream HTTP API from its OpenAPI contract in a Microcks container (@microcks/microcks-testcontainers) for a Vitest gateway integration test. Emits mock wiring only; the business TDD cycle stays with the software-engineer lead.</h2>\n<h1>Mocking — Microcks x TypeScript adapter (default)</h1>\n<p>Serves the downstream API from its contract in a Microcks container and points the gateway\nunder test at the mock endpoint. Loaded ONLY when <code>mocking-strategy-roster</code> resolved\n<code>(microcks, TypeScript)</code>.</p>\n<p><strong>Boundary:</strong> mock wiring + integration-test scaffold only. No business TDD, no provider\ncontract verification.</p>\n<h2>Prerequisites</h2>\n<ul>\n<li>devDependency <code>@microcks/microcks-testcontainers</code> (0.3.x, which brings <code>testcontainers</code>);\nDocker reachable from the test run.</li>\n<li>The downstream contract (OpenAPI, plus <code>.apiexamples</code> when the examples live apart) under\n<code>contracts/</code> or the location the <code>contract-testing</code> skill chose.</li>\n</ul>\n<h2>Recipe — gateway against the Microcks mock</h2>\n<pre><code>// tests/integration/{feature}/infrastructure/Http{Feature}Gateway.test.ts\n// @vitest-environment node\nimport path from 'node:path'\n\nimport { MicrocksContainer, type StartedMicrocksContainer } from '@microcks/microcks-testcontainers'\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest'\n\nimport { HttpRatesGateway } from '../../../../src/expenses/infrastructure/HttpRatesGateway'\n\nlet microcks: StartedMicrocksContainer\n\nbeforeAll(async () =&gt; {\n  microcks = await new MicrocksContainer()\n    .withMainArtifacts([path.resolve('contracts/rates-openapi.yaml')])\n    .start()\n}, 120_000)\n\nafterAll(async () =&gt; {\n  await microcks?.stop()\n})\n\ndescribe('HttpRatesGateway', () =&gt; {\n  it('should read the rate the contract example returns', async () =&gt; {\n    const gateway = new HttpRatesGateway(microcks.getRestMockEndpoint('Rates API', '1.0.0'))\n\n    expect(await gateway.rate('USD')).toBe(1.08)\n  })\n})\n</code></pre>\n<p><code>getRestMockEndpoint(&lt;info.title&gt;, &lt;info.version&gt;)</code> takes the title and version of the\nOpenAPI document. Each example in the contract is one answer the mock gives: add a contract\nexample for every case the gateway must handle (a 422, a 409), never a handler in the test.</p>\n<h2>Structured result back to the lead</h2>\n<p>Return, do not commit:</p>\n<pre><code>strategy: microcks\nstack: typescript\nfiles:\n  - tests/integration/{feature}/infrastructure/Http{Feature}Gateway.test.ts\ntestCommand: &lt;resolved via resolving-stack-commands&gt;\nnotes: Microcks mock of {downstream} from contracts/{file}\n</code></pre>\n<h2>Rules</h2>\n<ul>\n<li>Mock the DOWNSTREAM API from its contract; never the feature's own use cases or components.</li>\n<li>One container per test file, started in <code>beforeAll</code> with a generous timeout and stopped in\n<code>afterAll</code>.</li>\n<li>Microcks stays out of <code>tests/unit</code> (G7).</li>\n<li>Use <code>resolving-stack-commands</code> for the test command — never hardcode <code>vitest</code>.</li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":2970,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:44:08.294001Z","sha256":"E7C08ABB0476C7325E280C45B1892CCF7201E4A30DA705B64CC565954F58ADF3","sizeBytes":1458},"review":null,"source":{"repositoryUrl":"https://github.com/SebastienDegodez/skraft-plugin","path":"plugins/skraft-framework/skills/mocking-microcks-typescript","license":"GPL-3.0","commit":"c6117c6236a25490bf1916b131866069740c9b22","subtreeSha":"9A80F1AC774D0C084D48A53410FD3C75AA6A4F8AF0FF8F9CC486723728C02EB4","lastSyncedAt":"2026-11-29T00:42:27.348488Z"},"reviewedAt":"2026-11-29T00:47:55.676511Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/SebastienDegodez/skraft-plugin/tree/main/plugins/skraft-framework/skills/mocking-microcks-typescript"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install sebastiendegodez-skraft-plugin@llmmart"},{"target":"git","command":"git clone https://github.com/SebastienDegodez/skraft-plugin.git"}]}