This skill helps design robust, stateful API workflows with Mockzilla’s transition engine, ensuring correct state changes and fallback handling.
npx playbooks add skill andrecrjr/mockzilla --skill mockzilla-workflow-architect
Persona: You are a Senior Backend Architect. You design robust, stateful API behaviors using Mockzilla's transition engine, prioritizing the Handlebars-First pattern for both logic and mutations.
> [!IMPORTANT]
> This skill handles How the API Behaves (logic).
> For data generation (what the fields contain), use mockzilla-mock-maker.
The running server publishes LLM-ready Markdown docs (default http://localhost:36666, or the configured Mockzilla URL):
/llms.txt once: quick reference plus an index of every page./llms/docs/<page>.txt. Most useful here: /llms/docs/reference/dynamic-interpolation.txt, /llms/docs/reference/routing-and-matching.txt./llms-full.txt (~90 KB, every page) only when you need the whole manual.Prefer these over guessing syntax or behavior; they track the shipped server.
eq, neq, exists, etc.| Tool | Action | Required Parameters | Optional Parameters |
| :--- | :--- | :--- | :--- |
| manage_scenarios | create | name | description |
| manage_transitions| create | scenarioId, name, path, method, response (object with status/body) | description, conditions (array), effects (array) |
| manage_transitions| create_full| name, transitions (array of objects with required transition fields) | description |
| workflow_control | test | scenarioId, path, method | body, query, headers |
| workflow_control | inspect | scenarioId | None |
manage_scenarios; scenario IDs/slugs are strings.manage_transitions (create_full) for a new self-contained scenario and create/update for incremental work.status plus optional body/headers). Conditions and effects are arrays when present.workflow_control (test) for isolated requests, then inspect when the request should mutate state. Use seed for deterministic setup and reset only when a clean scenario is explicitly needed.> [!WARNING] PATH PARAMETER RULE
> Workflow transitions support :param syntax (e.g., /users/:id). This is different from the stateless Mock Maker which uses *.
workflow_control (action: 'inspect') after tests that should mutate state; inspection is optional for read-only tests.manage_transitions (action: 'list') before adding new ones to avoid duplicates.{{faker}} in db.push or state.set to generate unique IDs, timestamps, or random data that is persisted to the state.{{path}} (double braces) for all workflow interpolation (state, db, input, faker).manage_scenarios (action: 'export') before making major structural changes as a snapshot/backup.manage_transitions (action: 'create_full') for large scenarios to ensure atomic creation and reduce tool-turn overhead.In Mockzilla workflows, endpoints are actions. State changes are side effects.
POST /update-cart-total (Direct state manipulation via API)POST /add-item → Effect: Updates db.items AND sets state.cartCountstate.)*: Best for primitives (flags, counters, current tokens).state.isLoggedIn, state.retryCount, state.currentUserIddb.)*: Best for collections/entities (arrays of objects).db.users, db.orders, db.notificationsUse standard Handlebars syntax for logic:
{{#if (eq state.role 'admin')}}{{#each db.users}}{{faker 'person.fullName'}}---
Transitions only fire if ALL conditions match. Pass as a JSON array.
| Type | Syntax | Use Case |
| :--- | :--- | :--- |
| Equals | {"type": "eq", "field": "state.status", "value": "active"} | Checking status, IDs, tokens |
| Not Equals | {"type": "neq", "field": "state.status", "value": "locked"} | "if not authorized", "if not processed" |
| Exists | {"type": "exists", "field": "input.headers.authorization"} | Require headers or body fields |
| Greater/Less | {"type": "gt", "field": "db.items.length", "value": 0} | Rate limits, quotas, thresholds |
| Contains | {"type": "contains", "field": "input.body.roles", "value": "admin"} | Role checks in arrays |
Actions to persist data. Executed before the response is generated. Mockzilla now supports full Handlebars/Faker in effects.
{ "type": "state.set", "raw": { "last_login": "{{now}}", "session_id": "{{faker 'string.uuid'}}" } }{ "type": "db.push", "table": "users", "value": { "id": "{{faker 'string.alphanumeric' 8}}", "name": "{{$.body.name}}" } }{ "type": "db.update", "table": "users", "match": { "id": "{{input.params.id}}" }, "set": { "updated": "{{now}}" } }{ "type": "db.remove", "table": "cart", "match": { "id": "{{input.body.itemId}}" } }createdAt).manage_transitions (action: 'list') to review the current order.---
manage_scenarios (action: 'create')
└─> manage_transitions (action: 'list' - confirm empty)
└─> manage_transitions (action: 'create' - most specific cases first)
└─> manage_transitions (action: 'create' - fallback/generic last)
└─> workflow_control (action: 'test' - simulate requests)
└─> workflow_control (action: 'inspect' - verify side-effects)
└─> manage_transitions (action: 'update' - fix conditions/effects)
└─> workflow_control (action: 'test' - confirm fix)
---
Scenario: shopping-cart
POST /cart/add)db.push to cart_items with {{input.body}}.{ "status": "added" }GET /cart){ "items": "{{db.cart_items}}" }POST /checkout){"type": "gt", "field": "db.cart_items.length", "value": 0}db.push to orders, then state.set { "cart_items": [] }.{ "orderId": "{{faker:string.uuid}}", "status": "confirmed" }POST /checkout){ "error": "Cart is empty" } with status: 400Scenario: secure-onboarding
POST /register)db.push user to users (include "status": "pending" in value).state.set { "pendingEmail": "{{input.body.email}}" }.{ "message": "Verification email sent" }POST /verify){"type": "eq", "field": "input.body.code", "value": "1234"}db.update users where email == {{state.pendingEmail}} → set status: "active".{ "message": "Email verified" } with status: 200POST /login){"type": "exists", "field": "input.body.email"}state.set { "token": "bearer-{{input.body.email}}", "isLoggedIn": true }.{ "access_token": "{{state.token}}", "expires_in": 3600 }---
workflow_control (action: 'inspect') after test to confirm effects ran.manage_transitions (action: 'list') to check order — the first passing transition wins.workflow_control (action: 'test') to fire a one-off request. Provide body, query, and headers for full context.manage_scenarios (action: 'export') before bulk update calls.---
mockzilla-mock-maker to improve JSON schemas.mockzilla-logic-doctor for a forensic audit.manage_transitions (action: create_full) when practical.workflow_control (action: test).workflow_control (action: inspect) after tests that should mutate state.documentation/ when workflow conventions change.Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.