quality-check-rails
Smart Collection Rails quality assurance workflow. Use when the user asks to run Rails QA, verify project quality, check RuboCop/RSpec, validate Rails CI readiness, or fix quality issues in the Rails/Mongoid/Docker application.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-10-22
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- quality-check-rails
- description
- Smart Collection Rails quality assurance workflow. Use when the user asks to run Rails QA, verify project quality, check RuboCop/RSpec, validate Rails CI readiness, or fix quality issues in the Rails/Mongoid/Docker application.
03 SKILL.md 正文
Quality Check Rails
Assume the Smart Collection Rails QA role. Keep the Rails application structurally sound, lint-clean, free of avoidable duplication, and green in tests.
Scope Detection
- For focused Rails changes, run targeted specs and RuboCop for the changed files before broad suites.
- Use the full workflow when the user asks for broad QA, CI readiness, release confidence, or when cross-cutting changes make focused checks insufficient.
- Do not load extra references or adjacent skills unless the changed area or the user request requires them.
Core Workflow
- Run the centralized Rails QA script from the project root:
docker compose exec web bash bin/qa
-
Read the full output. The script may continue after linter offenses to show the complete picture.
-
Fix issues that autocorrect does not resolve:
- For RuboCop manual offenses such as
Metrics/MethodLengthorMetrics/AbcSize, refactor while preserving behavior. - Prefer extracting complex controller logic to services in
app/services/. - Keep Rails/Mongoid conventions and 2-space Ruby indentation.
- Address
rails_best_practicesfindings carefully:
- Preserve controller/view behavior.
- Do not make broad refactors unrelated to the reported issue.
- Address
flayduplication:
- Extract genuinely shared behavior to a service object or concern only when it reduces real duplication.
- Keep security scoping intact.
- Address
brakemanfindings:
- Treat warnings about authentication, authorization, unsafe redirects, command execution, mass assignment, and secret exposure as high priority.
- Keep all user-owned data access scoped through
current_user. - Do not suppress warnings unless the finding is demonstrably false positive and the reason is documented in code or configuration.
- After Rails code changes, rerun:
docker compose exec web bin/safe_rspec
Never finish a Rails QA task with failing tests unless you clearly report the blocker.
Docker And Windows Failures
- If
bin/safe_rspecorbin/qafails with messages like$'\r': command not foundorcannot execute: required file not found, treat CRLF in scripts as the likely cause and use an in-memory workaround without editing the script:
docker compose exec web sh -lc "tr -d '\r' < bin/safe_rspec | bash -s -- spec/path_spec.rb"
docker compose exec web sh -lc "tr -d '\r' < bin/safe_rspec | bash"
docker compose exec web sh -lc "tr -d '\r' < bin/qa | bash"
- If
bin/qawith CRLF removed in memory fails at the final RSpec step because it callsbin/safe_rspecdirectly, record the partial QA result and run the suite separately with the workaround above. - If broad QA or a large spec batch times out before useful output, split the run into focused steps: RuboCop for changed files, focused specs,
rails_best_practices,flay app/, and then the full suite when practical. - If RuboCop reports
Layout/EndOfLineon changed files in Windows, normalize only those files inside the container and rerun the focused RuboCop check:
docker compose exec web perl -pi -e 's/\r$//' path/to/file.rb
Safety Rules
- Never remove user data segregation. Queries and controller actions must stay scoped through
current_userwhenever user-owned data is involved. - Never replace scoped access such as
current_user.cars.find(params[:id])with global access such asCar.find(params[:id]). - Never hardcode secrets, API keys, passwords, or tokens. Use environment variables.
- Do not add gems or libraries without explicit user authorization.
- Preserve the project architecture from
AGENTS.md: thin controllers, reusable business logic inapp/services/, CarrierWave for uploads, Docker Compose for Rails commands.
Final Report
Report:
- Which Rails QA commands were run.
- How many issues were found, if known.
- Which manual fixes were applied.
- Final RSpec/linter/Brakeman status.
Keep the summary brief and lead with failures if anything remains unresolved.
04 同仓库更多 Skills
security-check
Smart Collection security audit workflow. Use when the user asks to run security checks, audit Ruby gems, audit JavaScript or Python dependencies, verify bundler-audit, run OWASP ZAP against the Rails app, investigate vulnerable dependencies, fix security issues, or improve project security posture in this Rails/Mongoid/Python/Docker project.
quality-check-python
Smart Collection Python microservice quality workflow. Use when the user asks to run Python QA, lint Python code, test Python microservices, validate yolo/upscale changes, or when files under yolo/ or upscale/ change.
quality-check-javascript
Smart Collection JavaScript quality workflow. Use when the user asks to run JavaScript QA, validate esbuild/jsbundling-rails, check npm dependencies, verify Stimulus/Turbo controllers, or when files under app/javascript, package.json, package-lock.json, or JavaScript-related Rails layout/build configuration change.
security-check
暂无简介
quality-check-rails
暂无简介
quality-check-python
暂无简介