rails-presenter

Wrap Rails models with BasePresenter to centralize view formatting and helpers.

3|Updated Oct 16, 2025
One-click install
npx skills add https://github.com/dchuk/source_monitor --skill rails-presenter
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rails-presenter
Source: https://github.com/dchuk/source_monitor/tree/main/.claude/skills/rails-presenter
Command: npx skills add https://github.com/dchuk/source_monitor --skill rails-presenter

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails apps often mix view formatting with business logic, causing maintenance challenges and brittle UIs. Presenters provide a lightweight wrapper around models to encapsulate view-specific formatting, centralize UI concerns, and keep controllers and models lean.

Core Features & Use Cases

  • Wrap models with a BasePresenter to expose view-friendly methods and delegate missing methods.
  • Include ActionView helpers and I18n for consistent formatting, date rendering, and safe HTML output.
  • Facilitate a test-first workflow with dedicated tests that guide implementation and guarantee UI consistency.

Quick Start

Create failing tests in test/presenters/, implement a presenter inheriting from BasePresenter, and run tests until GREEN.

Frequently Asked Questions about rails-presenter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate view formatting from business logic in Rails?▼

Rails presenters separate view formatting from business logic by wrapping models in a lightweight class, centralizing UI concerns like badges and formatted dates while keeping controllers and models lean.

What is the best way to test view helpers and decorators in Rails?▼

Testing Rails view helpers and decorators is best handled through a test-driven presenter workflow, where you create failing tests in test/presenters/ and implement a BasePresenter until tests pass to guarantee UI consistency.

How do I use ActionView helpers and I18n inside a Rails decorator?▼

You can use ActionView helpers and I18n inside a Rails decorator by including them in a BasePresenter, which exposes view-friendly methods and delegates missing methods to ensure consistent, internationalized text output.

When do I need a presenter instead of a view helper in Rails?▼

You need a Rails presenter when view helpers become brittle or mixed with business logic, allowing you to encapsulate view-specific formatting across multiple models and views using a SimpleDelegator wrapper.

Does the Rails presenter pattern work with internationalized text and formatted dates?▼

The Rails presenter pattern works seamlessly with internationalized text and formatted dates by including ActionView helpers and I18n within the BasePresenter wrapper for safe HTML output.