DoorDash Spend Guard
A budget stated in a prompt is advisory — the model can forget it mid-session
and prompt injection can override it. This skill makes the budget
deterministic: every checkout and cart mutation goes through one audited
wrapper (dd-guard.sh) that prices the cart, checks the policy, and refuses
out-of-policy actions with a machine exit code. The companion PreToolUse hook
(doordash-spend-guard hook component) denies raw dd-cli order checkout-url /
dd-cli cart add-items calls that try to bypass the wrapper.
Unofficial community skill built on DoorDash's doordash-oss/doordash-cli.
Requires dd-cli installed and logged in. Wrapper needs python3.
Honest scope
- Caps apply to the pre-fee subtotal that
cart show exposes; fees, tip
and tax land on the DoorDash payment page. Documented headroom, not
loopholes.
- The ledger records intent when a checkout URL is issued; the human may
abandon the page.
/doordash-budget reconciles intents against
dd-cli order history, marking entries paid or abandoned.
- Enforcement teeth come from the hook + wrapper combo. Install both; the
skill alone is guidance.
Components in this bundle
| Piece |
Role |
| this skill |
protocol: always route through dd-guard, report headroom |
scripts/dd-guard.sh → installs to .claude/skills/doordash-spend-guard/scripts/dd-guard.sh |
the deterministic gate |
hook doordash/doordash-spend-guard |
denies bypasses of the wrapper |
command /doordash-budget |
view/edit policy, reconcile ledger |
State (created on first run)
~/.claude/dd-guard/limits.json — policy. Human-edited only. Never
edit this file yourself; when the user asks for a change, direct them to
/doordash-budget which confirms interactively.
{
"per_order_max": 40,
"daily_max": 60,
"weekly_max": 150,
"monthly_max": 400,
"cooldown_minutes": 45,
"allowed_hours": { "start": 7, "end": 23 }
}
~/.claude/dd-guard/ledger.jsonl — one line per priced action:
{"ts": "...", "cart_uuid": "...", "subtotal": 24.5, "status": "intent"}
(status becomes paid / abandoned after reconciliation).
Protocol (follow ALWAYS while this skill is installed)
- Session start / before building a cart: report headroom —
bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh status prints spend-to-date vs each
cap. Tell the user their remaining budget before adding items.
- Adding items: route through the wrapper —
bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh add-items <the exact dd-cli cart add-items args>
The wrapper execs the real dd-cli cart add-items ... and re-prices the
cart afterwards.
- Checkout: NEVER call
dd-cli order checkout-url directly. Use
bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh checkout <cart-uuid>
- exit 0 → it printed the checkout URL and appended a ledger intent line.
- exit 2 → blocked; it printed a human-readable reason (which cap, by how
much). Relay the reason verbatim, then help within policy — e.g. suggest
a cheaper reorder from
dd-cli order history or trimming the cart with
dd-cli cart remove-item.
- When blocked, do not negotiate with the wrapper. No editing
limits.json, no retrying with a fresh cart to reset the cooldown, no
splitting one order into several to duck the per-order cap. If the user
wants a different policy, point them to
/doordash-budget.
- If the wrapper reports the cart subtotal as unparseable, it blocks by
design (conservative default). Show the user the raw
cart show output
and ask them to confirm the total explicitly before any manual override.
Reading the ledger
Answer "how much have I spent this week?" from the ledger, not memory:
bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh status
# or raw:
cat ~/.claude/dd-guard/ledger.jsonl | jq -s '[.[] | select(.status != "abandoned")] | map(.subtotal) | add'
Remind the user that subtotals exclude fees/tips and intents may not have
been paid — /doordash-budget reconciles.
1---
2name: doordash-spend-guard
3description: Hard spending policy for agent-driven DoorDash ordering through the DoorDash CLI (dd-cli). Per-order ceiling, daily/weekly/monthly caps, cooldown between orders, and blocked hours — enforced deterministically by routing every cart-mutation and checkout through the dd-guard wrapper script, which prices the cart, checks the policy against a persistent spend ledger, and refuses out-of-policy checkouts with exit code 2. Use when the user wants budget limits on agent food ordering, asks "how much have I spent on DoorDash", wants to set spending caps, or whenever building carts / checking out with dd-cli while this skill is installed. Pairs with a PreToolUse hook that denies raw dd-cli checkout calls that bypass the wrapper.
4allowed-tools: Bash(dd-cli:*), Bash(bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh:*), Bash(command -v:*), Bash(mkdir:*), Bash(cat:*), Bash(jq:*), Read
5tags: [DoorDash, Budget, Spending Limits, Guardrails, CLI, Safety]
6metadata:
7 source: https://skillmd.com/skills/gabrielmoreira/doordash-spend-guard
8---
9
10# DoorDash Spend Guard
11
12A budget stated in a prompt is advisory — the model can forget it mid-session
13and prompt injection can override it. This skill makes the budget
14**deterministic**: every checkout and cart mutation goes through one audited
15wrapper (`dd-guard.sh`) that prices the cart, checks the policy, and refuses
16out-of-policy actions with a machine exit code. The companion PreToolUse hook
17(`doordash-spend-guard` hook component) denies raw `dd-cli order checkout-url` /
18`dd-cli cart add-items` calls that try to bypass the wrapper.
19
20> Unofficial community skill built on DoorDash's `doordash-oss/doordash-cli`.
21> Requires `dd-cli` installed and logged in. Wrapper needs `python3`.
22
23## Honest scope
24
25- Caps apply to the **pre-fee subtotal** that `cart show` exposes; fees, tip
26 and tax land on the DoorDash payment page. Documented headroom, not
27 loopholes.
28- The ledger records **intent** when a checkout URL is issued; the human may
29 abandon the page. `/doordash-budget` reconciles intents against
30 `dd-cli order history`, marking entries `paid` or `abandoned`.
31- Enforcement teeth come from the hook + wrapper combo. Install both; the
32 skill alone is guidance.
33
34## Components in this bundle
35
36| Piece | Role |
37|---|---|
38| this skill | protocol: always route through dd-guard, report headroom |
39| `scripts/dd-guard.sh` → installs to `.claude/skills/doordash-spend-guard/scripts/dd-guard.sh` | the deterministic gate |
40| hook `doordash/doordash-spend-guard` | denies bypasses of the wrapper |
41| command `/doordash-budget` | view/edit policy, reconcile ledger |
42
43## State (created on first run)
44
45- `~/.claude/dd-guard/limits.json` — policy. **Human-edited only.** Never
46 edit this file yourself; when the user asks for a change, direct them to
47 `/doordash-budget` which confirms interactively.
48
49```json
50{
51 "per_order_max": 40,
52 "daily_max": 60,
53 "weekly_max": 150,
54 "monthly_max": 400,
55 "cooldown_minutes": 45,
56 "allowed_hours": { "start": 7, "end": 23 }
57}
58```
59
60- `~/.claude/dd-guard/ledger.jsonl` — one line per priced action:
61 `{"ts": "...", "cart_uuid": "...", "subtotal": 24.5, "status": "intent"}`
62 (`status` becomes `paid` / `abandoned` after reconciliation).
63
64## Protocol (follow ALWAYS while this skill is installed)
65
661. **Session start / before building a cart**: report headroom —
67 `bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh status` prints spend-to-date vs each
68 cap. Tell the user their remaining budget before adding items.
692. **Adding items**: route through the wrapper —
70 `bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh add-items <the exact dd-cli cart add-items args>`
71 The wrapper execs the real `dd-cli cart add-items ...` and re-prices the
72 cart afterwards.
733. **Checkout**: NEVER call `dd-cli order checkout-url` directly. Use
74 `bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh checkout <cart-uuid>`
75 - exit 0 → it printed the checkout URL and appended a ledger intent line.
76 - exit 2 → blocked; it printed a human-readable reason (which cap, by how
77 much). Relay the reason verbatim, then help within policy — e.g. suggest
78 a cheaper reorder from `dd-cli order history` or trimming the cart with
79 `dd-cli cart remove-item`.
804. **When blocked, do not negotiate with the wrapper.** No editing
81 limits.json, no retrying with a fresh cart to reset the cooldown, no
82 splitting one order into several to duck the per-order cap. If the user
83 wants a different policy, point them to `/doordash-budget`.
845. If the wrapper reports the cart subtotal as unparseable, it blocks by
85 design (conservative default). Show the user the raw `cart show` output
86 and ask them to confirm the total explicitly before any manual override.
87
88## Reading the ledger
89
90Answer "how much have I spent this week?" from the ledger, not memory:
91
92```bash
93bash .claude/skills/doordash-spend-guard/scripts/dd-guard.sh status
94# or raw:
95cat ~/.claude/dd-guard/ledger.jsonl | jq -s '[.[] | select(.status != "abandoned")] | map(.subtotal) | add'
96```
97
98Remind the user that subtotals exclude fees/tips and intents may not have
99been paid — `/doordash-budget` reconciles.