用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/arbazkhan971/godmode --skill rails命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | rails |
| description | Ruby on Rails mastery. |
/godmode:rails, "rails app", "ruby on rails"Rails version: <7.2.x or 8.0.x>
Ruby version: <3.3.x>
Architecture: Full-stack (Hotwire)|API-only|Hybrid
Database: PostgreSQL (ALWAYS for production)
Jobs: Sidekiq|Solid Queue|Good Job
Real-time: Action Cable|Turbo Streams|None
Auth: Devise|has_secure_password|Rails 8 built-in
Assets: Propshaft + Import Maps|esbuild|Vite
cat Gemfile | grep -E "rails|ruby"
cat config/database.yml | grep adapter
IF Rails 8: prefer built-in generators (auth, jobs). IF < heavy JS: Import Maps (no build step). IF heavy JS: esbuild or Vite.
| Convention | Rule |
| Model | Singular CamelCase (Order) |
| Table | Plural snake_case (orders) |
| Controller | Plural CamelCase (OrdersController) |
| File | snake_case (order.rb) |
| Foreign key | <model>_id (customer_id) |
| Join table | Alphabetical (labels_orders) |
| Timestamps | created_at, updated_at (auto) |
NEVER violate naming conventions (framework superpower). Extract to services when model > 200 LOC.
| Pattern | When |
| includes(:assoc) | Default N+1 prevention |
| preload(:assoc) | Separate queries (large joins) |
| eager_load(:assoc) | Need WHERE on association |
| select(:col1,:col2) | Reduce data transfer |
| find_each(batch:1000) | Process large datasets |
| counter_cache: true | Avoid COUNT queries |
ALWAYS use includes for associations in views. ALWAYS enable strict_loading in development. NEVER .all.each for large datasets — use find_each. IF foreign key exists: MUST have database index.
| Need | Use |
| SPA-like navigation | Turbo Drive (automatic) |
| Update one section | Turbo Frames |
| Real-time broadcast | Turbo Streams |
| Toggle/dropdown/count | Stimulus controller |
| Full SPA (React/Vue) | Rails API-only + SPA |
IF < 90% of interactivity: Hotwire handles it. IF complex client state: Rails API + React/Vue.
| Processor | When |
| Solid Queue (Rails 8) | Default, DB-backed, simple |
| Sidekiq | High throughput, Redis-backed |
| Good Job | PostgreSQL-backed, no Redis |
Jobs MUST be idempotent (safe to retry). NEVER process > 200ms tasks inline. ALWAYS set retry limits with exponential backoff.
| Layer | Approach |
| Models | RSpec + FactoryBot + Shoulda |
| Requests | RSpec request specs (not controller) |
| System | Capybara (critical flows only) |
| Jobs | ActiveJob::TestHelper |
Use build over create when DB not needed.
Use traits for common variations.
IF coverage < 60%: write tests before refactoring.
[ ] Rails conventions followed
[ ] N+1 eliminated (strict_loading enabled)
[ ] Foreign keys indexed
[ ] Jobs idempotent
[ ] Tests pass (RSpec green)
[ ] Credentials managed (Rails credentials)
[ ] No default_scope, no logic in callbacks
# Rails development and testing
rspec --format progress
rails db:migrate:status
bundle audit check
Append .godmode/rails.tsv:
timestamp action files models migrations tests status
KEEP if: tests pass, no new N+1, migrations reversible.
DISCARD if: tests fail, Bullet detects N+1,
migration irreversible.
STOP when FIRST of:
- bin/rails test passes with zero failures
- No pending migrations, all FKs indexed
- No default_scope, no callback logic
- Bullet reports zero N+1 alerts
On failure: git reset --hard HEAD~1. Never pause.
| Failure | Action |
|---|---|
| Tests fail | db:test:prepare, check fixtures, --seed |
| Migration fails | Add down method, use strong_migrations |
| N+1 detected | Add includes at query site, Bullet verify |
| Bundle audit vuln | Update gem or document + pin version |