4,962,034 AI resources indexedWorking toward the world’s largest AI resource index.

Rails

Build reliable Rails apps avoiding ActiveRecord traps, N+1 queries, and callback pitfalls.

Installable skillMITBy clawicUpdated Oct 28, 2026
INTENDED FOROpenClawInstall in a listed agent.

instructions.md

---
name: rails-d04b351d3957
slug: rails
version: 1.0.1
description: Build reliable Rails apps avoiding ActiveRecord traps, N+1 queries, and callback pitfalls.
homepage: https://clawic.com/skills/rails
metadata:
  clawdbot:
    emoji: πŸ›€οΈ
    requires:
      bins:
      - rails
    os:
    - linux
    - darwin
    - win32
    displayName: Rails
---

## Quick Reference

| Topic | File |
|-------|------|
| N+1, callbacks, validations, scopes | `activerecord.md` |
| Strong params, filters, render | `controllers.md` |
| Route conflicts, constraints | `routing.md` |
| Partials, helpers, caching, XSS | `views.md` |
| ActiveJob, Sidekiq, retries | `jobs.md` |
| Mass assignment, CSRF, SQL injection | `security.md` |

## Critical Rules

- `save` returns false on failure β€” `save!` raises, check return or use bang
- `update_all`/`delete_all` skip callbacks and validations β€” data corruption if unaware
- `find_each` for batches β€” `Model.all.each` loads entire table into memory
- `redirect_to` doesn't halt execution β€” code after it runs, use `and return`
- `dependent: :destroy` missing β€” orphan records accumulate forever
- `default_scope` pollutes all queries including joins β€” almost always wrong
- Callbacks chain silently β€” `throw :abort` stops save but returns false, not exception
- `includes` without `references` in `where` string β€” N+1 still happens
- `||=` memoization caches nil/false β€” use `defined?(@var) ? @var : @var = compute`
- `has_many through:` vs `has_and_belongs_to_many` β€” latter has no join model for attrs
- Nested `before_action` β€” multiple inheritance makes flow unreadable
- `render` doesn't stop action β€” code continues, duplicate render crashes

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.