Skip to content

Commit e4c75c7

Browse files
Merge pull request #16 from Postman-Devrel/003-flow-skills
Add Postman Flows CLI skills and slash commands
2 parents 053a497 + 8f06728 commit e4c75c7

13 files changed

Lines changed: 410 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The Postman Plugin for Claude Code — a pure-markdown, configuration-driven plu
1111
```
1212
.claude-plugin/plugin.json # Plugin manifest (name, version, metadata)
1313
.mcp.json # MCP server auto-config (Postman MCP at mcp.postman.com)
14-
commands/*.md # 11 slash commands (/postman:<name>)
15-
skills/*/SKILL.md # 7 skills (knowledge, agent-ready APIs, CLI, send-request, generate-spec, run-collection, context)
14+
commands/*.md # 15 slash commands (/postman:<name>)
15+
skills/*/SKILL.md # 11 skills (knowledge, agent-ready APIs, CLI, send-request, generate-spec, run-collection, context, and Flows: list-flows, trigger-flow, deploy-flow, get-flow-run)
1616
skills/*/references/*.md # On-demand reference files loaded by skills only when needed
1717
agents/readiness-analyzer.md # Sub-agent for API readiness analysis
1818
examples/ # Sample output (readiness report)
@@ -31,7 +31,7 @@ examples/ # Sample output (readiness report)
3131

3232
**Commands** (`commands/*.md`): YAML front matter with `description` and `allowed-tools`. Each defines a structured workflow invoked as `/postman:<name>`.
3333
- MCP commands: setup, sync, search, test, mock, docs, security, learn (learn requires Full mode — `searchLearningCenter` is absent in `minimal`/`code`)
34-
- CLI commands: request, generate-spec, run-collection
34+
- CLI commands: request, generate-spec, run-collection, list-flows, trigger-flow, deploy-flow, get-flow-run
3535

3636
**Skills** (`skills/*/SKILL.md`): YAML front matter with `name`, `description`, `user-invocable`. Auto-injected context, not directly invoked. `postman-knowledge` provides MCP tool guidance; `agent-ready-apis` provides readiness criteria; `postman-cli` provides CLI and git sync file structure knowledge; `postman-context` provides API discovery, exploration, and code generation from real API definitions.
3737

@@ -51,12 +51,16 @@ These are documented in `skills/postman-knowledge/mcp-limitations.md` and must b
5151

5252
## Postman CLI Commands
5353

54-
Three commands use the Postman CLI instead of MCP. They require `postman-cli` installed locally (`npm install -g postman-cli`) and authenticated (`postman login`). If CLI is not found, show install instructions and stop.
54+
Several commands use the Postman CLI instead of MCP. They require `postman-cli` installed locally (`npm install -g postman-cli`) and authenticated (`postman login`). If CLI is not found, show install instructions and stop.
5555

5656
- `/postman:request` — Send HTTP requests via `postman request <METHOD> <URL>`
5757
- `/postman:generate-spec` — Scan code for API routes, generate OpenAPI 3.0 YAML, validate with `postman spec lint`
5858
- `/postman:run-collection` — Run collection tests via `postman collection run <id>` using cloud IDs from `.postman/resources.yaml`
5959
- `/postman:context` — Discover, explore, and install APIs via `postman context`. Searches Postman's API network, fetches real API definitions, and generates client code from them.
60+
- `/postman:list-flows` — List flows in a workspace and resolve a flow name to its 24-char ID via `postman flows list`
61+
- `/postman:trigger-flow` — Trigger a deployed flow via `postman flows trigger`, with a deploy-then-trigger fallback when the flow isn't deployed
62+
- `/postman:deploy-flow` — Deploy a flow to make it triggerable via `postman flows deploy` (proposes and confirms a trigger path first)
63+
- `/postman:get-flow-run` — Inspect a run by Run ID via `postman flows get-run` (per-block logs, failing block, status)
6064

6165
CLI commands work with Postman's git sync structure: `postman/collections/` (v3 folder format), `postman/environments/`, `postman/specs/`, and `.postman/resources.yaml` for cloud ID mapping.
6266

commands/deploy-flow.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Deploy a Postman Flow so it becomes triggerable, proposing and confirming a trigger path
3+
allowed-tools: Bash, Read
4+
---
5+
6+
Deploy a Postman Flow using the Postman CLI. Follow the `deploy-flow` skill.
7+
8+
## Inputs (from the user's message)
9+
- The flow (a 24-char ID, or a name to resolve via `list-flows`)
10+
- Optionally a desired trigger path and whether auth is required
11+
12+
## Steps
13+
1. Resolve the flow ID (use `list-flows` if given a name; ask for the workspace if unknown).
14+
2. Propose a trigger path derived from the flow name (e.g. "Checkout" → `/checkout`) and **confirm the path + the deploy action** with the user — deploy is mutating and MUST NOT run without explicit confirmation.
15+
3. Show the command, then run it after confirmation:
16+
```bash
17+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows deploy <flowId> --path /checkout
18+
```
19+
4. Report the **Trigger URL** and whether the **trigger is enabled**. If it's off, offer `postman flows update <flowId> --trigger on` (confirm first).
20+
5. If this was part of a deploy-then-trigger request, hand back to `trigger-flow` to run it.
21+
22+
Always prefix CLI calls with `POSTMAN_CLI_SOURCE=claude-code-plugin`. Reuse existing `postman login` credentials — never authenticate twice.

commands/get-flow-run.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Inspect a Postman Flow run by its Run ID — per-block logs, failing block, and status
3+
allowed-tools: Bash, Read
4+
---
5+
6+
Inspect a specific Postman Flow run using the Postman CLI. Follow the `get-flow-run` skill.
7+
8+
## Inputs (from the user's message)
9+
- The Run ID (the `x-run-id` that `trigger-flow` reported; ask if unknown)
10+
- Optionally a block ID to focus on
11+
12+
## Steps
13+
1. Take the Run ID.
14+
2. Run a summary, then add `--logs` for detail:
15+
```bash
16+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows get-run --run-id <runId>
17+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows get-run --run-id <runId> --logs
18+
```
19+
Narrow to a block with `--filter <blockId>`.
20+
3. Report **which block failed and why** and the **run status**.
21+
22+
Read-only: no confirmation needed. Prefix CLI calls with `POSTMAN_CLI_SOURCE=claude-code-plugin`. Reuse existing `postman login` credentials.

commands/list-flows.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
description: List Postman Flows in a workspace and resolve a flow name to its 24-character ID
3+
allowed-tools: Bash, Read
4+
---
5+
6+
List Postman Flows in a workspace using the Postman CLI. Follow the `list-flows` skill.
7+
8+
## Inputs (from the user's message)
9+
- The workspace ID (ask if unknown)
10+
- Optionally a name/pattern to filter by
11+
12+
## Steps
13+
1. Ensure you have a workspace ID; ask which workspace if not.
14+
2. Run:
15+
```bash
16+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows list --workspace <workspaceId>
17+
```
18+
Narrow with `--filter "<name>"` when resolving a specific flow; use `--sort name` / `--paginate` as needed.
19+
3. Report flow **names + IDs** (and recent status where shown). When resolving a name for another action, return the single matching ID, or present candidates and ask the user to choose on multiple matches — never guess.
20+
21+
Read-only: no confirmation needed. Prefix CLI calls with `POSTMAN_CLI_SOURCE=claude-code-plugin`. Reuse existing `postman login` credentials.

commands/trigger-flow.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: Trigger (run) a deployed Postman Flow with inputs, and deploy-then-trigger it if it isn't deployed yet
3+
allowed-tools: Bash, Read
4+
---
5+
6+
Trigger a deployed Postman Flow from natural language, using the Postman CLI. Follow the `trigger-flow` skill.
7+
8+
## Inputs (from the user's message)
9+
- The flow (a 24-char ID, or a name to resolve via `list-flows`)
10+
- Any inputs / query params / headers / scenario
11+
- The workspace ID (ask if a name needs resolving and you don't have it)
12+
13+
## Steps
14+
1. Resolve the flow ID (use `list-flows` if given a name; disambiguate multiple matches; ask for the workspace if unknown).
15+
2. Build the flags from natural language: `-i k=v`, `-q k=v`, `--headers k=v`, `-s "<scenario>"`.
16+
3. Show the command, then run it:
17+
```bash
18+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows trigger <flowId> -i amount=4200
19+
```
20+
4. Report the **Run ID**, **HTTP status**, and **response body**.
21+
5. If not deployed → explain and **offer to deploy** (via `deploy-flow`, explicit confirmation required), then re-trigger. If the trigger is disabled → offer `postman flows update <flowId> --trigger on` (confirm), then trigger.
22+
6. On a non-2xx response → surface status + body and offer `get-flow-run --run-id <id>` for per-block detail.
23+
24+
Always prefix CLI calls with `POSTMAN_CLI_SOURCE=claude-code-plugin`. Reuse existing `postman login` credentials — never authenticate twice. Confirm before any mutating action (deploy, enable trigger).

skills/deploy-flow/SKILL.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
name: deploy-flow
3+
description: Deploy a Postman Flow so it becomes triggerable, using the Postman CLI. Use when the user wants to deploy, publish, or make a flow callable, or when trigger-flow found an undeployed flow and the user confirmed.
4+
---
5+
6+
You are a Postman Flows assistant that deploys Flows using the Postman CLI. Deploying makes a flow triggerable and returns its **Trigger URL**.
7+
8+
## The command this wraps
9+
10+
```bash
11+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows deploy <flowId> --path </path> [options]
12+
```
13+
14+
Options:
15+
- `-p, --path <path>`**required** URL path for the trigger (e.g. `/checkout`)
16+
- `-t, --timeout <timeout>` — HTTP session timeout, 5000ms–60000ms (default `10000ms`)
17+
- `-a, --auth` — enable authentication on the trigger
18+
19+
## Step 1: Resolve the flow ID
20+
21+
If given a name rather than a 24-char ID, resolve it with the `list-flows` skill (ask which workspace if unknown; disambiguate on multiple matches).
22+
23+
## Step 2: Propose a trigger path and CONFIRM
24+
25+
Deploy **requires** a URL path. Propose a sensible default derived from the flow name:
26+
- "Checkout" → `/checkout`
27+
- "Nightly Report" → `/nightly-report`
28+
29+
Confirm the path and the deploy action with the user before running — deploy is mutating and requires explicit confirmation.
30+
31+
Ask about authentication only if relevant ("Should the trigger require auth?"). Add `--auth` only if they say yes.
32+
33+
## Step 3: Deploy
34+
35+
Show the exact command, then run it after confirmation:
36+
37+
```bash
38+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows deploy 12345-67890-abcdef --path /checkout
39+
```
40+
41+
Report back:
42+
- the resulting **Trigger URL**
43+
- whether the **trigger is enabled**. If the CLI notes the trigger is off, tell the user and offer to enable it:
44+
```bash
45+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows update 12345-67890-abcdef --trigger on
46+
```
47+
(enabling is also a state change → confirm first).
48+
49+
Example report:
50+
```
51+
Deployed the Checkout flow.
52+
Trigger URL: https://<host>/checkout
53+
Trigger: enabled
54+
```
55+
56+
## Step 4: Hand back to trigger (if part of deploy-then-trigger)
57+
58+
If deploying was requested so the user could run the flow, hand control back to the `trigger-flow` skill to fire it and report the Run ID + status + response — completing the deploy-then-trigger journey in one conversation.
59+
60+
---
61+
62+
Read `references/flows-cli-baseline.md` for CLI prefixing, credential reuse, and error handling rules.
63+
64+
Deploying and enabling a trigger are mutating actions — confirm with the user before running. On a path conflict, surface the CLI message and propose an alternative path.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Flows CLI Baseline
2+
3+
These rules apply to every Flows CLI skill.
4+
5+
- Prefix every CLI call with `POSTMAN_CLI_SOURCE=claude-code-plugin` for telemetry attribution.
6+
- Reuse existing `postman login` / API key credentials. Do not trigger a second authentication.
7+
- Surface CLI errors verbatim. Do not assert access the CLI does not grant.
8+
- **CLI not installed:** "Postman CLI is not installed. Install with: `npm install -g postman-cli`"
9+
- **Not authenticated:** "Run `postman login` (or set `POSTMAN_API_KEY`)."

skills/get-flow-run/SKILL.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: get-flow-run
3+
description: Inspect a Postman Flow run by Run ID using the Postman CLI — per-block logs, failing block, and status. Use when a trigger returned a non-2xx or the user asks why a run failed.
4+
---
5+
6+
You are a Postman Flows assistant that inspects Flow runs using the Postman CLI.
7+
8+
## The command this wraps
9+
10+
```bash
11+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows get-run --run-id <runId> [options]
12+
```
13+
14+
Options:
15+
- `-r, --run-id <runId>`**required** (this is the `x-run-id` that `trigger-flow` reported)
16+
- `-l, --logs` — show the detailed event log
17+
- `--filter <blockId>` — focus the event log on one or more block IDs (repeatable)
18+
19+
## Step 1: Get the Run ID
20+
21+
Use the Run ID the trigger skill just reported (the `x-run-id`). If you don't have one, ask the user for it.
22+
23+
## Step 2: Inspect
24+
25+
Start with a summary, then add `--logs` for detail:
26+
27+
```bash
28+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows get-run --run-id session-abc123
29+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows get-run --run-id session-abc123 --logs
30+
```
31+
32+
Narrow to a suspect block:
33+
```bash
34+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows get-run --run-id session-abc123 --logs --filter blockId1
35+
```
36+
37+
## Step 3: Report
38+
39+
Parse the output and report, rather than dumping raw logs:
40+
- **which block failed and why** (the failing block + reason)
41+
- the **run status**
42+
43+
Example:
44+
```
45+
Run session-abc123 — failed
46+
Failing block: "HTTP Request (Get Orders)"
47+
Reason: downstream returned 504 after 10s timeout
48+
Status: error
49+
Suggestion: the upstream API timed out — retry, or raise the request timeout.
50+
```
51+
52+
---
53+
54+
Read `references/flows-cli-baseline.md` for CLI prefixing, credential reuse, and error handling rules.
55+
56+
This is a read-only operation — no confirmation needed. If the Run ID is not found, confirm it with the user (runs may take a moment to appear).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Flows CLI Baseline
2+
3+
These rules apply to every Flows CLI skill.
4+
5+
- Prefix every CLI call with `POSTMAN_CLI_SOURCE=claude-code-plugin` for telemetry attribution.
6+
- Reuse existing `postman login` / API key credentials. Do not trigger a second authentication.
7+
- Surface CLI errors verbatim. Do not assert access the CLI does not grant.
8+
- **CLI not installed:** "Postman CLI is not installed. Install with: `npm install -g postman-cli`"
9+
- **Not authenticated:** "Run `postman login` (or set `POSTMAN_API_KEY`)."

skills/list-flows/SKILL.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: list-flows
3+
description: List Postman Flows in a workspace using the Postman CLI, and resolve a flow name to its 24-character ID. Use when the user asks which flows they have, or when another skill needs to resolve a flow name to an ID before deploying or triggering.
4+
---
5+
6+
You are a Postman Flows assistant that lists Flows and resolves flow names to IDs using the Postman CLI.
7+
8+
## The command this wraps
9+
10+
```bash
11+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows list --workspace <workspaceId> [options]
12+
```
13+
14+
Options:
15+
- `-w, --workspace <workspaceId>`**required**
16+
- `-f, --filter <pattern>` — filter by name (name prefix or regex)
17+
- `-s, --sort <name|updated>` — sort criteria (default `updated`)
18+
- `-p, --paginate` — page through all flows
19+
20+
## Step 1: Get the workspace ID
21+
22+
A workspace ID is **required**. If you don't have one, ask the user which workspace to look in. Don't fail silently.
23+
24+
## Step 2: List
25+
26+
```bash
27+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows list --workspace 12345-67890-abcdef
28+
```
29+
30+
Narrow with `--filter` when resolving a specific name:
31+
```bash
32+
POSTMAN_CLI_SOURCE=claude-code-plugin postman flows list --workspace 12345-67890-abcdef --filter "Checkout"
33+
```
34+
35+
## Step 3: Report / resolve
36+
37+
- When the user asked to see their flows: report flow **names + IDs** (and recent status where shown).
38+
- When resolving a name for another skill:
39+
- **Single match** → use that ID.
40+
- **Multiple matches** → present the candidates (name + ID) and **ask the user to choose**. Never guess. (Edge case: ambiguous name)
41+
- **No match** → tell the user, and offer to list all flows in the workspace so they can pick.
42+
43+
Example:
44+
```
45+
Flows in workspace 12345-67890-abcdef:
46+
1. Checkout — 6f1a2b3c4d5e6f7a8b9c0d1e (updated 2h ago)
47+
2. Checkout (old) — 1a2b3c4d5e6f7a8b9c0d1e2f (updated 40d ago)
48+
Two flows match "Checkout" — which one?
49+
```
50+
51+
---
52+
53+
Read `references/flows-cli-baseline.md` for CLI prefixing, credential reuse, and error handling rules.
54+
55+
This is a read-only operation — no confirmation needed.

0 commit comments

Comments
 (0)