一键导入
add-resource
Add a complete new resource to Thingybase — migration, model, factory, Pundit policy, Oxidizer controller with inline Phlex views, routes, and specs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a complete new resource to Thingybase — migration, model, factory, Pundit policy, Oxidizer controller with inline Phlex views, routes, and specs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | add-resource |
| description | Add a complete new resource to Thingybase — migration, model, factory, Pundit policy, Oxidizer controller with inline Phlex views, routes, and specs |
| argument-hint | ["resource-name"] |
| allowed-tools | Read, Grep, Glob, Edit, Write, Bash, AskUserQuestion |
Add a resource called $ARGUMENTS, end to end. This is the full checklist; the controller/view pattern itself is documented in the resource-controllers skill.
Ask the user to confirm before writing anything:
belongs_to :account) or user-scoped?Migration + model
bin/rails generate migration Create<Names> ... — include account:references and user:references for account resources.ApplicationRecord. If it's a non-persisted form/state object (a "verb" like a confirmation or builder), inherit ApplicationModel instead and skip the migration entirely.include UuidField and add a uuid column (see app/models/item.rb).Factory — add to spec/factories.rb, following existing entries (Faker for values).
Policy — app/policies/<name>_policy.rb inheriting from BaseAccountMemberPolicy (default), BaseAccountOwnerPolicy, or another base. Every policy needs a spec in spec/policies/ using pundit-matchers. Authorization bugs are the worst bugs in this app — do not skip the spec.
Controller — follow the resource-controllers skill: Oxidizer::ResourcesController + AccountLayout + Superview::Actions, with Show/Edit/Form nested inside the controller file. app/controllers/items_controller.rb is the reference.
Routes — Oxidizer DSL style (nest, create, list), nested under accounts when account-scoped. New verbs are nested resources, never custom member actions.
Specs — model spec (shoulda-matchers for associations/validations) + policy spec. One assertion per spec.
Plan gating (if requested) — gate through Featureomatic / current_plan, following an existing gated feature. Don't write ad-hoc plan conditionals.
bin/rails db:migrate && bin/rails db:migrate:status — migration is cleanbin/rails routes | grep <name> — routes existbin/rails runner "puts <Name>.new.inspect" — model loadsbin/rspec spec/models/<name>_spec.rb spec/policies/<name>_policy_spec.rb — green