Agent skill

Controller

by RailsEventStore in RailsEventStore/ecommerce

Create a controller with commands, read model queries, routes, and integration tests

MITAuto-check passedTesting & QA

Install Controller

skills CLI
$ npx skills add RailsEventStore/ecommerce --skill controller -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install RailsEventStore/ecommerce controller --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/RailsEventStore/ecommerce.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/controller .claude/skills/controller && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
controller
GitHub stars
507
Token cost
~1.9k tokens
SKILL.md length
419 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Create a controller with commands, read model queries, routes, and integration tests

  • Works in 10 steps: Gather requirements → Write integration tests first (TDD) → Add routes → …
  • Tasks that involve Integration testing
  • SKILL.md covers When to use, Working Directory, Step-by-step process and Key conventions
  • Calls rails and make

What it does

Controller is an agent skill from RailsEventStore/ecommerce. Create a controller with commands, read model queries, routes, and integration tests

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Integration testing. It works with Ruby on Rails. The repository describes itself as: Application with CQRS and Event Sourcing built on Rails and Rails Event Store. The licence is MIT.

When your agent uses it

  • Tasks that involve Integration testing

Example prompts

  • “/controller”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Gather requirements
  2. Write integration tests first (TDD)
  3. Add routes
  4. Create the controller
  5. Controller conventions
  6. Form objects (when validation is needed)
  7. Service objects (when logic is complex)
  8. Namespaced controllers
  9. Create views
  10. Run verification

What it can do on your machine

Read from SKILL.md and the folder at commit 42c6c23. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • rails
    • make

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Controller loads about 1.9k tokens when it runs. Until then it costs about 24 tokens; SKILL.md has 419 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~24
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from RailsEventStore/ecommerce at commit 42c6c23, republished under its MIT licence (© RailsEventStore). 419 words, ~1,905 tokens.

Download SKILL.mdSave it as .claude/skills/controller/SKILL.md (or your agent's skills folder).
name
controller
description
Create a controller with commands, read model queries, routes, and integration tests

Controller Builder

When to use

Use this skill when asked to create a new controller or add actions to an existing controller in any Rails app under apps/.

Working Directory

Determine which app the controller belongs to. Default is apps/rails_application/ unless specified.

Step-by-step process

1. Gather requirements

Before writing any code, clarify:

  • Which read model the controller queries (must already exist)
  • Which domain commands the controller dispatches (must already exist)
  • What actions are needed (index, show, new, create, edit, update, destroy, custom)
  • Whether it lives in a namespace (e.g. admin/, client/)
2. Write integration tests first (TDD)

Create a test file at test/integration/{controller_name}_test.rb.

ruby
require "test_helper"

class ResourceNameTest < InMemoryRESIntegrationTestCase
  def test_list_resources
    get "/resources"
    assert_response :success
  end

  def test_create_resource
    post "/resources", params: { name: "Test" }
    follow_redirect!
    assert_select("td", "Test")
  end

  def test_update_resource
    resource_id = create_resource("Original")

    patch "/resources/#{resource_id}", params: { name: "Updated" }
    follow_redirect!
    assert_select("td", "Updated")
  end

  private

  def create_resource(name)
    post "/resources", params: { name: name }
    follow_redirect!
    # extract ID from page or use read model facade
    ReadModel.all.last.uid
  end
end

Integration test conventions:

  • Inherit from InMemoryRESIntegrationTestCase
  • Use HTTP verbs: get, post, patch, delete
  • Use follow_redirect! after redirecting actions
  • Assert with assert_response, assert_select
  • Extract setup into private helper methods
  • Never dispatch commands directly — always go through HTTP
  • Never access AR models directly — use read model facade methods if needed
3. Add routes

Add to config/routes.rb:

ruby
resources :resources, only: [:index, :show, :new, :create, :edit, :update, :destroy] do
  member do
    post :custom_action
  end
  collection do
    delete :clear_all
  end
end

Route conventions:

  • Use RESTful resources with only: to limit actions
  • Custom actions go in member do (operates on one record) or collection do (operates on many)
  • Namespace for grouped controllers:
    ruby
    namespace :admin do
      resources :stores, only: [:index, :new, :create]
    end
4. Create the controller
ruby
class ResourcesController < ApplicationController
  def index
    @resources = ReadModel.all
  end

  def show
    @resource = ReadModel.find_by_uid(params[:id])
  end

  def new
    @resource_id = SecureRandom.uuid
  end

  def create
    ActiveRecord::Base.transaction do
      command_bus.call(Domain::CreateResource.new(
        resource_id: params[:resource_id],
        name: params[:name]
      ))
    end
    redirect_to resources_path, notice: "Resource was successfully created"
  end

  def edit
    @resource = ReadModel.find_by_uid(params[:id])
  end

  def update
    command_bus.call(Domain::UpdateResource.new(
      resource_id: params[:id],
      name: params[:name]
    ))
    redirect_to resource_path(params[:id]), notice: "Resource was successfully updated"
  end

  def destroy
    command_bus.call(Domain::RemoveResource.new(resource_id: params[:id]))
    redirect_to resources_path, notice: "Resource was successfully removed"
  end
end
5. Controller conventions

Command dispatch:

  • Use command_bus.call(Command.new(...)) to dispatch commands
  • Wrap multiple commands in ActiveRecord::Base.transaction do ... end
  • Generate UUIDs before dispatch: id = SecureRandom.uuid

Read model queries:

  • Always use facade methods: ReadModel.all, ReadModel.find_by_uid(id)
  • Never access ActiveRecord models directly

Redirects:

  • After successful writes: redirect_to path, notice: "..."
  • After errors: redirect_to path, alert: "..."

Error handling:

  • Use rescue/else for domain exceptions:
    ruby
    def submit
      SomeService.new(params[:id]).call
    rescue Domain::SomeError => e
      redirect_to edit_path(params[:id]), alert: e.message
    else
      redirect_to show_path(params[:id]), notice: "Success"
    end

Before actions:

  • Use for authorization, ownership checks, loading shared data:
    ruby
    before_action :load_resource, only: [:show, :edit, :update]
    
    private
    
    def load_resource
      @resource = ReadModel.find_by_uid(params[:id])
    end
Show full SKILL.md (162 more words)Show less
6. Form objects (when validation is needed)

For non-trivial forms, create a form object in the controller file or a separate file:

ruby
class ResourceForm
  include ActiveModel::Model
  include ActiveModel::Attributes
  include ActiveModel::Validations

  attribute :name, :string
  attribute :price, :decimal
  attribute :resource_id, :string

  validates :name, presence: true
  validates :price, presence: true, numericality: { greater_than: 0 }
end

Use in the controller:

ruby
def create
  form = ResourceForm.new(**resource_params)
  unless form.valid?
    return render "new", locals: { errors: form.errors }, status: :unprocessable_entity
  end

  ActiveRecord::Base.transaction do
    command_bus.call(Domain::CreateResource.new(resource_id: form.resource_id, name: form.name))
  end
  redirect_to resources_path, notice: "Created"
end
7. Service objects (when logic is complex)

When a controller action involves complex coordination (multiple commands, event subscriptions, error handling), extract to a service:

ruby
# app/services/{namespace}/submit_service.rb
module Namespace
  class SubmitService
    def initialize(id)
      @id = id
    end

    def call
      ActiveRecord::Base.transaction do
        command_bus.call(Domain::Submit.new(id: @id))
      end
    end

    private

    def command_bus
      Rails.configuration.command_bus
    end
  end
end
8. Namespaced controllers

For controllers under a namespace (e.g. admin/, client/):

ruby
# app/controllers/admin/resources_controller.rb
module Admin
  class ResourcesController < ApplicationController
    def index
      @resources = ReadModel.all
    end
  end
end

With a base controller for shared behavior:

ruby
# app/controllers/client/base_controller.rb
module Client
  class BaseController < ApplicationController
    layout "client_panel"
    before_action :ensure_logged_in

    private

    def ensure_logged_in
      # auth check
    end
  end
end

# app/controllers/client/orders_controller.rb
module Client
  class OrdersController < BaseController
    def index
      @orders = ClientOrders.orders_for_client(current_client_id)
    end
  end
end
9. Create views

Create ERB views in app/views/{controller_name}/:

  • index.html.erb — list view
  • show.html.erb — detail view
  • new.html.erb — form for creating
  • edit.html.erb — form for editing

Views query data via instance variables set in controller (@resources, @resource).

10. Run verification
  1. rails test test/integration/{test_file}.rb — integration tests pass
  2. make test — all tests green

Key conventions

  • Controllers are thin — dispatch commands and query read models
  • Complex logic goes into service objects
  • Multiple commands wrapped in transactions
  • UUIDs generated in controller before command dispatch
  • Read model facade methods for all queries
  • Integration tests exercise the full HTTP stack
  • Test-first TDD

© RailsEventStore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/controller of RailsEventStore/ecommerce.

Open the folder on GitHubat commit 42c6c23

Compare with similar skills

Controller next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Controller compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Controller this skillRailsEventStore/ecommerce507—~1.9kAutomated safety check: PassMIT
Testing Patternsdilolabs/nosia2131 repos~1.4kAutomated safety check: PassMIT
OpenHarness End-to-End EvalsHKUDS/OpenHarness16k1 repos~2.1kAutomated safety check: NotesMIT
E2E Testinglangflow-ai/langflow156k—~3.3kAutomated safety check: PassMIT
Test Writing WorkflowiOfficeAI/AionUi33k1 repos~1.2kAutomated safety check: PassApache-2.0
Remote Executor Integration Testsopeninterpreter/openinterpreter69k2 repos~842Automated safety check: PassApache-2.0

Similar skills

  • Testing Patterns

    dilolabs/nosia

    Writes Minitest tests with fixtures following 37signals conventions.

    213 GitHub starsUsed in 1 repo~1.4k tokens
    Testing & QAAuto-check passed
  • Validates OpenHarness features by running real multi-turn agent loops with live LLM calls against an unfamiliar codebase, checking actual tool execution.

    16k GitHub starsUsed in 1 repo~2.1k tokens
    Testing & QAAuto-check: notes
  • E2E Testing

    langflow-ai/langflow

    Write and review Playwright E2E tests for Langflow. An agent skill from langflow-ai/langflow.

    156k GitHub stars~3.3k tokensUpdated today
    Testing & QAAuto-check passed
  • Test Writing Workflow

    iOfficeAI/AionUi

    Sets the test-writing workflow for the repository: risk-first scenario lists, behavior-focused Vitest tests, a full run before each commit and a coverage target.

    33k GitHub starsUsed in 1 repo~1.2k tokens
    Testing & QAAuto-check passed
  • Remote Executor Integration Tests

    openinterpreter/openinterpreter

    Explains how to run agent integration tests against remote executors, using Docker for Linux or Wine for Windows, and how to opt tests in or skip them.

    69k GitHub starsUsed in 2 repos~842 tokens
    Testing & QAAuto-check passed
  • Official

    Starts a throwaway MongoDB 7.0 replica set and runs the Airbyte spec, check, discover and read commands against source-mongodb-v2 images for local end-to-end testing.

    22k GitHub stars~1.9k tokensUpdated today
    Testing & QAAuto-check passed

More from RailsEventStore/ecommerce

All 8 skills in this repo
  • Commit

    RailsEventStore/ecommerce

    Create atomic git commits following project conventions. An agent skill from RailsEventStore/ecommerce.

    507 GitHub stars~767 tokensUpdated 16 days ago
    Auto-check passed
  • Domain

    RailsEventStore/ecommerce

    Create a new domain bounded context with aggregates, commands, events, and handlers

    507 GitHub stars~2.6k tokensUpdated 16 days ago
    Auto-check passed
  • New App

    RailsEventStore/ecommerce

    Scaffold a new Rails app with event sourcing, following project conventions (todomvc as reference)

    507 GitHub stars~3.1k tokensUpdated 16 days ago
    Auto-check passed
  • New Feature

    RailsEventStore/ecommerce

    Plan a new feature end-to-end — impact analysis across all layers, start-from-the-middle slicing into deployable steps, then delegating to /domain, /read-model, /controller skills

    507 GitHub stars~1.6k tokensUpdated 16 days ago
    Auto-check passed
  • Read Model

    RailsEventStore/ecommerce

    Build a new read model following project conventions (event handlers, tests, migration, configuration)

    507 GitHub stars~3k tokensUpdated 16 days ago
    Auto-check passed
  • Upgrade Rails

    RailsEventStore/ecommerce

    Upgrade Rails framework to a newer version following the smooth upgrade methodology

    507 GitHub stars~976 tokensUpdated 16 days ago
    Auto-check passed

Works with

Categories

Questions about Controller

What does Controller do?

Create a controller with commands, read model queries, routes, and integration tests. Controller is an agent skill from RailsEventStore/ecommerce.

When should I use Controller?

Controller fits situations like: tasks that involve Integration testing.

How do I install Controller in Claude Code?

Run `npx skills add RailsEventStore/ecommerce --skill controller -a claude-code`. Or copy the skill folder (.claude/skills/controller in RailsEventStore/ecommerce) into .claude/skills/controller in your project. Claude Code loads it when a task matches its description.

How do I install Controller in Codex?

Run `npx skills add RailsEventStore/ecommerce --skill controller -a codex`. Or copy the skill folder (.claude/skills/controller in RailsEventStore/ecommerce) into .agents/skills/controller in your project. Codex loads it when a task matches its description.

Can I use Controller in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add RailsEventStore/ecommerce --skill controller -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/controller, .gemini/skills/controller, .github/skills/controller and .opencode/skills/controller in your project.

What does Controller need to run?

Going by SKILL.md and its folder, Controller needs the command-line tools its instructions call (rails and make).

Does Controller access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Controller safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Controller use?

Controller is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Controller use?

About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Controller?

Skills that share tags, products or a category with Controller: Testing Patterns (dilolabs/nosia, 213 stars), OpenHarness End-to-End Evals (HKUDS/OpenHarness, 16k stars), E2E Testing (langflow-ai/langflow, 156k stars) and Test Writing Workflow (iOfficeAI/AionUi, 33k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Controller?

RailsEventStore (a GitHub organization) maintains it in RailsEventStore/ecommerce, which has 507 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on September 21, 2026.

Source: RailsEventStore/ecommerce on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.