

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Rails 8 Core Principles Guide78## Core Philosophy910- Follow Rails conventions religiously - they exist for good reasons11- Embrace the monolith - most applications don't need microservices12- Use Rails 8's built-in features before reaching for external gems13- Write code that's a joy to work with, not just functional14- Optimize for developer happiness and productivity1516## Rails 8 Stack Defaults1718- Use SQLite for development and production by default19- Leverage Solid Queue for background job processing20- Implement Solid Cache for caching with database backend21- Use Solid Cable for WebSocket connections22- Embrace Propshaft for asset pipeline simplicity2324## Framework Principles2526- Convention over configuration in all decisions27- Database-driven design with Active Record at the center28- RESTful resources and routes by default29- Server-side rendering with Hotwire enhancements30- Progressive enhancement over client-side complexity3132## Model Design Principles3334- Keep models focused on data integrity and business rules35- Use Active Record validations extensively36- Implement scopes for common query patterns37- Add database indexes for foreign keys and frequently queried columns38- Use concerns for shared behavior across models3940## Model Best Practices4142- Include schema annotations in all model files43- Order model contents consistently: constants, includes, associations, validations, callbacks, scopes, methods44- Keep callbacks minimal - consider service objects for complex logic45- Use `dependent:` options on associations to maintain referential integrity46- Implement proper counter caches for performance4748## Controller Principles4950- Keep controllers thin and focused on HTTP concerns51- Use before_action filters for common setup and authorization52- Respond to multiple formats (HTML, Turbo Stream, JSON) appropriately53- Follow REST conventions for action names54- Handle errors gracefully with proper HTTP status codes5556## Controller Patterns5758- Use strong parameters for all user input59- Prefer redirect_to with notice/alert over render after mutations60- Implement resourceful routes whenever possible61- Keep business logic out of controllers62- Use concerns for shared controller behavior6364## Service Object Guidelines6566- Create service objects for complex multi-model operations67- Use when business logic doesn't naturally fit in a model68- Keep service objects focused on a single operation69- Return meaningful results (success/failure with errors)70- Make service objects easy to test in isolation7172## View Architecture7374- Use partials for reusable view components75- Keep logic out of views - use helpers or decorators76- Follow Rails naming conventions for templates77- Use Rails form helpers for all forms78- Implement proper semantic HTML structure7980## Testing Philosophy8182- Write tests first (TDD) for all new features83- Use Rails' built-in Minitest framework84- Prefer fixtures over factories for test data85- Write system tests for critical user paths86- Keep tests fast and focused8788## Testing Patterns8990- Test models thoroughly including validations and scopes91- Test controllers for authorization and response formats92- Use system tests for JavaScript interactions93- Mock external services in tests94- Maintain high test coverage without obsessing over 100%9596## Background Jobs9798- Use Active Job interface for all background processing99- Design jobs to be idempotent and retryable100- Keep jobs small and focused on single tasks101- Use appropriate queue priorities102- Handle errors with proper retry strategies103104## Database Design105106- Use database constraints to enforce data integrity107- Create appropriate indexes for query performance108- Use foreign key constraints in migrations109- Design normalized schemas by default110- Document complex queries and database decisions111112## Caching Strategy113114- Use Russian doll caching for nested content115- Cache expensive queries at the model level116- Implement fragment caching for complex views117- Use cache keys that automatically expire118- Monitor cache hit rates in production119120## Security Practices121122- Always use strong parameters in controllers123- Implement proper authentication and authorization124- Use CSRF protection for all forms125- Sanitize user input when displaying HTML126- Keep credentials in Rails credentials system127128## Performance Guidelines129130- Avoid N+1 queries with proper includes131- Use database-level operations when possible132- Implement pagination for large datasets133- Profile before optimizing134- Monitor performance in production135136## API Design (When Needed)137138- Version APIs using URL path versioning (/api/v1)139- Use consistent JSON response formats140- Implement proper HTTP status codes141- Document API endpoints thoroughly142- Use token-based authentication for APIs143144## Active Storage Configuration145146- Configure direct uploads for better performance147- Implement virus scanning for user uploads148- Use variants for image transformations149- Set appropriate service limits150- Clean up orphaned attachments regularly151152## Action Text Implementation153154- Use for rich text content editing155- Configure image upload limits156- Implement proper sanitization157- Style with consistent CSS158- Handle attachments appropriately159160## Action Cable Usage161162- Use Solid Cable adapter for simpler deployment163- Design channels for specific features164- Implement proper authorization in channels165- Keep broadcast payloads minimal166- Handle connection failures gracefully167168## Development Workflow169170- Use Rails generators appropriately171- Keep development environment close to production172- Use Rails console effectively for debugging173- Implement proper seed data174- Document non-obvious decisions175176## Code Organization177178- Follow Rails directory structure strictly179- Use concerns for shared behavior180- Keep lib/ for non-Rails specific code181- Organize tests mirroring app structure182- Use meaningful file and class names183184## Deployment Considerations185186- Use Rails' built-in health check endpoint187- Configure proper database connection pools188- Set appropriate timeouts189- Use encrypted credentials for secrets190- Monitor application performance191192## Error Handling193194- Use Rails error reporter for centralized error tracking195- Implement custom error pages196- Log appropriately at different levels197- Handle exceptions at appropriate levels198- Provide meaningful error messages199200## Upgrade Strategy201202- Stay current with Rails versions203- Read upgrade guides thoroughly204- Update dependencies regularly205- Test thoroughly after upgrades206- Use deprecation warnings as guides207208## Best Practices Summary209210- Write code for humans first, computers second211- Follow Rails conventions unless you have excellent reasons not to212- Keep it simple - you probably don't need that complexity213- Test everything that could possibly break214- Make your code a joy for the next developer (probably you)215216Remember: Rails 8 provides everything you need to build modern web applications. Trust the framework and focus on your business logic.217
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| levifig/rails-instructions.github/instructions/rails-controllers.instructions.md · 54 | Copilot instructions | teststylesecurityapi+1 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-models.instructions.md · 54 | Copilot instructions | teststylearchtypes+4 | 60/100 | 14 days ago | |
| levifig/rails-instructions.cursor/rules/rails-rules.mdc · 54 | Cursor rules | testlint-formatstylearch+9 | 84/100 | 14 days ago | |
| levifig/rails-instructions.github/copilot-instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+4 | 71/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-api.instructions.md · 54 | Copilot instructions | testlint-formatstyletesting-strategy+7 | 67/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-services.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+4 | 75/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-background-jobs.instructions.md · 54 | Copilot instructions | teststyletesting-strategydatabase+2 | 63/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-deployment.instructions.md · 54 | Copilot instructions | setupstylesecuritydatabase+2 | 52/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-hotwire.instructions.md · 54 | Copilot instructions | teststylesecurityperformance+1 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-importmaps.instructions.md · 54 | Copilot instructions | teststylesecuritydatabase+2 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-mobile.instructions.md · 54 | Copilot instructions | styleuiperformance | 66/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-performance.instructions.md · 54 | Copilot instructions | teststylegitdatabase+2 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-security.instructions.md · 54 | Copilot instructions | teststylesecuritydependencies+3 | 63/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-styling.instructions.md · 54 | Copilot instructions | styledatabaseuiperformance+3 | 59/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-testing.instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+2 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-views.instructions.md · 54 | Copilot instructions | teststylearchsecurity+3 | 60/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails.instructions.md · 54 | Copilot instructions | testlint-formatstylearch+9 | 84/100 | 14 days ago | |
| levifig/rails-instructions.cursor/rules/guidelines.mdc · 54 | Cursor rules | teststyletesting-strategysecurity+4 | 71/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/levifig-rails-instructions-github-instructions-rails-core-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.