🤖
Rails
Build Rails applications with proper conventions, performance patterns, and security practices.
安全通过
技能说明
name: Rails slug: rails version: 1.0.1 description: Build reliable Rails apps avoiding ActiveRecord traps, N+1 queries, and callback pitfalls. metadata: {"clawdbot":{"emoji":"🛤️","requires":{"bins":["rails"]},"os":["linux","darwin","win32"]}}
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
savereturns false on failure —save!raises, check return or use bangupdate_all/delete_allskip callbacks and validations — data corruption if unawarefind_eachfor batches —Model.all.eachloads entire table into memoryredirect_todoesn't halt execution — code after it runs, useand returndependent: :destroymissing — orphan records accumulate foreverdefault_scopepollutes all queries including joins — almost always wrong- Callbacks chain silently —
throw :abortstops save but returns false, not exception includeswithoutreferencesinwherestring — N+1 still happens||=memoization caches nil/false — usedefined?(@var) ? @var : @var = computehas_many through:vshas_and_belongs_to_many— latter has no join model for attrs- Nested
before_action— multiple inheritance makes flow unreadable renderdoesn't stop action — code continues, duplicate render crashes
如何使用「Rails」?
- 打开小龙虾AI(Web 或 iOS App)
- 点击上方「立即使用」按钮,或在对话框中输入任务描述
- 小龙虾AI 会自动匹配并调用「Rails」技能完成任务
- 结果即时呈现,支持继续对话优化