The crud-with-billing Skill
Walkthrough of scaffolding a new account-scoped, optionally paid resource.
crud-with-billing scaffolds a new account-scoped resource, in the exact shape as the kit's
example Project resource. It's the skill you reach for, or that Claude Code reaches for on its
own, any time you say something like "add invoices" or "let users create projects" in this repo.
The concept-level version of this page lives at
Adding a Resource; this page is the skill's own
step-by-step.
What it needs from you
Two things: the resource name (for example Invoice) and its attributes (amount:integer
note:text), and whether the feature is paid or free.
What it generates
Pattern-matched against app/models/project.rb, app/policies/project_policy.rb,
app/controllers/projects_controller.rb, app/views/projects/*, and their specs:
- A model and migration, via
bin/rails g model <Name> account:references <attrs>, withnull: falseadded where sensible andbelongs_to :accountplus validations on the model. has_many :<name>s, dependent: :destroyonAccount.- A Pundit policy subclassing
ApplicationPolicy, copied fromProjectPolicy, whose inheritedScopealready filters toaccount_id. - A controller that queries only through
Current.account.<name>s, callingauthorizeandpolicy_scope, and includingRequireEntitlementif (and only if) the feature is paid. - Views for
index,show,new,edit, and_form, using the Terminal design system classes already defined inapplication.css. - A
resources :<name>sroute. - If the resource introduces a new plan or tier: an extension to
Billing::PLANSand a new price id inBilling::Stripe::PRICE_ENV, with the Stripe side managed through the Stripe MCP server orbin/rails console. - Model, policy, and request specs, always including the tenant-isolation test (a foreign account's id must 404), and, for paid resources, an entitlement-gate test.
Verify
bin/check green. The tenant-isolation test carries the most weight here: it's the one test that
catches a resource that quietly forgot to scope a query to the current account.
Next
If the new resource needs to talk to an external service, see The add-integration Skill.