scenario

Seed and mutate Counterfact mock runtime context via reusable scenario modules.

169|19|Updated Apr 8, 2022
One-click install
npx skills add https://github.com/counterfact/api-simulator --skill scenario-counterfact
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scenario
Source: https://github.com/counterfact/api-simulator/tree/main/skills/scenario
Command: npx skills add https://github.com/counterfact/api-simulator --skill scenario-counterfact

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Seed and mutate runtime context for Counterfact mocks using reusable scenario modules, enabling repeatable test setups and reproducible environments.

Core Features & Use Cases

  • Organize scenario files under scenarios/ and export a startup hook to seed data at boot.
  • Provide a clear API for Scenario functions that receive $ and helpers.
  • Use scenarios/index.ts as the primary export surface for integration with mocks.

Quick Start

Create a scenarios/ directory and implement a startup function in scenarios/index.ts to seed initial state at boot.

Frequently Asked Questions about scenario

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I seed initial state for API mocks at boot?

To seed initial state for API mocks at boot, create a scenarios/ directory and export a startup hook from scenarios/index.ts. This startup function runs when the mock server initializes, populating the runtime context with baseline data.

What is a scenario module for mock state management?

A scenario module is a reusable file that seeds and mutates runtime context for Counterfact mocks. It provides a Scenario API that receives the $ context object and helper functions to enable repeatable test setups and reproducible environments.

How do I organize scenario files for repeatable test setups?

Organize scenario files under a scenarios/ directory and use scenarios/index.ts as the primary export surface. This structure allows mock integrations to import and apply scenario modules to mutate runtime context for repeatable test setups.

Can I mutate runtime context after the mock server starts?

Yes, you can mutate runtime context after the mock server starts by calling scenario modules. These modules receive the $ context object, allowing you to update the seeded data during the server lifecycle for different test cases.

Does seeding state with scenario modules require a specific project structure?

Seeding state with scenario modules requires placing scenario files in a scenarios/ directory and exposing a startup hook through scenarios/index.ts. This project structure allows the runtime context to be seeded at boot.