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 creating ROM Repositories that encapsulate domain-level persistence logic in Hanami 2.x.
| Action | Approach |
|---|---|
| Create Repository | Inherit from Hanami::DB::Repo[:relation_name] |
| Inject Repository | include Deps["repos.user_repo"] |
| Execute transaction | repo.transaction { ... } |
Create the Repository file:
Place repositories under app/repos/:
# app/repos/user_repo.rb
module MyApp
module Repos
class UserRepo < Hanami::DB::Repo[:users]
end
end
endVerify container registration: After creating the repository, confirm it is correctly registered in the Hanami container before wiring it into actions. Run in the console:
MyApp::App["repos.user_repo"]
# => #<MyApp::Repos::UserRepo ...>If this raises a key error, check the file path and module namespace match the expected container key.
Inject into Actions:
Inject repositories using the container dependency injection (Deps):
# app/actions/users/index.rb
class Index < MyApp::Action
include Deps["repos.user_repo"]
def handle(request, response)
response.render(view, users: user_repo.all)
end
endAdd domain methods: Write specific read and write methods to isolate your actions from raw relation access:
def active
users.active.to_a
end
def find_by_email(email)
users.by_email(email).one
endUse transactions for multi-step writes: Wrap mutations in transaction blocks. If the block raises an error, the transaction is automatically rolled back and the error is re-raised.
transaction do
accounts.update(from_id, balance: from_account.balance - amount)
accounts.update(to_id, balance: to_account.balance + amount)
endMap to custom Entities:
Configure the struct_namespace to automatically map SQL relation rows to custom Entity domain models.
class UserRepo < Hanami::DB::Repo[:users]
struct_namespace MyApp::Entities
auto_struct true
endDo not expose Relations directly: Actions must fetch and modify data via Repositories. Bypassing repositories to query relations directly in actions/views is an anti-pattern.
For detailed repository pattern examples, see REPOSITORIES.md.
| Related Skill | When to chain |
|---|---|
| define-relation | define-relation — Relations map table schemas before repositories query them. |
| define-entity | define-entity — Represents the struct objects returned by the repository. |
| create-action | Actions inject repositories to read/write data. |
| write-rom-spec | Test repository methods inside in-memory ROM database specs. |
.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