This guide covers both the published npm install path and the local clone workflow.
If you want to use APD without cloning the repo first:
npm install -g @apd-spec/cliThen create and validate a new APD scaffold locally:
apd init my-procedure.apd.json
apd validate my-procedure.apd.json --strictBefore exporting, replace the scaffold placeholders in my-procedure.apd.json with a real summary and at least one real step instruction.
Or generate a first scaffold from natural language with a configured provider:
export OPENAI_API_KEY=...
apd generate "Review a refund request, approve high-value refunds, then notify the customer" --provider openai --output refund-review.apd.json
apd validate refund-review.apd.json --strictUse --provider anthropic with ANTHROPIC_API_KEY if you prefer Claude. Generated APDs are review scaffolds: inspect inferred nodes, approval gates, risks, and recovery guidance before exporting.
Then export the refined APD to SOP markdown:
apd export my-procedure.apd.json --format sop-mdIf you want to build APD tooling programmatically, install the SDK separately:
npm install @apd-spec/sdkIf you want to run the checked-in examples such as examples/invoice-logging.apd.json, use the clone workflow below.
- Node.js and npm installed locally
- the APD repo cloned to your machine
- commands run from the repository root
npm installnpm run buildnode packages/cli/bin/apd.js init my-procedure.apd.jsonThis writes a strict-clean minimal procedure definition scaffold.
node packages/cli/bin/apd.js validate my-procedure.apd.json --strictYou should see a PASS line with no WARN lines for the starter scaffold.
node packages/cli/bin/apd.js info examples/invoice-logging.apd.jsonThis prints the procedure id, start node, node counts, and a path preview.
OPENAI_API_KEY=... node packages/cli/bin/apd.js generate "Review a refund request, approve high-value refunds, then notify the customer" --provider openai --output refund-review.apd.json
node packages/cli/bin/apd.js validate refund-review.apd.json --strictYou can use --provider anthropic with ANTHROPIC_API_KEY, or --api-key-env <NAME> when the key is stored under a custom environment variable.
node packages/cli/bin/apd.js export my-procedure.apd.json --format sop-mdThis prints the generated SOP markdown to stdout.
To write a file instead:
node packages/cli/bin/apd.js export my-procedure.apd.json --format sop-md --output /tmp/my-procedure.sop.mdnode packages/cli/bin/apd.js aer validate examples/invoice-logging.aer-v0.2.json --strict
node packages/cli/bin/apd.js aer compare examples/invoice-logging.apd.json examples/invoice-logging.aer-v0.2.jsonnode packages/cli/bin/apd.js visualize examples/invoice-logging.apd.json --format mermaid
node packages/cli/bin/apd.js visualize examples/invoice-logging.apd.json --format svg > /tmp/invoice-logging.svgnpm testThat runs:
- SDK tests
- CLI tests
- the smoke script across all APD examples and fixtures
npm run publish-smoke- Read
./apd-for-agents.md - Read
./capture-to-apd.md - Compare APD JSON and SOP markdown in
./apd-to-sop-example.md - Inspect
../adapters/strandsor../adapters/claude-skills