Skip to main content

Global flags

Every subcommand accepts these flags. Global flags can be placed before or after the subcommand name.

Exit codes

Reqbook returns stable exit codes you can reliably test for in CI scripts. See the Exit codes reference for CI usage examples.

rqb init

Scaffold a new api-docs/ project in the current directory.
Without --yes, Reqbook prompts for any missing values. --yes uses my-api and http://localhost:8080 as defaults when no flags are provided.
rqb init does not overwrite existing files. If a file already exists, it exits with an error naming the conflicting file. It creates both _shared/env.template.md and _shared/env.md, then appends .env.local and the generated <collection>/_shared/env.md path to .gitignore if they are not already present.
Examples
Exit codes: 0 on success, 3 on filesystem error.

rqb validate

Validate one endpoint file, one pipeline file, or all markdown files under a directory.
Reqbook classifies each file by location and name:
  • Files named env.md or env.template.md → validated as environment config.
  • Files under flows/ → validated as pipeline files.
  • reqbook.md and README.md → checked for frontmatter only.
  • All other .md files → validated as endpoint files.
Each error message includes the file path, line number when known, and a suggested fix. Examples
Exit codes: 0 if all files are valid, 2 if any spec is invalid, 5 if a secret is detected.

rqb exec

Execute one endpoint file and compare the actual response against the expected response.
When --env=prod or --env=production is used in an interactive terminal, Reqbook prompts for confirmation before sending the request. In non-interactive shells, Reqbook refuses to send production requests unless --yes is passed after deliberate review.
If a referenced variable is not resolved from any source, Reqbook exits with code 2 before making any network request, and prints a suggested fix naming the variable and where to define it. Examples
Exit codes: 0 response matches, 1 assertion fails, 2 invalid spec, 3 engine error, 4 network error, 5 secret detected.

rqb diagnose

Run one endpoint and print a compact diagnosis for the next debugging step. This is intended for coding agents and developers after rqb exec fails.
rqb diagnose returns passed, status, error_type, likely_cause, next_action, inspect, verify, and a compact diff. Agents should use it after a failed rqb exec before reading backend source broadly. Examples
Exit codes: 0 if diagnosis completed and printed a diagnosis, even when the endpoint failed. Non-zero exit is reserved for CLI setup errors such as invalid --var syntax, production confirmation refusal, or output serialization failure.

rqb flow

Execute a pipeline file. Steps run sequentially by default, with optional parallelism.
--parallel and --no-parallel are mutually exclusive. Steps that depend on a captured value from a previous step always wait for that step regardless of parallel mode.
Examples
Exit codes: 0 all steps pass (or continue-on-error is set), 1 any step fails, 2 pipeline spec invalid, 3 engine error, 4 network error.

rqb index

Regenerate api-docs/README.md from the current set of markdown files under api-docs/.
No flags. The generated file contains a linked list of all markdown files grouped by resource. Do not edit api-docs/README.md by hand it is overwritten on every rqb index run.
rqb index is run automatically by rqb init and by all rqb import subcommands. Run it manually only if you added or renamed files after an import.
Example
Exit codes: 0 on success, 3 on filesystem error.

rqb import

Convert an existing API spec file into Reqbook markdown endpoint files. All subcommands write endpoint files under api-docs/, then run rqb index automatically. Complex logic (pre-request scripts, dynamic variables, JavaScript assertions) is imported as agent-task blocks for manual review. After any import: run rqb validate api-docs/ and move any secrets to .env.local. See the Migration guide for per-tool concept mapping and post-import checklists.

rqb import postman

Import a Postman Collection v2.1 JSON export.

rqb import insomnia

Import an Insomnia v4 JSON export.

rqb import openapi

Import an OpenAPI 3.x spec in YAML or JSON format.

rqb import collection

Import a local API client collection directory.

rqb import http

Import a .http / REST Client request file.

rqb import curl

Import a single cURL command as a Reqbook endpoint file.
Exit codes (all import subcommands): 0 on success, 2 if the input file is not a valid spec for that tool, 3 on filesystem error.

rqb export openapi

Export endpoint specs as OpenAPI 3.x YAML or JSON.

rqb check

Run PR-focused contract checks for endpoint and flow specs.

rqb context

Print bounded executable API context for coding agents.
Use --mode surgical --brief --max-fields 12 --include variables,request,response,errors,rules,verify --no-guidance for most Codex/Claude/Cursor implement, review, and debug tasks. It returns method/path, variables, bounded request/response/error fields, literal error codes, compact business rules, and verify commands without repeated guidance. Use --max-fields 6 only for a known single-field lookup, and use --mode schema when another tool or agent needs machine-readable contract JSON.

rqb agent pack

Write an agent-ready markdown pack containing Reqbook context, guardrails, and suggested verify commands.
Use the generated pack as the initial prompt/context file for Codex, Claude, Cursor, or another coding agent. It tells the agent which APIs matter, which commands are safe to run, and how to verify the implementation.

rqb skills

Install, list, or remove Reqbook skill files for AI coding agents. Skills are embedded in the binary no network access required.

rqb skills install

Install Reqbook skill files into detected AI agent config directories.
Supported agent names: claude-code, cursor, copilot, codex-cli, antigravity, opencode, windsurf. Reqbook detects agents by checking for their config directories (.claude/, .cursor/, .github/, etc.).
After upgrading Reqbook, run rqb doctor --fix to update installed skills to the new binary version automatically.

rqb skills list

List detected AI agents and whether Reqbook skills are installed and up-to-date for each.
No flags.

rqb skills uninstall

Remove installed Reqbook skill files.
Exit codes (all skills subcommands): 0 on success, 3 on filesystem error.

rqb install mcp

Install Reqbook MCP server configuration for one agent or every detected agent.
Supported agent names: claude-code, cursor, copilot, codex-cli, antigravity, opencode, windsurf. After installing, restart the agent or use its MCP reload/list command.

rqb serve

Start the local web preview server.
The web preview reads the same markdown files as the CLI. No build step is required. The server watches for file changes and refreshes connected browsers automatically.
Exit codes: 0 on clean shutdown (Ctrl-C), 3 on startup error.

rqb doctor

Check the project environment for common setup problems.
rqb doctor checks:
  • Whether api-docs/ exists.
  • Whether .env.local and <collection>/_shared/env.md are listed in .gitignore.
  • Whether all specs under api-docs/ are valid.
  • Which AI agent config directories are present.
  • Whether installed skills match the current binary version.
  • Whether an outbound network connection can be made.
--fix applies safe fixes automatically: adds missing local environment entries to .gitignore, and reinstalls stale skills.
Run rqb doctor as the first debugging step when rqb exec, rqb validate, or an AI agent skill behaves unexpectedly.
Exit codes: 0 if all checks pass, 1 if any check fails.

rqb mock

Start a mock HTTP server that replays recorded expected responses.
The mock server reads ## Expected response blocks from your endpoint files and serves their bodies at the corresponding HTTP methods and paths. Useful for frontend development when the live backend is unavailable.

rqb mcp

Start a Model Context Protocol server that exposes Reqbook tools to AI agents.
No flags. The MCP server exposes the following tools to any MCP-compatible AI agent: Install an agent config:
See AI agent integration for full setup and usage details.

rqb completion

Print a shell completion script to stdout.
Exit codes: 0 always.

rqb version

Print the installed version of Reqbook and exit.
No flags.
Exit codes: 0 always.