rails-routes

Implement Rails API routes with api/v1 namespace and JSON constraints.

Updated Oct 12, 2024
One-click install
npx skills add https://github.com/samrocks03/shuttle-office-service --skill rails-routes-samrocks03
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-routes
Source: https://github.com/samrocks03/shuttle-office-service/tree/main/.claude/skills/rails-routes
Command: npx skills add https://github.com/samrocks03/shuttle-office-service --skill rails-routes-samrocks03

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill standardizes how Rails API routes are designed and maintained across projects, reducing inconsistencies and integration issues.

Core Features & Use Cases

  • Enforces the api/v1 namespace convention and JSON-only constraints for all resources.
  • Supports standard RESTful resources with optional collection routes for custom actions, multi-step endpoints, and nested resources.
  • Provides guidance for mounted engines and bulk/template routing patterns to streamline API design across teams.
  • Typical use cases include adding a new resource, updating route structure for versioning, or implementing complex workflows that span multiple controllers.

Quick Start

Define or modify api/v1 routes to enforce JSON-only constraints and RESTful patterns for new resources.

Frequently Asked Questions about rails-routes

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

FAQPage Schema
How do I standardize Rails API routes to follow project conventions?

To standardize Rails API routes, enforce the api/v1 namespace convention and apply JSON-only constraints to all resources. This maintains namespace structure and ensures RESTful patterns are consistently applied across your Rails application.

How do I add custom collection routes and multi-step endpoints in a Rails API?

Custom collection routes and multi-step endpoints in a Rails API are added by extending standard RESTful resources. You can declare custom collection routes for specific actions or structure multi-step endpoints for complex workflows spanning multiple controllers.

What is the best way to structure nested resources in a Rails API namespace?

The best way to structure nested resources in a Rails API namespace is to maintain the api/v1 namespace structure while declaring JSON format constraints. This approach supports standard actions and nested resource patterns seamlessly across your application.

Does this routing approach support mounted engines and bulk template patterns?

Yes, this routing approach supports mounted engines and bulk template patterns. It provides specific guidance for mounting engines and structuring bulk template routing to streamline API design and maintain consistency across teams.

When do I need to enforce a JSON format constraint on Rails API resources?

You need to enforce a JSON format constraint on Rails API resources whenever you are implementing api/v1 namespace routing. This ensures all RESTful resources, collection routes, and multi-step endpoints serve JSON exclusively.