- Rails 8 app. Core code in
app/with namespaced controllers (admin/,hr/,cp/,staff/), matching views/policies/services/jobs/mailers; keep features in the right namespace. - Frontend entrypoints in
app/javascript/packs/; shared Stimulus controllers inapp/javascript/controllers/; lazy controllers inapp/javascript/lazy_controllers/; React components inapp/javascript/react/. DataTables live inapp/datatables/; background jobs inapp/sidekiq/. - Routes split by role in
config/routes*.rb. Schema/migrations indb/; fixtures intest/fixtures/; tests (model/system/mailers) intest/. Usebin/shims for rails/rake/shakapacker/pnpm/rubocop/brakeman.
- Install & prepare:
bin/setuporbundle install,bin/pnpm install,bin/rails db:migrate,RAILS_ENV=development bin/rails db:fixtures:load. - Run app:
bin/devfor Rails + Shakapacker, orbin/rails serverwithbin/shakapacker-dev-server. - Assets:
bin/shakapackerbuilds production packs. - Tests:
bin/rails test(all),bin/rails test:system(Capybara),bin/rails test:db(reset then run). Lint/security:bin/rubocop(StandardRB) andbin/brakeman.
- StandardRB defaults: 2 spaces, double quotes, idiomatic Rails; keep controllers thin and push logic to services/models.
- Class names by role (
SomethingDatatable,SomethingJob,SomethingPolicy); place jobs inapp/sidekiq/, policies inapp/policies/. - Stimulus controllers named
*_controller.js(kebab filenames, camelCase values); React components PascalCase underapp/javascript/react/; packs should stay small and feature-scoped. - Authorize controllers with Pundit (
authorize,policy_scope); prefer PORO services over callbacks.
- Add Minitest coverage with each change; use fixtures or build records inline. Pair model tests with system tests for user-facing flows.
- Run targeted files via
bin/rails test path/to/file_test.rb; usebin/rails test:systemwhen touching Stimulus/React screens. - Keep tests deterministic: freeze time for time-based assertions and stub external calls.
- Commit messages match repo style: short imperative summaries (
Add rorvswild monitor). Keep concerns small. - PRs should note scope, linked issue, tests run (
bin/rails test,bin/rubocop), screenshots for UI, and call out migrations/backfills/ops steps.
- Keep secrets in Rails credentials or env vars; do not commit dumps or production configs. Default dev login lives in
README.md. - Leave Shakapacker HMR (
config/shakapacker.yml) on for local dev only.