0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill renzo4web/automaton --skill programming-rails- SKILL.md11.2 KB
Overview
This skill codifies Rails best practices for models, controllers, service objects, and background jobs to build maintainable, secure, and performant applications. It emphasizes convention over configuration, thin controllers, well-structured models, and resilient background processing. The guidance helps teams decide where to place logic and how to structure code for testability and scalability.
How this skill works
The skill inspects common Rails concerns and prescribes patterns: consistent model layout (constants, associations, validations, scopes, callbacks, methods), RESTful controllers with strong parameters, service and query objects for business logic, and idempotent ActiveJob workers. It also recommends database-level constraints, eager loading to avoid N+1 queries, and retry/error strategies for background jobs. Examples and patterns illustrate typical implementations.
When to use it
- When organizing or refactoring models to keep business rules clear and testable
- When building controllers for web or API endpoints and enforcing strong parameters
- When extracting complex business behavior to service or query objects
- When designing background jobs that must be idempotent and retry-safe
- When integrating external APIs or adding robust error handling and retries
Best practices
- Keep controllers thin: push complex logic into services or models
- Structure models predictably and always specify dependent behavior for associations
- Use scopes and query objects to encapsulate database logic and avoid N+1 with includes
- Wrap multi-step operations in transactions and return clear Result objects from services
- Make jobs idempotent, configure targeted retries, and avoid side effects in callbacks
- Add indexes and database constraints for critical validations and frequent queries
Example use cases
- Extracting order creation (payments, items, notifications) into a CreateOrder service wrapped in a transaction
- Implementing paginated index endpoints with includes to prevent N+1 and strong params for filtering
- Creating a ProductSearch query object to consolidate complex filtering and sorting
- Writing ProcessOrderJob that safely retries and skips already processed orders
- Wrapping external HTTP calls in a service with explicit error handling and test doubles
FAQ
Use model validations for data integrity and simple domain rules; extract cross-entity or multi-step business processes into service objects.
How do I prevent N+1 queries?
Use includes/preload/eager_load for associations in queries and consider query objects to centralize eager-loading logic.