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
Define type-safe, composable validation rules with dry-validation contracts.
slices/<slice>/contracts/ or inline in the operation.Dry::Validation::Contract with schema and rule blocks.contract.call(params) returns a result with .success? and .errors.Write test → Run test → Verify it FAILS → Implement → Verify it PASSES
DO NOT use raw hashes as operation input. Validate through a contract first.
DO NOT put validation logic in actions. Contracts are the single source of validation.Pattern reference: See CONTRACT_PATTERNS.md for examples of custom predicates, nested schemas, composed contracts, and testing patterns.
module Users
class CreateContract < Dry::Validation::Contract
schema do
required(:email).filled(:string)
required(:name).filled(:string, min_size?: 2)
optional(:role).filled(:string, included_in?: %w[admin member])
end
rule(:email) do
key.failure("must be a valid email") unless value.match?(URI::MailTo::EMAIL_REGEXP)
end
end
enddef validate(input)
result = CreateContract.new.call(input)
result.success? ? Success(result.to_h) : Failure(result.errors.to_h)
endCONTRACT_PATTERNS.md companion file is present in the bundle, consult it for executable examples of custom predicates, composed contracts, i18n error messages, and nested schemas.RSpec.describe Users::CreateContract do
subject(:contract) { described_class.new }
context "with valid input" do
it "succeeds" do
result = contract.call(email: "user@example.com", name: "Alice")
expect(result).to be_success
expect(result.to_h).to include(email: "user@example.com", name: "Alice")
end
end
context "with invalid input" do
it "fails with email error" do
result = contract.call(email: "not-an-email", name: "Alice")
expect(result).to be_failure
expect(result.errors[:email]).to include("must be a valid email")
end
it "fails when name is too short" do
result = contract.call(email: "user@example.com", name: "A")
expect(result).to be_failure
expect(result.errors[:name]).to be_present
end
end
end| Skill | When to chain |
|---|---|
| create-operation | After defining the contract, use it as the first step of the operation |
| create-action | Contracts validate action params before they reach the operation |
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