协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
stripe【开发与工程】Read Stripe account state from a terminal or agent: balance, payment intents, and subscriptions — and perform guarded mutations like canceling a subscription — backed by a bundled stripe-cli script that is read-only first and gates every state-changing command behind a --dry-run/--yes confirmation. Use when an agent needs to answer questions about ac…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill to read Stripe account state and, with explicit confirmation, perform guarded mutations: account balance, payment intents, subscriptions, and subscription cancellation. This is a tool skill for the Stripe platform. Building Stripe payments into an application is integration development; this skill owns the everyday agent workflow: answering "what is our balance?", "which payments succeeded?", "what subscriptions are active?", and applying a confirmed cancellation.
stripe-cli script's primary surface is these reads.--dry-run preview and --yes confirmation through stripe-cli. Cancellations are financial actions with billing consequences: confirm the subscription, the timing, and the impact before acting.limit and has_more; never page past what the task needs. stripe-cli --limit caps every listing.scripts/stripe-cli is an agent-first, stdlib-only CLI over the Stripe API. It is read-only-first: balance, payments, and subscriptions are the primary surface; the only mutation is guarded.
stripe/scripts/stripe-cli --help # no key or network needed
stripe/scripts/stripe-cli --json balance show
stripe/scripts/stripe-cli --json --limit 20 payments list
stripe/scripts/stripe-cli --json --limit 20 subscriptions list
stripe/scripts/stripe-cli --json subscriptions get --id sub_123
stripe/scripts/stripe-cli subscriptions cancel --id sub_123 --dry-run # preview
stripe/scripts/stripe-cli subscriptions cancel --id sub_123 --yes # confirmed
Exit codes: 0 success, 1 API error or failed check, 2 usage error. Cancellations are guarded: without --dry-run or --yes the script refuses with exit 1 and never calls the API. Reads are bounded by --limit (default 20, max 100).
balance show for available and pending funds; payments list for recent payment intents; subscriptions list/subscriptions get for active subscriptions and their items.--dry-run and confirmed with --yes.cancel_at_period_end is set (cancellation at period end) — and state that the customer keeps service until that date.GET /balance): available and pending balances per currency. A read-only snapshot of account funds.GET /payment_intents): recent payment intents with amount, currency, status (succeeded, requires_action, etc.), and customer. Bounded by --limit; has_more tells you whether the cap hid further records.GET /subscriptions, GET /subscriptions/{id}): active subscriptions with status, customer, period end, and items (price, amount, interval). A read before any cancellation.Stripe amounts use minor units: ordinary zero-decimal currencies such as JPY display as whole units, while other currencies display two decimals. UGX and ISK retain two-decimal API values for backward compatibility, so an amount of 500 displays as 5.00 UGX or 5.00 ISK. JSON preserves the original integer (amount_minor, or unit_amount_minor for subscription prices) and currency next to the formatted display value. HUF and TWD use two decimals for charge/price records (their whole-unit rule applies to manual payouts). Three-decimal currencies that Stripe does not support for presentment are rejected. See references/01-stripe-read-operations.md for sources and details.
subscriptions cancel --id sub_... --dry-run previews the cancellation; --yes confirms and posts cancel_at_period_end=true — the safe default that schedules cancellation at the period end (customer keeps service until then) rather than canceling immediately.cancel_at_period_end: true) before reporting success; a mismatch raises an error and no state change is assumed.cancel_at_period_end=false before the period ends. Immediate cancellation and refunds are deliberately NOT in this skill's mutation surface — they need a human at the Stripe dashboard or a dedicated integration.sk_...) or restricted keys (rk_...). Use a restricted key scoped to read-only (balance:read, payment_intents:read, subscriptions:read) for the read surface; add subscriptions:write only where cancellations are genuinely needed.sk_live_/sk_test_). Never point live keys at test data or vice versa; verify the key type before running anything that could touch real charges.STRIPE_API_KEY, never in code, chat, or commits. Rotate a leaked key immediately in the Stripe dashboard.| Load when | Reference |
|---|---|
| Sources, refresh procedure | references/00-source-index.md |
| Endpoints, pagination, cancellation semantics, errors | references/01-stripe-read-operations.md |
scripts/stripe-cli: bounded, stdlib-only CLI (balance, payments list, subscriptions list/get, guarded cancel; --json; --limit; mutation gated by --dry-run/--yes).tests/test_stripe_cli.py: 14 deterministic tests against a stub Stripe API, including USD/JPY formatting, special currency rules, raw-unit preservation, and the mutation gate.references/: dated source index + Stripe read-operations reference.evals/evals.json: seven output-quality evaluation cases for agent runs.| Claim | Minimum evidence |
|---|---|
| Balance is current | stripe-cli balance show --json returns available and pending per currency |
| A payment succeeded | stripe-cli payments list --json shows the intent with status succeeded |
| A subscription is active | stripe-cli subscriptions get --json returns status active and period end |
| A cancellation was accepted | stripe-cli subscriptions cancel --yes exits 0 and the response has cancel_at_period_end: true |
| A mutation is safe to run | stripe-cli subscriptions cancel --dry-run prints the exact subscription ID |
--dry-run preview, and --yes confirmation — cancellations have billing consequences.--limit; never dump full API keys, customer data, or raw payloads into chat.