Curated library of atomic AI agent skills for Hanami, dry-rb, and ROM Ruby development. Covers actions, slices, repositories, relations, changesets, providers, DI, operations, TDD, CLI, views, routing, and validation. Shared Ruby process skills have moved to ruby-core-skills. Uses Markdown + Front-matter architecture.
92
94%
Does it follow best practices?
Impact
92%
1.33xAverage score across 35 eval scenarios
Passed
No known issues
Use this skill when creating and configuring Hanami 2.x Slices.
| Scenario | Approach |
|---|---|
| Create a Slice | hanami generate slice <name> |
| Register a Slice | Add to config/app.rb with slice :name, at: "/path" |
| Define Slice routes | Create slices/<name>/config/routes.rb |
| Access Slice Actions | Routes point to slice_name.action_name |
| Import from another Slice | Use import in the Slice class or app config |
| Export from a Slice | Use export in the Slice class |
| Slice-level container | MyApp::Slices::Api::Container |
| Access Slice components | include Deps["slices.api.repositories.users"] |
Generate a Slice using the Hanami CLI:
hanami generate slice apiCreates slices/api/ with subdirectories including config/routes.rb, actions/, views/, and templates/.
Verify: Run hanami routes and confirm the new slice's routes appear in the output.
Register the Slice in the app:
# config/app.rb
# frozen_string_literal: true
module MyApp
class App < Hanami::App
slice :api, at: "/api" do
# Slice-specific configuration
end
end
endDefine Slice routes in slices/<name>/config/routes.rb:
# slices/api/config/routes.rb
# frozen_string_literal: true
module MyApp
module Slices
module Api
class Routes < Hanami::Routes
get "/users", to: "users.index"
get "/users/:id", to: "users.show"
end
end
end
endVerify: Run hanami routes and confirm /api/users and /api/users/:id are listed.
Access Slice Actions from routes:
# Full path: /api/users → slices/api/actions/users/index.rbImport dependencies from another Slice:
# config/app.rb
module MyApp
class App < Hanami::App
slice :api, at: "/api" do
import from: :main do
# Import specific components from the main slice
end
end
end
endVerify: Boot the app (hanami console) and resolve the imported component: MyApp::Slices::Api::Container["main.repositories.users"].
Export Slice components for use by other slices:
# slices/api/config/slice.rb
module MyApp
module Slices
module Api
class Slice < Hanami::Slice
export ["repositories.users"]
end
end
end
endVerify: In hanami console, confirm the consuming slice can resolve the exported key.
Keep Slices self-contained. A Slice should be able to function independently. Minimize cross-slice dependencies.
Use Slices for bounded contexts — common examples include slice :api for public endpoints, slice :admin for dashboards, slice :billing for payments, and slice :main for the default web application.
import/export for cross-slice communication. Never access Hanami.app["slices.other.component"] directly.MyApp::Slices::Api::. File paths and module namespaces must align.| Related Skill | When to chain |
|---|---|
| define-routes | Slices define their own routes. Master routes before creating slices. |
| inject-dependencies | Cross-slice dependencies use import/export and are injected via Deps. |
| configure-slice | Configure slice-level settings and providers after creating the slice. |
| create-new-slice (workflow) | Full workflow for creating and configuring a new slice. |
docs
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
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
providers
configure-providers
implement-di
review-security
routing
define-routes
slices
configure-slice
create-slice
extract-slice
review-slice-boundaries
test-slice