Loading...
Loading...
Applies DRY, YAGNI, PORO, Convention over Configuration, and KISS to Rails code; defers style to the project's linter(s). Covers structured logging, comment discipline, and path-specific rules (models, workers, services, controllers, repositories, serializers, RSpec, raw SQL). Use when designing or reviewing Rails structure, avoiding over-engineering, or aligning code with team boundaries by directory.
npx skill4agent add igmarin/rails-agent-skills rails-principles-and-boundaries.rubocop.ymlrubocopGemfilestandardrbstandardeslint.config.*.eslintrc*biome.jsonpackage.jsonbin/lintrubocopstandardrbbundle exec rubocopbundle exec standardrbnpm run lint| Topic | Rule |
|---|---|
| Style/format | Project linter(s) — detect and run as above; do not invent style rules here |
| Principles | DRY, YAGNI, PORO where it helps, CoC, KISS |
| Comments | Explain why, not what; use tagged notes with context |
| Logging | First arg string, second arg hash; no string interpolation; |
| Deep stacks | Chain rails-stack-conventions → domain skills (services, jobs, RSpec) |
| Principle | Apply as |
|---|---|
| DRY | Extract when duplication carries real maintenance cost; avoid premature abstraction |
| YAGNI | Build for current requirements; defer generalization until a second real use case |
| PORO | Use plain Ruby objects when they clarify responsibility; do not wrap everything in a "pattern" |
| Convention over Configuration | Prefer Rails defaults and file placement; document only intentional deviations |
| KISS | Simplest design that meets acceptance criteria and tests gate |
TODO:FIXME:HACK:NOTE:OPTIMIZE:user_id:order_id:event:| Area | Path pattern | Guidance |
|---|---|---|
| ActiveRecord performance | | Eager load in loops; push work into SQL where appropriate; prefer |
| Background jobs | | Clear worker/job structure, queue selection, idempotency, structured error logging (see rails-background-jobs for Active Job / Solid Queue / Sidekiq depth) |
| Error handling | | Domain exceptions with prefixed codes where the team uses them; |
| Logging / tracing | | Structured logging; add APM trace spans and tags (e.g. Datadog) for key operations when the stack includes them |
| Controllers | | Strong params; thin actions delegating to services; watch IDOR and PII exposure (see rails-security-review) |
| Repositories | | Avoid new repository objects unless raw SQL, caching, a clear domain boundary, or external service isolation justifies it; document why in code |
| RSpec | | FactoryBot; prefer request specs over controller specs; use |
| Serializers | | If using ActiveModel::Serializer (or similar): explicit |
| Service objects | | Single responsibility; class methods for stateless entry points, instance API when dependencies are injected; public methods first; bang ( |
| SQL security | Raw SQL anywhere | No string interpolation of user input; use |
let_it_belet_it_betest-profGemfileGemfile.locktest-profletlet!test-proflet_it_bePRD → TASKS → TEST (write, run, fail) → IMPLEMENTATION → …| Mistake | Reality |
|---|---|
| Duplicate linter rules in prose | The project's configured linter(s) are authoritative for style; this skill is for behavior and boundaries |
| Assuming RuboCop without checking | Detect and run the linter the repo actually uses |
| Use only when |
Defaulting to | Prefer lazy |
New | ActiveRecord is the default data boundary unless there's a documented reason |
| Interpolated log messages | Loses structure; use hash payload |
| Comments restating method names | Adds noise; comment intent and tradeoffs |
| Skill | When to chain |
|---|---|
| rails-stack-conventions | Stack-specific: PostgreSQL, Hotwire, Tailwind |
| ddd-rails-modeling | When domain concepts and invariants need clearer Rails-first modeling choices |
| ruby-service-objects | Implementing or refining service objects |
| rails-background-jobs | Workers, queues, retries, idempotency |
| rspec-best-practices | Spec style, tests gate (red/green/refactor), request vs controller specs |
| rails-security-review | Controllers, params, IDOR, PII |
| rails-code-review | Full PR pass before merge |