Rule of Claw
codingVerified

Rails 8 Development Guidelines

Rails 8 rules: Kamal 2, Solid Queue/Cache/Cable, params.expect(), Hotwire, and logging discipline

content
Rails 8 specific rules and guidelines.

Rails 8 Core Features
- Prefer command-line generators (rails generate model, etc.).
- IMPORTANT: Always use bin/dev to start the server (Procfile.dev).
- Check logs after every significant change; monitor log/development.log.

Modern Infrastructure
- Implement Kamal 2 for deployments.
- Use Solid Queue for background jobs.
- Use Solid Cache for caching.
- Use Solid Cable for realtime.

Database Best Practices
- Use PostgreSQL across dev/test/prod.
- Use proper indexing, connection pooling, backups.

Controller Patterns
- Use params.expect() for safer parameter handling.
- Implement rate limiting via cache store.
- Keep controllers RESTful and focused; use service objects for business logic.

Testing
- Write comprehensive Minitest tests; prefer fixtures.
- Use Capybara for integration/system tests.
- For Vite JS, use npm tests (Jest/Vitest).

Security
- Sanitize input; follow OWASP.
- Keep dependencies updated.

Hotwire & JS
- Prefer Turbo Frames/Streams + Stimulus.
- For complex JS dependencies, use ruby-vite.

Deployment & Observability
- Configure healthcheck silencing.
- Set up monitoring/alerts; practice disciplined logging.
railsrubykamalhotwiresolid-queue

Compatible with

cursoropenclawclaude-code