Labs

Streamlining Developer Workflow: Integrating Creem CLI with Claude Code for AI-Powered Payment Debugging

Streamlining Developer Workflow: Integrating Creem CLI with Claude Code for AI-Powered Payment Debugging

For developers building with Creem, the familiar workflow often involves a tedious loop: write code, open the dashboard, verify checkout completion, check webhook logs, compare with local state, and then return to the code. This process typically spans four tabs, three data formats, and consumes five minutes just to confirm a test purchase. This cycle repeats with every change.

This guide presents an alternative approach where developers remain entirely within the terminal. The Creem CLI supplies the necessary data, Claude Code interprets it, and the application displays the result. This consolidation streamlines the entire workflow—verification, debugging, and operation—into a single environment.

To demonstrate this concept, a small integration has been developed. The repository includes a minimal Bun + Hono application that manages checkout sessions and webhook processing. Additionally, it features a Claude Code skill designed to instruct the AI on safely operating the Creem CLI. This setup enables the entire development workflow to occur seamlessly from the terminal.

The Setup

The integration is intentionally kept small. It comprises a Bun server running Hono, which creates checkout sessions, receives and verifies webhook events from Creem using HMAC SHA-256, and persists local state to JSON files. The application's homepage features a color-coded status badge—green for access granted, red for revoked, yellow for in-progress, and gray for no activity—allowing developers to instantly grasp the current state without parsing JSON.

The app tracks a straightforward state machine: unknown → checkout-created → checkout-completed → granted → revoked. Each transition is driven by a webhook event. If a webhook does not arrive, the state remains unchanged, a detail that becomes crucial for debugging later.

A key aspect of this understanding is that the Creem CLI and the application represent two independent views of the same data. The CLI communicates directly with the Creem API, while the application only becomes aware of changes through webhook events. When these views align, the system functions correctly. Discrepancies, however, indicate a problem, and the CLI is instrumental in identifying its root cause.

Teaching Claude Code the Creem CLI

While Claude Code is a highly capable AI coding assistant, it lacks inherent knowledge of how to use the Creem CLI. It does not know the commands, flags, or conventions, such as Creem’s practice of returning monetary amounts in minor units (e.g., 500 represents 5.00 EUR, not 500.00).

To address this, a "skill" has been developed. In Claude Code, a skill is a structured document that educates the AI on how to effectively use a specific tool. It details the available commands, correct flags, essential safety rules, and common workflows.

The Creem CLI skill specifically includes:

  • A quick reference table for all supported commands, covering products, customers, checkouts, subscriptions, transactions, and configuration.
  • Operational rules, such as "always use --json for machine-readable output" and "never read or expose the config file at ~/.creem/config.json."
  • Conventions for money amounts: always convert minor units before presenting values to the user.
  • High-value workflows, including how to create and verify a checkout, look up customers, and manage subscription lifecycles.
  • Automation patterns for scripting and piping output through jq.

This skill is located in the repository at skills/creem-cli/SKILL.md and can be installed by anyone using a single command: npx skills add santiga.

↗ Read original source