Use when writing new Rails code for a project using PostgreSQL, Hotwire, and Tailwind CSS. Covers MVC structure, query patterns, Turbo Frames/Streams, Stimulus controllers, and Tailwind components. For design principles, use rails-code-conventions.
77
71%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./rails-stack-conventions/SKILL.mdWhen writing or generating code for this project, follow these conventions. Stack: Ruby on Rails, PostgreSQL, Hotwire (Turbo + Stimulus), Tailwind CSS.
Core principle: Follow Rails conventions. When in doubt, check the official Rails guides.
Style: If the project uses a linter, treat it as the source of truth for formatting and cops. For cross-cutting design principles (DRY, YAGNI, structured logging, rules by directory), use rails-code-conventions.
ALL new code MUST have its test written and validated BEFORE implementation.
1. Write the spec for the behavior
2. Run the spec — verify it fails because the feature does not exist yet
3. ONLY THEN write the implementation code
See rspec-best-practices for the full gate cycle.| Aspect | Convention |
|---|---|
| Style | RuboCop project config when present; otherwise Ruby Style Guide, single quotes, unless/` |
| Naming | snake_case files/methods, CamelCase classes |
| Models | MVC, concerns, service objects for complex logic |
| Queries | Eager loading (includes), avoid N+1 |
| Frontend | Hotwire (Turbo + Stimulus), Tailwind CSS |
| Testing | RSpec or Minitest, TDD/BDD, FactoryBot |
| Security | Devise/Pundit, strong params, guard XSS/CSRF/SQLi |
user_signed_in?, calculate_totalunless, ||=, &.includes, joins, select as needed| Mistake | Reality |
|---|---|
| Logic in views | Use helpers, presenters, or Stimulus controllers |
| N+1 queries ignored in development | They compound in production. Always eager load. |
| Raw SQL without parameterization | SQL injection risk. Use ActiveRecord query methods. |
| Skipping FactoryBot for "quick" test | Fixtures are brittle. Factories are faster to maintain. |
| Ignoring Ruby Style Guide | Consistent style reduces review friction. Follow the guide. |
includes on associations used in loops| Skill | When to chain |
|---|---|
| rails-code-conventions | Before or alongside this skill for principles, logging, and path-specific boundaries |
| rails-code-review | When reviewing existing code against these conventions |
| ruby-service-objects | When extracting business logic into services |
| rspec-best-practices | For testing conventions |
| rails-architecture-review | For structural review beyond conventions |
Follow the official Rails guides for routing, controllers, models, views, and related topics.
ae8ea63
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.