Agent skill

Counterfact Maintenance

by counterfact in counterfact/api-simulator

Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility.

MITAuto-check passedBackend & APIs

Install Counterfact Maintenance

skills CLI
$ npx skills add counterfact/api-simulator --skill counterfact-maintenance -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install counterfact/api-simulator counterfact-maintenance --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/counterfact/api-simulator.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/counterfact-maintenance .claude/skills/counterfact-maintenance && rm -rf skills-src

Use ~/.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/

Facts

Skill name
counterfact-maintenance
GitHub stars
170
Token cost
~3.1k tokens
SKILL.md length
1,546 words
Files
1
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility.

  • Works in 6 steps: State the user-visible regression or… → Identify the product interface that a… → Launch the shipped product without… → …
  • Tasks that involve Operations and SOPs
  • SKILL.md covers When to use this skill, Files to inspect first, Existing conventions to follow and Black-box test boundary, plus 3 more sections
  • Calls yarn, rg and npm

What it does

Counterfact Maintenance is an agent skill from counterfact/api-simulator. Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility.

Its SKILL.md is about 3.1k 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 Operations and SOPs and OpenAPI specifications. It works with TypeScript and 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.

When your agent uses it

  • Tasks that involve Operations and SOPs
  • Tasks that involve OpenAPI specifications

Example prompts

  • “/counterfact-maintenance”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. State the user-visible regression or behavior in one sentence.
  2. Identify the product interface that a user would operate.
  3. Launch the shipped product without importing application packages into the test harness or a standalone consumer script.
  4. Assert only observable output such as terminal text, HTTP responses, exit status, or generated files.
  5. Confirm the test fails with the regression present, not merely that it passes after the fix.
  6. Search test-black-box/ for generated consumer scripts, direct package imports, and private source or build paths

What it can do on your machine

Read from SKILL.md and the folder at commit fc1c7f8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    Shell commands in SKILL.md call:

    • yarn
    • rg
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use yarn and npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Counterfact Maintenance loads about 3.1k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 1,546 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from counterfact/api-simulator at commit fc1c7f8, republished under its MIT licence (© counterfact). 1,546 words, ~3,091 tokens.

Download SKILL.mdSave it as .claude/skills/counterfact-maintenance/SKILL.md (or your agent's skills folder).
name
counterfact-maintenance
description
Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility.
applyTo
packages/counterfact/src/**/*.ts, packages/counterfact/test/**/*.ts, packages/counterfact/docs/**/*.md, test-black-box/**/*.py, docs/**/*.md, site/**…

Counterfact Maintenance Skill

When to use this skill

Use this skill when finalizing contributor-facing changes that affect tests, diagnostics/errors, release semantics, docs, or compatibility guarantees.

Files to inspect first

  • package.json (canonical scripts)
  • AGENTS.md
  • packages/counterfact/docs/reference.md
  • packages/counterfact/docs/faq.md
  • .changeset/*.md (format examples)
  • packages/counterfact/test/**/* for existing patterns/fixtures

Existing conventions to follow

  • Keep historical study environments under site/study/2026/experiments/environments/ excluded from Renovate; their manifests and lockfiles are reproducibility evidence, not maintained application dependencies. When changing ignorePaths, preserve the exclusions inherited from config:recommended because the array replaces inherited values.

  • Use usingTemporaryFiles() for filesystem-heavy tests.

  • The Astro site uses compressHTML: true to preserve HTML whitespace around inline prose across source line breaks. Keep that setting explicit when upgrading Astro, and run cd site && npm run test:whitespace for rendering or formatting changes. Check generated text before applying CSS spacing: punctuation and intentional in-word links must remain adjacent.

  • Keep single-line command snippets in a focusable horizontal scroll region, with copy controls outside that region. A scrolling flex item needs min-width: 0 so long text cannot widen the whole page. Emitted CSS/HTML checks establish this contract; they do not replace browser checks of scrolling, keyboard access, or viewport overflow.

  • In file-watching tests, register the expected event listener before writing the file, then await the saved promise. Close watchers in test teardown so Jest timeouts cannot skip cleanup; restore any changed working directory there as well.

  • For source or tsconfig analysis in repository tooling, use the existing TypeScript parser instead of custom tokenizers or JSONC stripping. Preserve the source filename so TypeScript and TSX syntax are parsed correctly.

  • Package-boundary export checks validate public subpaths across conditions; they do not replace installed-consumer tests for runtime resolution. Keep regression coverage for null exclusions and overlapping export patterns.

  • Keep tests focused by subsystem (packages/counterfact/test/cli, packages/counterfact/test/server, packages/counterfact/test/typescript-generator, packages/counterfact/test/util).

  • Preserve documented behavior promises (e.g., regen preserves route edits; types are regenerated).

  • When terminal output displays an HTTP message, split its head and body at the first \r\n\r\n separator only: multipart bodies contain additional separators that must remain visible.

  • For user-facing behavior changes: add a changeset and update docs under packages/counterfact/docs/.

  • After Changesets versions workspace packages, run yarn install --mode skip-build --no-immutable so yarn.lock can match the new internal versions before immutable installation; CI enables Yarn immutability by default, so the explicit override is required in release:version.

  • A push to main with no remaining changesets publishes the merged package versions automatically; a manual Release workflow dispatch is the retry and recovery path.

  • Keep the npm-publish environment name, OIDC permission, and provenance setting aligned with the npm trusted-publisher configuration.

  • Use OS-assigned ephemeral ports for tests that start network servers; fixed high ports can collide on shared CI hosts.

  • When an OpenAPI-aware request builder gains an input kind or encoding rule, keep the route-catalog metadata, immutable builder state, required-input diagnostics, help and inspection output, wire serialization, public docs, focused unit tests, and ephemeral-port integration tests aligned. Define and test precedence whenever two builder methods compete for the same HTTP request entity.

  • When a status check is required by a merge-queue ruleset, configure its workflow to run on merge_group with checks_requested; a pull_request-only workflow leaves the queue's synthetic commit without that check and eventually times out.

  • When a pull-request workflow's decision depends on labels, include labeled and unlabeled activity types so a label change refreshes the required status rather than leaving a stale result.

  • For public repository-history audits, record classification confidence separately from chronology confidence. Use an exact origin only when the introducing change is demonstrated; otherwise publish the earliest confirmed affected bound and label it as a bound.

  • Keep audit windows, population rules, candidate dispositions, deduplication rules, immutable source identifiers, and derived totals in a checked-in manifest with an offline consistency check. Do not make a headline denominator depend only on hand-maintained page copy or a live search URL.

  • For time-to-report quality cohorts, close intake early enough to give every included release the same fixed follow-up. Publish the complete candidate ledger, treat unresolved response cases as censored, make raw event counts primary when exposure units are heterogeneous, and label rate denominators as sensitivity analyses.

Black-box test boundary

Reserve test-black-box/ for implementation-unaware behavioral tests that exercise Counterfact as a complete product through user-facing interfaces. A test is black-box because it controls product inputs and observes product outputs without depending on implementation details, not because it runs in a particular process. The product execution may cross several packages without the harness knowing or selecting which packages are involved. These tests may be more sensitive to subtle regressions than they are helpful at pinpointing their source.

Gherkin feature files are the authoritative inventory of black-box behavior. Each scenario should describe a coherent developer journey and preserve every distinct user-visible claim, while equal or stronger journey coverage should replace duplicate assertions. Python under test-black-box/ is limited to pytest-bdd scenario bindings, step glue, and lifecycle support; do not add standalone pytest test functions as a second behavioral inventory. Create contracts and configurations inside the scenario's temporary project instead of relying on mutable state or shared checked-in fixtures. Reuse one generated project and server within a scenario, but never share mutable state between scenarios. Use dynamic ports, deterministic named examples, bounded polling with complete process diagnostics, and teardown that terminates every child process.

Allowed observation and control surfaces are:

  • The shipped counterfact CLI's arguments, stdin, stdout, stderr, and exit status.
  • HTTP requests to a server started through that CLI.
  • Files generated or changed by that CLI.
  • Keystrokes and terminal output from a CLI process attached to a real pseudo-terminal.

Do not put a test in test-black-box/ if it does any of the following:

  • Generates or runs a standalone consumer script whose purpose is to exercise counterfact or @counterfact/* package APIs directly.
  • Imports package source files, private modules, or dist paths.
  • Constructs an application, server, runner, registry, loader, or client directly instead of operating the shipped product.
  • Mocks implementation internals or asserts private state, internal call order, or concrete implementation topology.
Show full SKILL.md (574 more words)Show less

The test layers are intentionally complementary:

  • Black-box tests detect externally observable behavioral drift, including regressions that emerge only across package boundaries.
  • Unit and type tests isolate behavior and provide faster, more diagnostic failures.
  • Package-consumer and contract tests exercise declared package exports directly.
  • Packed-consumer and package-closure tests prove that published artifacts install with complete declared dependencies and exports.

A separate process is neither necessary nor sufficient evidence that a test is black-box. Calling the shipped CLI from Python is valid; using Python only to launch a Node script that imports packages is a package-consumer test, not a product black-box test. Writing an editable generated route and letting the shipped CLI load it remains a product black-box test, even when that route uses a documented handler type from counterfact. Broad and focused tests may overlap when they protect behavior at different abstraction levels.

Before adding or approving a black-box test:

  1. State the user-visible regression or behavior in one sentence.

  2. Identify the product interface that a user would operate.

  3. Launch the shipped product without importing application packages into the test harness or a standalone consumer script.

  4. Assert only observable output such as terminal text, HTTP responses, exit status, or generated files.

  5. Confirm the test fails with the regression present, not merely that it passes after the fix.

  6. Search test-black-box/ for generated consumer scripts, direct package imports, and private source or build paths:

    bash
    rg -n '_run_node_script|consume\.mjs|--eval|input-type=module|packages/.+/(src|dist)/' test-black-box
    rg -n '@counterfact/|import .*counterfact|from .*counterfact' test-black-box

For interactive CLI behavior, use a real pseudo-terminal and send the literal keystrokes a user would type. If the required terminal facility is unavailable on an operating system, skip explicitly and ensure another CI operating system executes the test; do not replace the test with a direct function call. Keep that operating-system skip scoped to the real-terminal scenario so non-interactive journeys continue to run cross-platform.

Common mistakes to avoid

  • Introducing direct fs imports in tests instead of usingTemporaryFiles helper.
  • Treating a Python-launched Node consumer as a product black-box test because it runs in a child process.
  • Testing a REPL completer callback directly instead of operating the CLI through a terminal.
  • Adding a direct pytest black-box test instead of extending or adding a Gherkin journey.
  • Sharing a generated project, fixed port, server process, or mutable contract across scenarios.
  • Omitting focused tests because a broad black-box test already covers the behavior.
  • Treating package-consumer coverage as proof that packed artifacts are complete.
  • Shipping behavior changes without docs + changeset updates.
  • Breaking backward compatibility unintentionally (CLI defaults, regeneration guarantees, response semantics).
  • Relying only on broad tests; skip targeted tests for touched areas.
  • Writing task-specific "decision logs" without turning repeatable lessons into durable instructions.
  • Presenting a source-preserving refactor as a defect's origin, or silently omitting standalone external defect pull requests from a report population.

Embedding learnings into guidance

  • When a non-trivial task reveals repeatable guidance, update the relevant skill file in the same PR, or create a new skill if applicable.
  • Put subsystem-specific learnings in the matching skill (counterfact-cli-runtime, counterfact-runtime-architecture, or counterfact-generator-internals).
  • Put cross-cutting learnings in AGENTS.md only when they do not belong to a single subsystem skill.

How to validate the change

  • Baseline: yarn lint:fix, yarn lint, yarn build, yarn test.
  • Run targeted tests for touched modules before full test run.
  • If server startup or CLI behavior changed, run yarn build then yarn test:black-box.
  • For black-box changes, run the boundary searches above and resolve or explicitly reclassify every finding in the touched scope.

© counterfact, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/counterfact-maintenance of counterfact/api-simulator.

Open the folder on GitHubat commit fc1c7f8

Compare with similar skills

Counterfact Maintenance 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.

Counterfact Maintenance compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Counterfact Maintenance this skillcounterfact/api-simulator170—~3.1kAutomated safety check: PassMIT
Kingdee MCP DevWaHaiLong/KingdeeMCP105—~853Automated safety check: PassMIT
OpenAPI to MCP Servermcp-use/mcp-use11k—~5.2kAutomated safety check: PassApache-2.0
Api2clialexknowshtml/api2cli454—~2.9kAutomated safety check: PassMIT
Projectsamchon/nestia2.2k—~3kAutomated safety check: PassMIT
API ContractChenyCHENYU/Robot_Admin1k—~1.9kAutomated safety check: PassMIT

Similar skills

  • Kingdee MCP Dev

    WaHaiLong/KingdeeMCP

    Knowledge base for the Kingdee MCP Dev Squad. An agent skill from WaHaiLong/KingdeeMCP.

    105 GitHub stars~853 tokensUpdated 2 mo ago
    Backend & APIsAuto-check passed
  • OpenAPI to MCP Server

    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.

    11k GitHub stars~5.2k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Api2cli

    alexknowshtml/api2cli

    Generate a working CLI from any API, then wrap it in a Claude Code skill.

    454 GitHub stars~2.9k tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Project

    samchon/nestia

    Defines the nestia product contract, workspace layout, package boundaries, the Go plugin composition model, and canonical commands.

    2.2k GitHub stars~3k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • API Contract

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.

    1k GitHub stars~1.9k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Typescript

    scalar/scalar

    Write clear, predictable TypeScript and Vue TypeScript code with strong typing, maintainability, and consistent documentation conventions.

    16k GitHub stars~1.1k tokensUpdated today
    Backend & APIsAuto-check passed

More from counterfact/api-simulator

All 12 skills in this repo
  • Counterfact PR Creation

    counterfact/api-simulator

    Create Counterfact pull requests with the required agent-authored acceptance and repository-learning notes; do not use to review another PR.

    170 GitHub stars~918 tokensUpdated today
    Auto-check passed
  • Counterfact Repl

    counterfact/api-simulator

    Interact with Counterfact mock API server programmatically. An agent skill from counterfact/api-simulator.

    170 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • Build Simulation

    counterfact/api-simulator

    Build a fully simulated API from an OpenAPI spec using Counterfact.

    170 GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Counterfact Repo Basics

    counterfact/api-simulator

    Provide Counterfact repository orientation, high-level architecture, and the canonical command reference for install/build/test/lint workflows.

    170 GitHub stars~868 tokensUpdated today
    Auto-check passed
  • Route

    counterfact/api-simulator

    Edit Counterfact route files to add endpoint behavior while keeping handlers thin and delegating business logic to context classes.

    170 GitHub stars~341 tokensUpdated today
    Auto-check passed
  • Scenario

    counterfact/api-simulator

    Create and update Counterfact scenario modules that seed or mutate context state through reusable scenario functions.

    170 GitHub stars~356 tokensUpdated today
    Auto-check passed

Questions about Counterfact Maintenance

What does Counterfact Maintenance do?

Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility. Counterfact Maintenance is an agent skill from counterfact/api-simulator. Keep contributor changes aligned with repository test patterns, diagnostics, black-box test boundaries, release/versioning workflow, documentation requirements, and compatibility.

When should I use Counterfact Maintenance?

Counterfact Maintenance fits situations like: tasks that involve Operations and SOPs; tasks that involve OpenAPI specifications.

How do I install Counterfact Maintenance in Claude Code?

Run `npx skills add counterfact/api-simulator --skill counterfact-maintenance -a claude-code`. Or copy the skill folder (.github/skills/counterfact-maintenance in counterfact/api-simulator) into .claude/skills/counterfact-maintenance in your project. Claude Code loads it when a task matches its description.

How do I install Counterfact Maintenance in Codex?

Run `npx skills add counterfact/api-simulator --skill counterfact-maintenance -a codex`. Or copy the skill folder (.github/skills/counterfact-maintenance in counterfact/api-simulator) into .agents/skills/counterfact-maintenance in your project. Codex loads it when a task matches its description.

Can I use Counterfact Maintenance in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add counterfact/api-simulator --skill counterfact-maintenance -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/counterfact-maintenance, .gemini/skills/counterfact-maintenance, .github/skills/counterfact-maintenance and .opencode/skills/counterfact-maintenance in your project.

What does Counterfact Maintenance need to run?

Going by SKILL.md and its folder, Counterfact Maintenance needs the command-line tools its instructions call (yarn, rg and npm). Our summary lists: Python 3.

Does Counterfact Maintenance access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Counterfact Maintenance safe to install?

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.

What licence does Counterfact Maintenance use?

Counterfact Maintenance is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Counterfact Maintenance use?

About 3.1k 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.

What are the alternatives to Counterfact Maintenance?

Skills that share tags, products or a category with Counterfact Maintenance: Kingdee MCP Dev (WaHaiLong/KingdeeMCP, 105 stars), OpenAPI to MCP Server (mcp-use/mcp-use, 11k stars), Api2cli (alexknowshtml/api2cli, 454 stars) and Project (samchon/nestia, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Counterfact Maintenance?

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 10, 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.