Integrate RubyCritic to analyze Ruby code quality and maintain high standards throughout development. Use when working on Ruby projects to check code smells, complexity, and duplication. Triggers include creating/editing Ruby files, refactoring code, reviewing code quality, or when user requests code analysis or quality checks.
Automatically analyzes Ruby code quality using RubyCritic when creating, editing, or refactoring files. Detects code smells, complexity, and duplication to maintain high standards throughout development.
/plugin marketplace add el-feo/ai-context/plugin install ruby-rails@jebs-dev-toolsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/code_smells.mdreferences/configuration.mdreferences/error-handling.mdreferences/git-hooks.mdscripts/check_quality.sh<quick_start> Run quality check on Ruby files:
scripts/check_quality.sh [path/to/ruby/files]
If no path is provided, analyzes the current directory. The script automatically installs RubyCritic if missing.
Immediate feedback:
Integration pattern:
scripts/check_quality.sh [changed_files]When to skip: Simple variable renames, comment changes, or minor formatting adjustments don't require quality checks. </automated_quality_checks>
<interpreting_results> Overall Score:
File Ratings:
Issue Types:
<responding_to_issues> Priority order:
Incremental fixing:
When scores drop:
<error_handling> Common errors and solutions:
"RubyCritic not found": Script auto-installs, but if it fails:
ruby --versiongem install rubycriticgem 'rubycritic', require: false"No files to analyze": Verify path contains .rb files
scripts/check_quality.sh app/models"Bundler error": Gemfile.lock conflict
bundle install firstgem install rubycritic && rubycritic [path]Analysis hangs: Large codebase
--no-browser flag to skip HTML generation.rubycritic.yml to exclude pathsFor additional error scenarios, see references/error-handling.md </error_handling> </workflow>
<git_hooks_integration> Pre-commit quality checks: Automatically run RubyCritic before commits:
# .git/hooks/pre-commit
#!/bin/bash
# Get staged Ruby files
RUBY_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.rb$')
if [ -n "$RUBY_FILES" ]; then
echo "Running RubyCritic on staged files..."
scripts/check_quality.sh $RUBY_FILES
if [ $? -ne 0 ]; then
echo "Quality check failed. Fix issues or use --no-verify to skip."
exit 1
fi
fi
CI integration: Add to GitHub Actions, GitLab CI, or other CI systems:
# .github/workflows/quality.yml
- name: Run RubyCritic
run: |
gem install rubycritic
rubycritic --format json --minimum-score 90
For complete git hooks setup and CI examples, see references/git-hooks.md </git_hooks_integration>
<configuration> **Basic configuration** (`.rubycritic.yml`):minimum_score: 95
formats:
- console
paths:
- 'app/'
- 'lib/'
no_browser: true
Common options:
minimum_score: Fail if score below this thresholdformats: Output formats (console, html, json)paths: Directories to analyzeno_browser: Don't auto-open HTML reportFor advanced configuration and custom thresholds, see references/configuration.md </configuration>
<common_patterns> Quick quality check during development:
# Check recently modified files
scripts/check_quality.sh $(git diff --name-only | grep '\.rb$')
Generate detailed HTML report:
bundle exec rubycritic --format html app/
# Opens browser with detailed analysis
Compare with main branch (CI mode):
rubycritic --mode-ci --branch main app/
# Shows only changes from main branch
Check specific file types:
scripts/check_quality.sh app/models/*.rb
scripts/check_quality.sh app/services/**/*.rb
</common_patterns>
<code_smell_reference> For detailed examples of common code smells and how to fix them, see references/code_smells.md
Quick reference:
Manual installation:
With Bundler:
# Gemfile
group :development do
gem 'rubycritic', require: false
end
System-wide:
gem install rubycritic
</installation>
<success_criteria> RubyCritic is successfully integrated when:
<reference_guides> Detailed references:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.