layered-rails

Analyze Rails applications for layered architecture violations and refactoring fixes.

11|Updated Jun 19, 2013
One-click install
npx skills add https://github.com/MadBomber/experiments --skill layered-rails
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: layered-rails
Source: https://github.com/MadBomber/experiments/tree/main/ai_misc/skills/palkan-layered-rails
Command: npx skills add https://github.com/MadBomber/experiments --skill layered-rails

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and commands (resource) and agents (resource) components.

What problem does it solve?

This Skill helps you design and review Rails applications using layered architecture principles, ensuring clean separation of concerns and maintainable codebases.

Core Features & Use Cases

  • Codebase Analysis: Identify layer violations, god objects, and callback concerns.
  • Architecture Review: Assess code changes against layered design principles.
  • Pattern Implementation: Guide adoption of patterns like Service Objects, Policies, and ViewComponents.
  • Use Case: When reviewing a Pull Request, use this Skill to ensure controllers remain thin, models contain domain logic, and services orchestrate operations without mixing layers.

Quick Start

Use the layered-rails skill to analyze the codebase for architecture violations.

Frequently Asked Questions about layered-rails

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

FAQPage Schema
How do I find and fix layered architecture violations in a Rails application?

To find Rails architecture violations, analyze the codebase for issues like Current.user in models, request objects in services, or business logic in controllers. This process identifies layer breaches and provides specific refactoring recommendations with code examples.

What is an anemic model in Rails and how does it affect maintainability?

An anemic model in Rails is a domain model lacking business logic, which harms maintainability by shifting behavior into controllers or services. Analyzing your codebase detects these models and recommends moving domain logic back into the model layer.

How do I keep Rails controllers thin when reviewing a pull request?

Keep Rails controllers thin by ensuring they only handle request routing and responses. During a code review, check that business logic is moved to service objects or domain models, preventing god objects and keeping the controller layer clean.

When should I use service objects and policies in Rails refactoring?

Use service objects and policies during Rails refactoring to separate business operations from web request handling. Adopt these design patterns when services orchestrate complex operations without mixing layers, ensuring clean separation of concerns.

Can I detect god objects and callback concerns in my existing Rails codebase?

Yes, you can detect god objects and low-scoring callbacks in a Rails codebase by analyzing it against layered architecture principles. This review identifies code-slicing concerns and provides actionable fixes to refactor bloated classes.

Why does putting notifications in the Rails domain layer cause architecture issues?

Putting notifications in the Rails domain layer causes architecture issues by coupling external communication to business rules. Analyzing the code identifies these violations and recommends moving notifications out of models to maintain clean separation.