rails-presenter

Generate SimpleDelegator-based presenter objects for Rails views.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill rails-presenter-nschneble
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rails-presenter
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/rails-presenter
Command: npx skills add https://github.com/nschneble/rails-superstack --skill rails-presenter-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Presents a clean separation of view formatting logic by generating presenter objects that wrap models for UI rendering, enabling consistent formatting and test-driven development.

Core Features & Use Cases

  • Isolates view logic into presenter classes that extend a base presenter.
  • Provides formatting helpers (e.g., display_name, status_badge, formatted_date) ready for use in views.
  • Encourages TDD workflows by driving development with specs first.

Quick Start

Write a failing spec for your resource presenter, implement the presenter, and run the tests until they pass.

Frequently Asked Questions about rails-presenter

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

FAQPage Schema
How do I extract view logic from Rails models using presenters?▼

To extract view logic from Rails models, you can use presenters to wrap models and isolate formatting code, keeping models clean and ensuring consistent UI rendering across your application.

What is a SimpleDelegator-based presenter in Rails?▼

A SimpleDelegator-based presenter in Rails is a design pattern where a presenter class wraps a model, delegating original methods while adding new view-specific formatting methods like display_name or formatted_date.

How do I test Rails presenter formatting with RSpec?▼

You test Rails presenter formatting with RSpec by following a TDD workflow: write a failing spec for the resource presenter first, implement the presenter methods, and run the tests until they pass.

Does the Rails presenter approach support I18n formatting?▼

Yes, the Rails presenter approach supports I18n-ready formatting, allowing you to internationalize view-facing data outputs directly within the presenter methods instead of scattering translations across your views.

When should I move formatting logic into a Rails presenter?▼

You should move formatting logic into a Rails presenter when your UI-centric Rails app requires clean view logic extraction, needing consistent formatting helpers that clutter models or views if left unisolated.

Can I generate presenter objects for existing Rails models?▼

Yes, you can generate presenter objects for existing Rails models to format model data for views, wrapping them in a base presenter to apply consistent UI rendering and test-driven development.