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 configuring Hanami 2.x Slices.
Core principle: Each Slice configures its own container, settings, and providers independently of the main app.
| Scenario | Approach |
|---|---|
| Configure a Slice | Edit slices/<name>/config/slice.rb |
| Define slice-level settings | Use config.settings in the Slice class |
| Register slice providers | Use register_provider in the Slice class |
| Configure auto-registration | Set config.auto_register_paths |
| Exclude paths from auto-registration | Set config.no_auto_register_paths |
| Access slice settings | target[:settings] in providers or slice.settings |
| Override main app config | Define config in the Slice that takes precedence |
| Container imports | import from: :other_slice |
| Container exports | export ["component.key"] |
Create the Slice configuration file:
# slices/api/config/slice.rb
# frozen_string_literal: true
module MyApp
module Slices
module Api
class Slice < Hanami::Slice
# Slice-level configuration
end
end
end
endDefine slice-level settings:
class Slice < Hanami::Slice
config.settings do
setting :api_key, constructor: Types::String
setting :rate_limit, default: 100, constructor: Types::Integer
end
endRegister slice-specific providers:
class Slice < Hanami::Slice
register_provider(:api_client) do
start do
client = ApiClient.new(
api_key: target[:settings].api_key,
base_url: "https://api.example.com"
)
register("api.client", client)
end
end
endConfigure auto-registration paths:
class Slice < Hanami::Slice
config.auto_register_paths = ["app/actions", "app/views", "app/repos"]
config.no_auto_register_paths = ["app/relations", "app/structs", "app/entities"]
endImport components from another Slice:
class Slice < Hanami::Slice
import from: :main do
# Import all exported components from the main slice
end
endExport components for other slices:
class Slice < Hanami::Slice
export ["repositories.users", "services.auth"]
endOverride main app configuration for slice-specific needs:
class Slice < Hanami::Slice
# Use a different database for this slice
config.database_url = target[:settings].database_url
endKeep configuration minimal. Only override defaults when necessary. Prefer convention over configuration.
Verify configuration after changes. Run bundle exec hanami console and confirm components resolve correctly:
# Verify settings are loaded
MyApp::Slices::Api::Slice[:settings].api_key # => expected value
# Verify a registered provider component is available
MyApp::Slices::Api::Slice["api.client"] # => #<ApiClient ...>
# Verify an imported component resolves
MyApp::Slices::Api::Slice["repositories.users"] # => #<Repositories::Users ...>| Mistake | Reality |
|---|---|
| "I'll duplicate main app configuration in every slice" | Slices inherit main app configuration. Only override when the slice genuinely needs different behavior. |
| "I'll forget to export components other slices depend on" | If Slice B imports from Slice A, Slice A must export those components. Verify with Slice["component.key"] in the console. |
"I'll use ENV directly instead of slice settings" | Use config.settings for typed, validated configuration. Access via target[:settings]. |
| "I'll configure auto-registration to include ROM-managed directories" | Never auto-register relations/, structs/, or entities/. ROM manages these. |
| Related Skill | When to chain |
|---|---|
| create-slice | Configuration follows slice creation. Understand slices before configuring. |
| register-provider | Slice-specific providers are registered in slice configuration. |
| manage-settings | Slice-level settings are defined in the Slice class. |
| inject-dependencies | Configured components are injected via Deps[]. |
| create-new-slice (workflow) | Full workflow includes configuration step. |
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