A Claude Code plugin that analyzes FactoryBot usage in Rails test suites and recommends optimal build strategies.
Every unnecessary FactoryBot.create call writes to the database. Switching to build_stubbed or build where safe can cut test suite runtime significantly.
This plugin adds a /factone skill that:
- Reads your factory definitions and model callbacks
- Analyzes each
create/build/build_stubbedcall in your test files - Presents a list of recommended changes with explanations
- Applies the changes after your confirmation
/factone # scan whole project
/factone spec/models/ # scan a directory
/factone spec/models/user_spec.rb # scan a single file
/factone --fix # scan and apply all safe changes immediately
/factone spec/models/ --fix # directory + auto-apply
| Strategy | DB write | Has ID | Best for |
|---|---|---|---|
create |
yes | yes | DB state assertions, after_create callbacks, integration tests |
build |
no | no | Validation tests, attribute logic |
build_stubbed |
no | yes (stubbed) | Unit tests, service objects, presenters |
First, clone this repository:
git clone https://github.com/neko314/factone.gitThen install it either project-locally or globally.
cp -r factone /path/to/your/project/.claude/plugins/cp -r factone ~/.claude/plugins/- Claude Code
- A Rails project using FactoryBot
MIT © Keiko Kaneko