Skip to content

Add Claude Code commands for Rails development #141

@joshukraine

Description

@joshukraine

Motivation

The current Claude Code setup has solid general-purpose commands (/commit, /create-pr, /review-pr, /resolve-issue, /update-deps, /test-drive, /new-project), but lacks commands tailored to the primary development workflow: Ruby on Rails.

Proposed commands

/refactor

Systematic code refactoring with test validation between steps:

  • Analyze the target code for complexity, duplication, and design issues
  • Propose refactoring steps with clear before/after expectations
  • Run tests after each step to ensure nothing breaks
  • Support common patterns: extract method, extract class, inline, rename, move

/debug

Structured debugging workflow:

  • Analyze error output (stack traces, logs, test failures)
  • Trace code paths through the application
  • Identify root cause vs symptoms
  • Suggest and apply fixes with test validation

/security-audit

Scan for common security issues, especially Rails-specific:

  • Mass assignment vulnerabilities (strong parameters)
  • SQL injection (raw SQL, find_by_sql, interpolation)
  • CSRF protection gaps
  • Insecure direct object references
  • Open redirects
  • Sensitive data exposure in logs/errors

Other improvements

  • Update project CLAUDE.md to list available custom commands for discoverability
  • Consider pre-allowing bundle, bin/rails, bin/rspec in Claude Code permissions for smoother Rails workflows

Files

  • claude/.claude/commands/ (new command files)
  • CLAUDE.md

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions