Architectural guidance for coding agents adding private customer access, connections, background work, subscriptions or service credits to existing apps. Specs only; reuse the host and chosen providers.
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Use when an existing user or workspace receives credits and spends them on services. Free accounts without subscriptions are valid. This optional contract is independent of subscriptions. It maps credit ownership, trusted additions and spending without duplicate charges.
Credit owner is the existing user OR workspace. Available credits belong to that owner. A grant adds credits; consumption spends them. These effects can use existing payment/job records; no new wallet or ledger is required. See models.
| Needed meaning | Authority and simplest source | Required behavior |
|---|---|---|
| Credit owner | Existing user/workspace relationship | Preserve ownership across grants, consumption, results and retries. |
| Available amount | Host balance or existing credit history | Enforce sufficient availability at the mutation boundary; browser values are display only. |
| Grant amount/source | Trusted app decision or verified payment mapped to owner | Reuse the provider-scoped payment reference for purchases. Redirects and client amounts cannot mint credits. |
| Service cost | Server-controlled policy | Validate the charge in the app's exact credit unit; the client cannot select it. An accepted operation keeps its agreed cost across retries. |
| Operation identity/outcome | Existing payment/job/operation record | Recover the same identity across retries; bind owner, action and amount, reject conflicting reuse, and retain whether the change applied. |
Choose one availability authority. An owner balance plus existing operation outcomes is often sufficient. If the host already uses a ledger, derive availability from it or maintain its balance atomically. Add credit history only for a concrete traceability or balance-reconstruction need that existing records cannot supply. Use native transactions/conditional writes to keep availability nonnegative and couple each change with its applied outcome. Reading a history sum before a separate debit does not prevent concurrent overspending.
Recheck ownership at the mutation/worker boundary, including after remote work. Credits never authorize another owner's resources. Known failures follow the agreed charge policy; any credit restoration is also a trusted operation applied once.
A personal app has users, owner-scoped jobs, and verified payments. Signup is free; an accepted processing job costs 3 credits. Map availability to the user, grant identity to payment, and consumption identity/outcome to job. Add only missing availability/applied-outcome information.
With 5 credits, two concurrent jobs costing 3 cannot both be accepted. The accepted job leaves 2; request/worker replay cannot debit again. Repeated top-up notifications cannot grant twice. A remote timeout follows the recovery rule above. This is illustrative, not execution evidence.
Start with the lifecycle defaults for account access, insufficient credits and queued-work resumption. Resolve owner, trusted grant sources, cost, charge timing and known-failure policy. Make charging on acceptance explicit; do not silently substitute it for a successful-delivery promise.
Check free signup without subscriptions, cross-owner denial, client amount manipulation, duplicate grants/consumption, concurrent overspending and interrupted external work. Use the selected provider's official payment/idempotency mechanisms. This spec supplies no runtime or credit execution evidence.