by crisnahine
45 MCP tools that give AI coding agents ground truth about your Rails app: schema, models, routes, controllers, views, jobs, conventions. Works with Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI. MCP or CLI, in-Gemfile or standalone, and it still answers when the app can't boot.
# Add to your Claude Code skills
git clone https://github.com/crisnahine/rails-ai-contextGuides for using ai agents skills like rails-ai-context.
Last scanned: 5/30/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-30T16:12:02.117Z",
"npmAuditRan": true,
"pipAuditRan": true
}rails-ai-context is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by crisnahine. 45 MCP tools that give AI coding agents ground truth about your Rails app: schema, models, routes, controllers, views, jobs, conventions. Works with Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI. MCP or CLI, in-Gemfile or standalone, and it still answers when the app can't boot. It has 153 GitHub stars.
Yes. rails-ai-context passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/crisnahine/rails-ai-context" and add it to your Claude Code skills directory (see the Installation section above).
rails-ai-context is primarily written in Ruby. It is open-source under crisnahine on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh rails-ai-context against similar tools.
No comments yet. Be the first to share your thoughts!
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
Give your AI coding assistant ground truth about your Rails app
:star: If this gem saves you a correction loop, star it on GitHub!
Why • Features • Getting started • Usage • Tools • Configuration • Documentation

rails-ai-context is a Ruby gem that turns your Rails app into the source of truth for AI coding assistants. Instead of guessing your schema, associations, routes and conventions from training data, the assistant asks your app: 45 read-only tools served over MCP or run from the CLI, plus generated context files for Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI.
[!TIP] Nothing to add to your Gemfile if you don't want to.
gem install rails-ai-context, thenrails-ai-context initinside any Rails app. It also works on an app that won't boot: pass--no-bootand every tool answers from the source files.
You have seen your assistant do these:
user.posts when the association is user.articles.before_action inherited from a parent controller, then wonder why auth fails.You catch it, fix it, re-prompt, and something next to it breaks. The tokens are cheap; the correction loop is what costs you the afternoon. This gem removes the guess at the source.
| You ask the AI to... | Without | With |
|---|---|---|
Add a subscription_tier column to users |
Writes the migration, duplicates an existing column | Reads the live schema, sees subscription_status, asks before migrating |
Call user.posts in a controller |
Guesses; NoMethodError at runtime |
Resolves the real association from the model |
| Write tests for a new model | Scaffolds with FactoryBot | Detects your fixture-based suite and matches it |
| Fix a failing create action | Misses the inherited authenticate_user! |
Gets parent-controller filters inline with the action source |
| Build a dashboard page | Invents Tailwind classes from memory | Gets your real button/card/alert patterns |
Trace where publishable? is used |
Reads 6 files in sequence, still misses callers | One call: definition + source + every caller + tests |

[VERIFIED] or [INFERRED] so the assistant knows what is ground truth and what needs a runtime check.rails:// and rails-ai-context:// URIs that introspect fresh on every read.config/routes.rb, db/schema.rb, migrations and source files, and say so.MCP::Tool classes next to the built-in ones and test them with the bundled TestHelper.brakeman for security_scan, listen for watch, ripgrep for faster search_codebundle add rails-ai-context --group development
rails generate rails_ai_context:install
The generator asks which AI tools you use and whether you want MCP or CLI mode, then writes the context files, the MCP config for each tool, and config/initializers/rails_ai_context.rb. Re-running it is safe; it keeps what you have and adds what is missing.
gem install rails-ai-context
cd your-rails-app
rails-ai-context init
rails-ai-context serve
No Gemfile change. Config lives in .rails-ai-context.yml. Works with rbenv, rvm, asdf, mise, chruby and system Ruby. See Standalone.
rails ai:doctor # in-Gemfile: readiness score + diagnostics
rails-ai-context doctor # standalone
rails 'ai:tool[schema]' table=users
rails 'ai:tool[model_details]' model=User
rails 'ai:tool[search_code]' pattern=publishable? match_type=trace
Then open the project in your AI tool. The MCP config it wrote is picked up on open, and the assistant starts calling rails_get_model_details instead of guessing.
[!NOTE] The CLI commands above are for you. When MCP is connected the assistant calls the same tools itself; you never type them.
The default. Each AI tool gets its own config file (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, opencode.json, .codex/config.toml) pointing at:
rails ai:serve # in-Gemfile
rails-ai-context serve # standalone
Mount the server inside your app. It inherits your routing, auth and middleware, and needs no second process.
# config/routes.rb
mount RailsAiContext::Engine, at: "/mcp"
Point the client at http://localhost:3000/mcp. There is also a standalone HTTP process: rails-ai-context serve --transport http --port 6029.
[!WARNING] Each connected client that opens the SSE channel holds one server thread for the life of the connection. Fine for development; raise Puma's thread count or use the standalone HTTP process if several clients share the app.
Same 45 tools, no server, any terminal.
rails 'ai:tool[search_code]' pattern="publishable?" match_type=trace
rails-ai-context tool schema --table users --detail full
Tool names resolve loosely: schema, get_schema and rails_get_schema all work. Most tools take detail=summary|standard|full.
| In-Gemfile | Standalone | What it does |
|---|---|---|
rails ai:serve |
rails-ai-context serve |
Start the MCP server (stdio) |
rails ai:serve_http |
rails-ai-context serve --transport http |
Start the MCP server (HTTP) |
rails 'ai:tool[NAME]' |
rails-ai-context tool NAME |
Run one tool |
rails ai:tool |
rails-ai-context tool --list |
List the tools |
rails ai:context |
rails-ai-context context |
Generate context files |
rails ai:doctor |
rails-ai-context doctor |
Diagnostics and readiness score |
rails ai:watch |
rails-ai-context watch |
Regenerate on file change |
rails 'ai:preset[NAME]' |
rails-ai-context preset NAME |
Run a multi-tool preset (architecture, debugging, migration) |
Flags shared by the app-reading commands: --app-path PATH to target another directory, --environment ENV to set RAILS_ENV, and --no-boot to skip the boot attempt and answer from source. Full list in the CLI reference.
Every tool is read-only and answers from your app.
| Category | Tools |
|---|---|
| Search and trace | search_code, get_edit_context |
| Understand | analyze_feature, get_context, onboard |
| Schema and models | get_schema, get_model_details, get_callbacks, get_concern |
| Controllers and routes | get_controllers, get_routes |
| Views and frontend | get_view, get_stimulus, get_partial_interface, get_turbo_map, get_frontend_stack |
| Testing and quality | get_test_info, generate_test, validate, security_scan, performance_check |
| App config and services | get_api, get_conventions, `get_config |