Afrexai API Architect
LeoYeAI/openclaw-master-skills
Design, build, test, document, and secure production-grade APIs.
Build a fully simulated API from an OpenAPI spec using Counterfact.
$ npx skills add counterfact/api-simulator --skill build-simulation -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install counterfact/api-simulator build-simulation --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/build-simulation .claude/skills/build-simulation && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "build-simulation" agent skill from https://github.com/counterfact/api-simulator/tree/main/skills/build-simulation into .claude/skills/build-simulation/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "build-simulation", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/counterfact/api-simulator/tree/main/skills/build-simulationType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add counterfact/api-simulator --skill build-simulation -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install counterfact/api-simulator build-simulation --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/build-simulation .agents/skills/build-simulation && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "build-simulation" agent skill from https://github.com/counterfact/api-simulator/tree/main/skills/build-simulation into .agents/skills/build-simulation/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "build-simulation", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add counterfact/api-simulator --skill build-simulation -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install counterfact/api-simulator build-simulation --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/build-simulation .cursor/skills/build-simulation && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "build-simulation" agent skill from https://github.com/counterfact/api-simulator/tree/main/skills/build-simulation into .cursor/skills/build-simulation/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "build-simulation", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/counterfact/api-simulator.git --path skills/build-simulation--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add counterfact/api-simulator --skill build-simulation -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install counterfact/api-simulator build-simulation --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/build-simulation .gemini/skills/build-simulation && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "build-simulation" agent skill from https://github.com/counterfact/api-simulator/tree/main/skills/build-simulation into .gemini/skills/build-simulation/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "build-simulation", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install counterfact/api-simulator build-simulationInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add counterfact/api-simulator --skill build-simulation -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/build-simulation .github/skills/build-simulation && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "build-simulation" agent skill from https://github.com/counterfact/api-simulator/tree/main/skills/build-simulation into .github/skills/build-simulation/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "build-simulation", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add counterfact/api-simulator --skill build-simulation -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install counterfact/api-simulator build-simulation --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/build-simulation .opencode/skills/build-simulation && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "build-simulation" agent skill from https://github.com/counterfact/api-simulator/tree/main/skills/build-simulation into .opencode/skills/build-simulation/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "build-simulation", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
build-simulationBuild a fully simulated API from an OpenAPI spec using Counterfact.
Build Simulation is an agent skill from counterfact/api-simulator. Build a fully simulated API from an OpenAPI spec using Counterfact. Generate the initial scaffold, research the real API's behaviour, implement stateful context classes, write tests for those classes, and configure scenario scripts (including a startup scenario) so the mock server is immediately useful without manual setup.
Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Backend & APIs, covering OpenAPI specifications and Test generation. It works with OpenAPI. The repository describes itself as: Turn an OpenAPI spec into a local API in one command. Build and test your frontend with custom responses, shared state, and simulated failures, without waiting for the backend. The licence is MIT.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit ad1a2a3. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
npxFrom the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
petstore3.swagger.ioAlso links to:
counterfact.devgithub.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Build Simulation loads about 2.9k tokens when it runs. Until then it costs about 86 tokens; SKILL.md has 792 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from counterfact/api-simulator at commit ad1a2a3, republished under its MIT licence (© counterfact). 792 words, ~2,943 tokens.
.claude/skills/build-simulation/SKILL.md (or your agent's skills folder).Guide an AI agent through the full workflow of turning a bare OpenAPI spec into a realistic, stateful API simulation using Counterfact. This skill covers every step: generation, research, context implementation, testing, and scenario setup.
Run Counterfact against the spec to produce a working server immediately:
npx counterfact@latest <spec-url-or-path> <output-directory>Example:
npx counterfact@latest https://petstore3.swagger.io/api/v3/openapi.json apiThis creates:
<output-directory>/
├── routes/ # one .ts file per API path — edit these
└── types/ # generated request/response types — never edit theseEvery endpoint is live right away. By default each handler returns
schema-valid random data (.random()). The simulation work that follows will
replace those random responses with realistic, stateful behaviour.
Docs: Getting Started
Because the spec describes a well-known public API, look up official documentation before writing any simulation code. Understanding what the real API actually does is what separates a useful simulation from a pretty type stub.
Do at least the following:
sold").Use this research to inform what methods the context classes should expose, what validation the context should perform, and what data the startup scenario should seed.
Handlers should be thin. All stateful logic — lookups, mutations, derived
data, invariants, error conditions — belongs in a _.context.ts file. Handlers
read from context and return responses; they contain no business logic of
their own.
Place one _.context.ts at the root of the routes tree:
// api/routes/_.context.ts
import type { Pet } from "../types/components/pet.types.js";
export class Context {
private pets = new Map<number, Pet>();
private nextId = 1;
add(data: Omit<Pet, "id">): Pet {
const pet = { ...data, id: this.nextId++ };
this.pets.set(pet.id, pet);
return pet;
}
get(id: number): Pet | undefined {
return this.pets.get(id);
}
list(status?: Pet["status"]): Pet[] {
const all = [...this.pets.values()];
return status ? all.filter((p) => p.status === status) : all;
}
remove(id: number): boolean {
return this.pets.delete(id);
}
}Then wire the context into each handler:
// api/routes/pet.ts
export const GET: HTTP_GET = ($) =>
$.response[200].json($.context.list($.query.status));
export const POST: HTTP_POST = ($) =>
$.response[200].json($.context.add($.body));// api/routes/pet/{petId}.ts
export const GET: HTTP_GET = ($) => {
const pet = $.context.get($.path.petId);
return pet
? $.response[200].json(pet)
: $.response[404].text(`Pet ${$.path.petId} not found`);
};
export const DELETE: HTTP_DELETE = ($) => {
$.context.remove($.path.petId);
return $.response[200];
};For APIs with several distinct domains (users, orders, payments, …), give each
domain its own _.context.ts at its subtree boundary. Use
$.loadContext(path) to reach across boundaries when one domain needs data
from another:
// api/routes/payments/{paymentId}.ts
import type { Context as UsersContext } from "../../users/_.context.js";
export const GET: HTTP_GET = ($) => {
const payment = $.context.getById($.path.paymentId);
if (!payment) return $.response[404].text("Payment not found");
const usersCtx = $.loadContext("/users") as UsersContext;
const user = usersCtx.getById(payment.userId);
return $.response[200].json({ ...payment, user });
};Keep each context class focused on a single responsibility. If a class is growing too large, split it along domain lines.
Docs:
The context class accumulates real logic; bugs in it break every handler that
depends on it. Write unit tests that exercise the class directly, with no
server, no $ object, and no HTTP machinery.
// test/context.test.ts
import { Context } from "../api/routes/_.context.js";
describe("Context", () => {
let context: Context;
beforeEach(() => {
context = new Context();
});
it("assigns sequential ids", () => {
const a = context.add({ name: "Fluffy", status: "available", photoUrls: [] });
const b = context.add({ name: "Rex", status: "available", photoUrls: [] });
expect(a.id).toBe(1);
expect(b.id).toBe(2);
});
it("returns undefined for an unknown id", () => {
expect(context.get(99)).toBeUndefined();
});
it("filters by status", () => {
context.add({ name: "Fluffy", status: "available", photoUrls: [] });
context.add({ name: "Rex", status: "sold", photoUrls: [] });
expect(context.list("sold")).toHaveLength(1);
});
it("removes a pet", () => {
const pet = context.add({ name: "Fluffy", status: "available", photoUrls: [] });
context.remove(pet.id);
expect(context.get(pet.id)).toBeUndefined();
});
});Do not test handler files. Handlers are intentionally thin, freely editable, and contain no logic worth automating against. Only the context class needs tests.
Scenario scripts are TypeScript files in the scenarios/ directory. Each
file exports named functions that receive a $ argument giving access to live
context and a route builder. Run them from the REPL with .scenario, or have
one run automatically at startup.
Export a function named startup from scenarios/index.ts. Counterfact calls
it automatically when the server initialises, right before the REPL prompt
appears. Use it to seed realistic data so the server is immediately useful
without any manual REPL commands.
// api/scenarios/index.ts
import type { Scenario } from "../types/_.context.js";
export const startup: Scenario = ($) => {
$.context.add({ name: "Fluffy", status: "available", photoUrls: [] });
$.context.add({ name: "Rex", status: "sold", photoUrls: [] });
};For large startup sets, delegate to helper functions in separate files so each file stays focused and the helpers can also be called from the REPL:
// api/scenarios/index.ts
import type { Scenario } from "../types/_.context.js";
import { addPets } from "./pets.js";
import { addOrders } from "./orders.js";
export const startup: Scenario = ($) => {
addPets($, 20, "dog");
addOrders($, 5);
};// api/scenarios/pets.ts
import type { Scenario$ } from "../types/_.context.js";
export function addPets($: Scenario$, count: number, species: string) {
for (let i = 0; i < count; i++) {
$.context.add({
name: `${species} ${i + 1}`,
status: "available",
photoUrls: [],
});
}
}Write named exports for other useful states — an empty store, a rate-limited service, a full inventory. Run them from the REPL whenever you need them:
// api/scenarios/index.ts
export const soldOut: Scenario = ($) => {
$.context.list().forEach((p) => {
p.status = "sold";
});
};⬣> .scenario soldOut
Applied soldOutDocs:
Encode failure conditions in the context and toggle them on demand. This lets consumers of the simulation test error-handling code without coordinating with the real API.
// api/routes/_.context.ts
export class Context {
isRateLimited = false;
isDown = false;
// … rest of context …
}// api/routes/pet/{petId}.ts
export const GET: HTTP_GET = ($) => {
if ($.context.isDown) return $.response[500].text("Service unavailable");
if ($.context.isRateLimited) return $.response[429].text("Too many requests");
const pet = $.context.get($.path.petId);
return pet ? $.response[200].json(pet) : $.response[404].text("Not found");
};Toggle from the REPL or via a scenario:
⬣> context.isRateLimited = true
⬣> client.get("/pet/1")
{ status: 429, body: 'Too many requests' }| Topic | URL |
|---|---|
| Getting started | https://counterfact.dev/docs/getting-started.html |
| Full usage guide | https://counterfact.dev/docs/usage.html |
Reference ($ param, CLI flags) | https://counterfact.dev/docs/reference.html |
| State / context objects | https://counterfact.dev/docs/features/state.html |
| REPL | https://counterfact.dev/docs/features/repl.html |
| Pattern: Mock with Dummy Data | https://counterfact.dev/docs/patterns/mock-with-dummy-data.html |
| Pattern: Federated Context Files | https://counterfact.dev/docs/patterns/federated-context.html |
| Pattern: Test the Context, Not the Handlers | https://counterfact.dev/docs/patterns/test-context-not-handlers.html |
| Pattern: Scenario Scripts | https://counterfact.dev/docs/patterns/scenario-scripts.html |
| Pattern: Simulate Failures and Edge Cases | https://counterfact.dev/docs/patterns/simulate-failures.html |
| Pattern: AI-Assisted Implementation | https://counterfact.dev/docs/patterns/ai-assisted-implementation.html |
| Petstore example | https://github.com/counterfact/example-petstore |
Work through these steps in order:
npx counterfact@latest to generate the initial scaffold_.context.ts with typed methods for all CRUD operations.random()startup function from scenarios/index.ts that seeds realistic data© counterfact, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/build-simulation of counterfact/api-simulator.
Open the folder on GitHubat commit ad1a2a3
Build Simulation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Build Simulation this skillcounterfact/api-simulator | 170 | — | ~2.9k | Automated safety check: Pass | MIT | |
| Afrexai API ArchitectLeoYeAI/openclaw-master-skills | 2.2k | — | ~6.8k | Automated safety check: Pass | MIT | |
| Codexqa Testdata Generatoropenqa-cn/codexqa | 152 | — | ~4.8k | Automated safety check: Pass | Apache-2.0 | |
| ToolJet Marketplace Plugin BuilderToolJet/ToolJet | 41k | — | ~2.1k | Automated safety check: Pass | AGPL-3.0 | |
| Step Partsearthtojake/text-to-cad | 18k | 1 repos | ~1.5k | Automated safety check: Pass | MIT | |
| API DesignerJeffallan/claude-skills | 12k | 2 repos | ~2k | Automated safety check: Pass | MIT |
LeoYeAI/openclaw-master-skills
Design, build, test, document, and secure production-grade APIs.
openqa-cn/codexqa
Constructs test data against real backends and writes it back into test cases as executable preconditions.
ToolJet/ToolJet
Turns an API description, such as an OpenAPI file or a Postman collection, into a connector plugin for ToolJet's marketplace and checks it with the repo's validator.
earthtojake/text-to-cad
Find, evaluate, and download common purchasable CAD parts from step.parts, including named off-the-shelf actuators, servos, motors, electronics boards, connectors, screws, bolts, nuts, washers…
Jeffallan/claude-skills
Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.
mcp-use/mcp-use
Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.
counterfact/api-simulator
Create Counterfact pull requests with the required agent-authored acceptance and repository-learning notes; do not use to review another PR.
counterfact/api-simulator
Interact with Counterfact mock API server programmatically. An agent skill from counterfact/api-simulator.
counterfact/api-simulator
Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility.
counterfact/api-simulator
Provide Counterfact repository orientation, high-level architecture, and the canonical command reference for install/build/test/lint workflows.
counterfact/api-simulator
Edit Counterfact route files to add endpoint behavior while keeping handlers thin and delegating business logic to context classes.
counterfact/api-simulator
Create and update Counterfact scenario modules that seed or mutate context state through reusable scenario functions.
Works with
Categories
Build a fully simulated API from an OpenAPI spec using Counterfact. Build Simulation is an agent skill from counterfact/api-simulator. Build a fully simulated API from an OpenAPI spec using Counterfact.
Build Simulation fits situations like: tasks that involve OpenAPI specifications; tasks that involve Test generation.
Run `npx skills add counterfact/api-simulator --skill build-simulation -a claude-code`. Or copy the skill folder (skills/build-simulation in counterfact/api-simulator) into .claude/skills/build-simulation in your project. Claude Code loads it when a task matches its description.
Run `npx skills add counterfact/api-simulator --skill build-simulation -a codex`. Or copy the skill folder (skills/build-simulation in counterfact/api-simulator) into .agents/skills/build-simulation in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add counterfact/api-simulator --skill build-simulation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/build-simulation, .gemini/skills/build-simulation, .github/skills/build-simulation and .opencode/skills/build-simulation in your project.
Going by SKILL.md and its folder, Build Simulation needs the command-line tools its instructions call (npx). Our summary lists: Node.js.
SKILL.md names 3 domains. In commands or code: petstore3.swagger.io; the agent is likely to contact it when it follows the instructions. As links in the text: counterfact.dev and github.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Build Simulation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Build Simulation: Afrexai API Architect (LeoYeAI/openclaw-master-skills, 2.2k stars), Codexqa Testdata Generator (openqa-cn/codexqa, 152 stars), ToolJet Marketplace Plugin Builder (ToolJet/ToolJet, 41k stars) and Step Parts (earthtojake/text-to-cad, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
counterfact (a GitHub organization) maintains it in counterfact/api-simulator, which has 170 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 8, 2026.
Source: counterfact/api-simulator on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.