37signals-api

Expose RESTful Rails APIs and HTML views via respond_to blocks.

1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/joshyorko/agent-skills --skill 37signals-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: 37signals-api
Source: https://github.com/joshyorko/agent-skills/tree/main/plugins/rails-37signals-patterns/skills/37signals-api
Command: npx skills add https://github.com/joshyorko/agent-skills --skill 37signals-api

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Rails apps often need to expose RESTful APIs without creating separate controller trees. This skill shows how to serve both HTML and JSON from the same controller using respond_to blocks and Jbuilder templates, aligning API design with traditional Rails workflows.

Core Features & Use Cases

  • Single controller handles HTML and JSON responses via respond_to blocks.
  • Jbuilder templates power structured JSON payloads with minimal boilerplate.
  • Use cases include public APIs, internal dashboards, and mobile clients that reuse existing Rails resources.

Quick Start

Create a Boards controller that responds to both HTML and JSON and add corresponding index/show JSON templates.

Frequently Asked Questions about 37signals-api

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

FAQPage Schema
How do I serve both HTML and JSON from a single Rails controller?

You can serve HTML and JSON from a single Rails controller by using respond_to blocks to format responses, delivering JSON via Jbuilder templates and rendering HTML views for browser access.

What is the best way to expose a RESTful Rails API without duplicating controllers?

The best way to expose a RESTful API without duplicating controllers is using respond_to blocks within existing controllers to handle both machine clients and browser requests alongside Jbuilder templates for structured JSON.

How do I structure JSON payloads in Rails using Jbuilder?

You structure JSON payloads in Rails using Jbuilder by creating template files that define JSON output with minimal boilerplate, allowing you to build structured responses for public APIs and mobile clients.

Does this single-controller approach support token-based authentication for API clients?

Yes, the single-controller approach supports optional token-based API authentication to protect machine clients accessing your RESTful Rails resources without impacting HTML view rendering.

When should I avoid using respond_to blocks for Rails API responses?

You should avoid using respond_to blocks for API responses if your application requires a strictly separated API architecture or if your JSON formatting needs exceed what Jbuilder templates can reasonably handle.