Skip to content

feat: update billing-integration skill to lead with SDK usage#54

Merged
benfoster merged 3 commits into
mainfrom
claude/issue-53-update-the-skills-to-reference
May 13, 2026
Merged

feat: update billing-integration skill to lead with SDK usage#54
benfoster merged 3 commits into
mainfrom
claude/issue-53-update-the-skills-to-reference

Conversation

@benfoster
Copy link
Copy Markdown
Contributor

Updates the billing-integration skill to default to the TypeScript and Python SDKs over hand-crafted HTTP calls, as requested in #53.

What changed

  • New SDK-or-HTTP decision step added early in the workflow
  • SDK initialisation snippets for TypeScript and Python in the API key setup section
  • Named SDK method for each integration area
  • SDK docs (docs.credyt.ai/sdk) now leads the reference section

How to test

  • claude --plugin-dir ./claude-plugins/credyt and run the billing-integration skill
  • Verify the skill asks about SDK preference before writing any code
  • Confirm TypeScript and Python init snippets appear in the API key step

Trade-offs

  • Other language users still get the HTTP path unchanged
  • billing-setup and billing-verification skills use MCP tools, not the SDK, so no changes needed there

Generated with Claude Code

Default to @credyt/api-client (TypeScript) and credyt-api (Python)
over hand-crafted HTTP calls. Adds an SDK selection step, concrete
initialisation snippets for both languages, and named SDK methods
for each integration area. HTTP remains available as an option for
other languages or explicit preference.

Closes #53

Co-authored-by: Ben Foster <benfoster@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@benfoster benfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude a few things to address.

Also we should include the direct docs page for each section in the skill in case the AI needs more help with the integration

e.g. the billing portal > https://docs.credyt.ai/quickstart/billing-portal

Comment thread skills/billing-integration/SKILL.md Outdated
- **Python** → `credyt-api` (`pip install credyt-api`)
- **Other language or preference for raw HTTP** → direct API calls with the `X-CREDYT-API-KEY` header

Ask if they'd prefer to use the SDK or hand-roll the HTTP calls. For TypeScript and Python users, lead with the SDK. The full SDK reference with examples for all three approaches is at [docs.credyt.ai/sdk](https://docs.credyt.ai/sdk).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the audience could be non-technical (e.g. vibe coders) we can first attempt to discover this based on the context of the AI tool in which we're running, falling back to asking the user with recommendations.

For example, Lovable, Bolt, Replit, V0 all default to Typescript. The LLM should know which platform it is running on. If using an AI coding assistant it should be able to make a decision based on the tech stack the user already has.

Final step will be a recommendation which the user has an option to override.

Comment thread skills/billing-integration/SKILL.md Outdated
)
```

**Direct HTTP:** Attach `X-CREDYT-API-KEY: <key>` to every request. Show them how to create a helper function or configured HTTP client instance that sets this header automatically.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not "showing them" - we just do it. This skill should be handling the integration, not expecting the user to wire it up themselves.

Comment thread skills/billing-integration/SKILL.md Outdated

Key points:
- Use `external_id` to link the Credyt customer to their app's user ID
- Use `externalId` / `external_id` to link the Credyt customer to their app's user ID
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reference the SDK fields - this will be apparent in the samples. So can leave to external_id

Comment thread skills/billing-integration/SKILL.md Outdated
Help the user wire Credyt into their application code. This skill works with the user's actual codebase — reading their existing code and adding Credyt integration in the right places.

The full integration guide with code examples is at [docs.credyt.ai/ai-integration.md](https://docs.credyt.ai/ai-integration.md). Fetch it for detailed patterns and examples when needed.
The full integration guide is at [docs.credyt.ai/ai-integration.md](https://docs.credyt.ai/ai-integration.md). SDK references with code examples are at [docs.credyt.ai/sdk](https://docs.credyt.ai/sdk).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All code examples in the docs have also been updated with HTTP, Typescript and Python examples. If the AI is unsure how to do something, they can consult the individual pages in the docs.

Comment thread skills/billing-integration/SKILL.md Outdated
If the product uses a recurring fixed fee (e.g. $20/month), the customer must pay upfront before their subscription activates. In this case the API returns a `pending` status rather than activating immediately.

Set `return_url`, `failure_url`, and `redirect_to` on the subscription creation call so Credyt knows where to send the customer after payment — before you ever redirect them anywhere:
Set `returnUrl` / `return_url`, `failureUrl` / `failure_url`, and `redirectTo` / `redirect_to` on the subscription so Credyt knows where to send the customer after payment — before you ever redirect them anywhere:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than trying to show the SDK specific field format, let's only show the api format (snake_case) and add a note at the top of the article on the casing of fields i.e. Typescript will be camelCase , python will be snake_case

@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude finished @benfoster's task in 3m 33s —— View job


Changes pushed

All review feedback addressed in 717011a:

  • Auto-detect language/platform — skill now checks for known AI platforms (Lovable, Bolt, Replit, V0 → TypeScript) and existing tech stack (package.json, requirements.txt) before falling back to asking. Presents a recommendation the user can override.
  • Field casing note — added a callout near the top: API uses snake_case, TypeScript SDK maps to camelCase, Python SDK keeps snake_case. Docs show all three.
  • Skill handles integration directly — changed "Show them how to create a helper function" → "Create a helper function" (section 1, Direct HTTP).
  • Simplified field references — all camelCase / snake_case dual references replaced with snake_case API format only throughout (e.g. return_url, failure_url, redirect_to, external_id, event_type, occurred_at).
  • SDK method signatures simplifiedclient.customers.create(...) rather than listing field names; docs link carries the detail.
  • Docs links per section — each integration area now links to its dedicated page:
    • Customer creation → docs.credyt.ai/quickstart/customers
    • Usage events → docs.credyt.ai/quickstart/usage-events
    • Cost tracking → docs.credyt.ai/quickstart/cost-tracking
    • Balance checks → docs.credyt.ai/quickstart/wallets
    • Billing portal → docs.credyt.ai/quickstart/billing-portal
    • Balance display → docs.credyt.ai/quickstart/wallets
      ·

- Auto-detect language/platform from context before asking user
- Add field casing note (API=snake_case, TS SDK=camelCase, Python SDK=snake_case)
- Skill handles integration directly instead of showing users what to do
- Simplify field references to snake_case API format throughout
- Add docs links to each integration section
- Update SDK method references to drop per-field signatures

Co-authored-by: Ben Foster <benfoster@users.noreply.github.com>
@benfoster
Copy link
Copy Markdown
Contributor Author

@claude thiink you hallucinated a few of those links mate

Customer creation → docs.credyt.ai/quickstart/customers
Usage events → docs.credyt.ai/quickstart/usage-events
Cost tracking → docs.credyt.ai/quickstart/cost-tracking
Balance checks → https://docs.credyt.ai/quickstart/check-balance
Billing portal → docs.credyt.ai/quickstart/billing-portal
Balance display → docs.credyt.ai/quickstart/wallets

We may also want to include some additional information about the customer signup flow. If the user wants to include promotional or bundled signup credits these can be done:

  1. As a one-off adjustment after customer creation -> https://docs.credyt.ai/advanced-topics/adjustments-charges-gifts
  2. Using entitlements -> https://docs.credyt.ai/features/product-catalog/entitlements

@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude finished @benfoster's task in 1m 3s —— View job


Changes pushed

  • Gather context
  • Fix incorrect doc links (6 URLs)
  • Add promotional/bundled signup credits section
  • Commit and push

All done in 221e82b:

Doc link corrections:

Section Was Now
Customer creation .../quickstart/customers .../quickstart/create-a-customer
Usage events .../quickstart/usage-events .../quickstart/send-usage
Cost tracking .../quickstart/cost-tracking .../features/profitability
Balance checks .../quickstart/wallets .../quickstart/check-balance
Balance display .../quickstart/wallets .../quickstart/check-balance
Billing portal .../quickstart/billing-portal ✓ already correct

Signup credits: Added a "Promotional or bundled signup credits" subsection at the end of section 2 (Customer creation), covering both approaches — one-off wallet adjustment and entitlements — with their correct doc links and a note for the skill to ask the user which fits their use case.
·

…egration skill

Co-authored-by: Ben Foster <benfoster@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@benfoster benfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benfoster benfoster merged commit dd9d0a6 into main May 13, 2026
1 check passed
@benfoster benfoster deleted the claude/issue-53-update-the-skills-to-reference branch May 13, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant