/ruby-rails:postgresql-rails-analyzerfrom ruby-rails
Analyzes Rails applications for PostgreSQL performance issues including N+1 queries, missing indexes, and suboptimal configurations. Provides actionable recommendations and migration code.
Ships in ruby-rails. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Analyze Rails applications for PostgreSQL performance issues and provide actionable optimization recommendations based on "High Performance PostgreSQL for Rails" best practices.
Run from the Rails application root directory:
ruby scripts/analyze_n_plus_one.rb
Detects potential N+1 query issues by analyzing:
includes, preload, or eager_load callsruby scripts/analyze_indexes.rb
Identifies indexing opportunities:
ruby scripts/analyze_config.rb
Reviews database.yml for:
Clarify what the user wants to analyze: full performance audit, specific issue (slow queries, N+1 problems), configuration review, or schema optimization.
# For comprehensive analysis, run all three
ruby scripts/analyze_n_plus_one.rb
ruby scripts/analyze_indexes.rb
ruby scripts/analyze_config.rb
Script output categorizes issues by severity:
Create a prioritized list of actionable recommendations:
For index and schema recommendations, provide ready-to-use migration code. Use algorithm: :concurrently for production migrations to avoid locking tables.
class AddPerformanceIndexes < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_index :posts, :user_id, algorithm: :concurrently
add_index :users, :active, where: "active = false", algorithm: :concurrently
add_index :orders, [:status, :created_at], algorithm: :concurrently
end
end
Load these references when users need deeper understanding:
references/performance_guide.md — comprehensive best practices (indexes, queries, config, schema design, monitoring)references/anti_patterns.md — 25 common mistakes organized by category (queries, indexes, schema, config, transactions)For deeper analysis beyond the scripts, manually review:
rails c to run EXPLAIN ANALYZE on slow queries, check for sequential scans on large tablesfind_each instead of each)These analysis scripts use static analysis. They may produce false positives (flagging non-issues) or false negatives (missing runtime-only issues). Always recommend testing fixes in staging and using EXPLAIN ANALYZE to verify.
Suggest for ongoing monitoring: PgHero (dashboard), pg_stat_statements (query stats), Bullet gem (runtime N+1 detection), Rails query logging (development visibility).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub el-feo/ai-context --plugin ruby-rails13 skills in this plugin
/brakemanStatic analysis security vulnerability scanner for Ruby on Rails applications. Use when analyzing Rails code for security issues, running security audits, reviewing code for vulnerabilities, setting up security scanning in CI/CD, managing security warnings, or investigating specific vulnerability types (SQL injection, XSS, command injection, etc.). Also use when configuring Brakeman, reducing false positives, or integrating with automated workflows./cucumber-gherkinBDD testing with Cucumber and Gherkin for Ruby and Rails applications. Use when writing feature files (.feature), step definitions, hooks, or implementing Behaviour-Driven Development in Ruby/Rails projects. Covers Gherkin keywords (Feature, Scenario, Given/When/Then, Background, Scenario Outline, Rule), Ruby step definition patterns, Cucumber Expressions, hooks (Before/After/BeforeAll/AfterAll), tags, data tables, doc strings, World modules, and Capybara integration. Triggers on cucumber, gherkin, BDD, feature files, step definitions, acceptance testing, executable specifications./design-patterns-rubyComprehensive Ruby implementations of Gang of Four (GoF) design patterns. Use when implementing object-oriented design solutions, refactoring to reduce coupling, solving architecture problems, or when user mentions specific patterns (Factory, Singleton, Observer, Strategy, etc.) in Ruby context.Other plugins' skills for the same job