CtrlK
BlogDocsLog inGet started
Tessl Logo

igmarin/hanakai-yaku

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

1.33x
Quality

94%

Does it follow best practices?

Impact

92%

1.33x

Average score across 35 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

TYPES.mdskills/db/define-entity/

Entity Attributes & dry-types Reference

This document covers type definitions, constraints, and default value mapping for Hanami DB Entities.


Basic dry-types Core

The standard type namespace Types is defined by the framework. Common types include:

  • Types::Integer
  • Types::String
  • Types::Time
  • Types::Bool
  • Types::Float
  • Types::Decimal

Coercions & Constraints

You can apply type-level constraints and validation rules to attributes:

# Enforce string format (e.g. Email regex)
attribute :email, Types::String.constrained(format: /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.\w+\z/)

# Numeric range boundary constraints
attribute :age, Types::Integer.constrained(gt: 0)

# Set defaults and restrict to specific enums
attribute :role, Types::String.default("member").enum("admin", "member", "guest")

Handling Optional / Nullable Values

By default, an attribute requires a value matching its type. If the database allows NULL, declare it as optional:

# Correct optional string declaration
attribute :middle_name, Types::String.optional

# Handling optional timestamps
attribute :last_login_at, Types::Time.optional

skills

README.md

tile.json