Curated library of atomic skills and personas for Hanami, dry-rb, and ROM Ruby development. Covers actions, slices, repositories, relations, changesets, providers, DI, operations, TDD, CLI, views, routing, validation, and 10 orchestration personas. Shared Ruby process skills have moved to ruby-core-skills. Uses Markdown + Front-matter architecture.
95
95%
Does it follow best practices?
Impact
96%
1.20xAverage score across 45 eval scenarios
Passed
No known issues
Use this skill when writing isolated unit specs for Hanami 2.x Actions.
Core principle: Unit specs test the Action in isolation by stubbing all dependencies. They are fast and pinpoint failures.
Follow these steps in order, treating each as a checkpoint:
Place it under spec/actions/ mirroring the action namespace:
# spec/actions/users/index_spec.rb
RSpec.describe MyApp::Actions::Users::Index, type: :action do
let(:stub_repo) { instance_double(MyApp::Repos::UserRepo, all: [user]) }
let(:stub_view) { double("view", call: "rendered") }
let(:user) { double("user") }
it "returns all users" do
action = described_class.new(user_repo: stub_repo, view: stub_view)
response = action.call({})
expect(response.status).to eq(200)
expect(response[:users]).to eq([user])
end
it "handles repository errors" do
allow(stub_repo).to receive(:all).and_raise(StandardError)
action = described_class.new(user_repo: stub_repo)
response = action.call({})
expect(response.status).to eq(500)
end
endTest that invalid params produce the expected status and that valid params expose the right values:
# spec/actions/users/create_spec.rb
RSpec.describe MyApp::Actions::Users::Create, type: :action do
let(:stub_repo) { instance_double(MyApp::Repos::UserRepo, create: user) }
let(:user) { double("user") }
it "returns 422 when required params are missing" do
action = described_class.new(user_repo: stub_repo)
response = action.call({})
expect(response.status).to eq(422)
end
it "returns 201 and sets Location header on success" do
action = described_class.new(user_repo: stub_repo)
response = action.call({ name: "Alice", email: "alice@example.com" })
expect(response.status).to eq(201)
expect(response.headers["Location"]).to eq("/users")
end
endRun RSpec and confirm the spec fails because the implementation is missing (not due to setup issues):
bundle exec rspec spec/actions/users/index_spec.rbWrite only the minimal code in the action to make the specs pass.
Verify all specs pass green.
render or halt.Deps[...] items via described_class.new(dep: stub).#call signature.| Related Skill | When to chain |
|---|---|
| create-action | Unit specs test Actions. Understand Action structure first. |
| inject-dependencies | Actions use Deps[] for injection. Understand how to stub injected dependencies. |
| write-request-spec | Use request specs for integration testing. Use unit specs for isolated logic. |
| plan-tests | Decide when unit specs are appropriate vs request specs. |
| tdd-loop | Follow the TDD workflow: write failing unit spec → implement → verify pass. |
.tessl-plugin
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
scenario-45
skills
actions
build-json-api
create-action
handle-errors
validate-params
context
load-context
db
create-changeset
create-repository
define-relation
write-migration
dry-monads
handle-result-pattern
dry-rb
create-operation
create-validation-contract
personas
providers
configure-providers
implement-di
review-security
routing
define-routes
slices
configure-slice
create-slice
extract-slice
review-slice-boundaries
test-slice