A Claude Code skill that performs comprehensive code audits of Ruby on Rails applications based on thoughtbot's Ruby Science and Testing Rails best practices.
$ npx -y skills add thoughtbot/rails-audit-thoughtbot --agent claude-code
Run the curl in your terminal, the rest in Claude Code.
What's inside
A Claude Code skill that performs comprehensive code audits of Ruby on Rails applications based on thoughtbot's Ruby Science and Testing Rails best practices.
This skill analyses Rails applications and generates detailed audit reports covering:
Copy the skill directory to your Claude Code skills folder:
cp -r rails-audit-thoughtbot ~/.claude/skills/
Or clone directly:
git clone https://github.com/thoughtbot/rails-audit-thoughtbot ~/.claude/skills/rails-audit-thoughtbot
If you are in your terminal and not in a Claude session, you can invoke the skill directly by using the below. You need to be in the root directory of your Rails project.
claude audit
If you are in a Claude session, you can reference the skill directly:
/rails-audit-thoughtbot
In a Claude session you can also run targeted audits:
/rails-audit-thoughtbot audit controllers
This focuses the audit on specific files or directories.
During the audit, the skill offers to run optional data-collection steps that enrich the report with tool-measured metrics. Each step is opt-in โ you will be prompted before anything is installed or executed. If the tool is already in your Gemfile, the skill uses it directly without modifying your project.
Runs your test suite with SimpleCov to capture actual line and branch coverage percentages. The report will include per-directory coverage breakdowns, lowest-coverage files, and zero-coverage files.
simplecov to the Gemfile (if not already present)Runs RubyCritic to measure code complexity, duplication, and code smells using Reek, Flay, and Flog. The report will include per-file ratings (A-F), worst-rated files, most common smells, and most complex files.
rubycritic to the Gemfile (if not already present)app/ and lib/ (or targeted paths)The skill includes reference documentation based on thoughtbot best practices. All the materials are compacted information from the books mentioned above.
Recommendations of PORO objects are based on different thoughtbot sources and Service objects are poorly-named models.
| File | Description |
|---|---|
references/code_smells.md | Code smell patterns to identify (Ruby Science) |
references/testing_guidelines.md | Testing best practices (Testing Rails) |
references/poro_patterns.md | PORO and ActiveModel patterns |
references/security_checklist.md | Security vulnerability checklist |
references/rails_antipatterns.md | Rails-specific antipatterns: external services, migrations, performance |
references/report_template.md | Audit report structure template |
agents/simplecov_agent.md | Subagent for SimpleCov test coverage collection |
agents/rubycritic_agent.md | Subagent for RubyCritic code quality metrics |
Contributions are welcome! If you'd like to improve the audit patterns or add new detection rules:
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)This skill is open source and available under the MIT License.
This skill is inspired by and based on thoughtbot's excellent guides:
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
We love open source software! See thoughtbot's other projects.
agents/ rubycritic_agent.md simplecov_agent.md CODEOWNERS LICENSE README.md references/ code_smells.md poro_patterns.md rails_antipatterns.md report_template.md security_checklist.md testing_guidelines.md SKILL.md
FAQ
rails-audit-thoughtbot is a Claude Code plugin with 1 hand-picked skill for development work, indexed on Flowy. Install it with the command on its page. It includes rails-audit-thoughtbot. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.