CtrlK
BlogDocsLog inGet started
Tessl Logo

igmarin/hanakai-yaku

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

1.20x
Quality

95%

Does it follow best practices?

Impact

96%

1.20x

Average score across 45 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

SKILL.mdskills/personas/tdd-loop/

name:
tdd-loop
license:
MIT
type:
persona
description:
Use when implementing a Hanami 2.x feature, Hanami action, Hanami slice, or any Hanami controller logic using test-driven development (TDD / red-green-refactor). Orchestrates test planning, generates request specs or action unit specs, drives the implementation of Hanami action classes and route configurations, and performs a final code review. Use when starting a new Hanami feature from scratch, adding integration tests for an existing Hanami action, or following a red-green-refactor cycle for any Hanami 2.x component.
metadata:
{"ecosystem_sources":["hanami/hanami"],"tags":["personas","tdd","testing","development"],"version":"1.0.0","dependencies":[{"source":"self","skills":["load-context","write-request-spec","review-code"]},{"source":"ruby-core-skills","skills":["tdd-process","test-planning-process"]}]}

tdd-loop

Use this workflow when implementing any Hanami 2.x feature using Test-Driven Development.

Core principle: Write a failing test → verify it fails for the right reason → implement → verify it passes → review.


Quick Reference

StepSkillHandoff Condition
1. Plan teststest-planning-process (from ruby-core-skills)Test plan written, right test type chosen
2. Write failing testwrite-request-spec or write-action-specTest exists and fails for the right reason
3. ImplementTest passes
4. Reviewreview-codeNo violations found

Core Process

  1. [Plan Tests] — Load skill: test-planning-process (from ruby-core-skills)

    • Decide: request spec, action unit spec, relation spec, or repository spec?
    • Document the test plan: what behavior, what inputs, what assertions
    • Handoff condition: Test plan is written and reviewed
  2. [Write Failing Test] — Load skill: write-request-spec or write-action-spec

    • Write the test that describes the desired behavior
    • Run the test: bundle exec rspec spec/requests/... (request spec) or bundle exec rspec spec/actions/... (action spec)
    • Confirm it FAILS and fails for the right reason (feature missing, not a typo)
    • HARD-GATE (TDD — tdd-process (from ruby-core-skills)): Do not proceed until the test fails for the right reason.
    • Handoff condition: Failing test committed or saved
  3. [Implement] — Write minimal code to make the test pass

    • Start with the simplest implementation that satisfies the test
    • Run bundle exec rspec after each change
    • Refactor only after the test passes
    • Handoff condition: Test passes
  4. [Review] — Load skill: review-code

    • Check for Action responsibility violations
    • Check for DI usage
    • Check for query encapsulation
    • Check for test coverage
    • Handoff condition: No critical violations

Minimal Example

Failing request spec (spec/requests/posts/create_spec.rb):

RSpec.describe "POST /posts", type: :request do
  it "creates a post and redirects" do
    post "/posts", params: { post: { title: "Hello" } }
    expect(last_response.status).to eq(302)
  end
end

Run: bundle exec rspec spec/requests/posts/create_spec.rb → expect a failure such as ActionNotFound or 404.

Minimal implementation — generate the action and register the route:

# app/actions/posts/create.rb
module MyApp
  module Actions
    module Posts
      class Create < MyApp::Action
        def handle(request, response)
          response.redirect_to "/posts"
        end
      end
    end
  end
end

Run: bundle exec rspec spec/requests/posts/create_spec.rb → expect green.


Common Mistakes & Red Flags

Mistake / Red FlagWhy it matters
Implementation written before any testTDD means test first. No exceptions.
Skipping the HARD-GATE — assuming the test fails without running itA passing test without running it first doesn't verify the assertion works — run it to confirm RED

skills

personas

tdd-loop

README.md

tile.json