{
  "markdown": "# rails-query\n\nA Claude Code plugin that teaches Claude to answer data questions about a Rails 8.2+ application using the [`rails query`](https://github.com/rails/rails/pull/57156) command — locally or against a deployed environment via Kamal.\n\n## What it does\n\nWhen you ask Claude something like:\n\n- \"How many active users do we have?\"\n- \"Show me the orders table structure.\"\n- \"What models reference `accounts`?\"\n- \"Explain the query plan for this scope.\"\n\n…Claude reaches for `rails query` instead of opening a console, SSHing to a server, or writing a one-off script. Queries are structured (JSON output), read-only by construction (writes blocked at the connection level), and safe to run against production with a read replica.\n\nThe skill covers:\n\n- **Both paths** — local (`bin/rails query`) and remote via Kamal (`bin/kamal query -d <env>`)\n- **All four input modes** — ActiveRecord expressions, raw SQL (`--sql`), schema/model introspection (`schema`, `models`), and `EXPLAIN` plans\n- **Pagination** — how to page through large results, and why you shouldn't add your own `LIMIT`\n- **The Kamal quoting rule** — the one gotcha that bites when your SQL has parens or stars, and the reliable fix\n\n## Installation\n\nThis repository is both the plugin and a single-plugin marketplace, so you can install it directly without waiting for Anthropic marketplace approval.\n\nFrom your shell:\n\n```shell\nclaude plugin marketplace add lewispb/rails-query-skill\nclaude plugin install rails-query@rails-query-skill\n```\n\nOr equivalently, from inside an interactive Claude Code session:\n\n```\n/plugin marketplace add lewispb/rails-query-skill\n/plugin install rails-query@rails-query-skill\n/reload-plugins\n```\n\nThe first command registers this repo as a marketplace; the second installs the plugin. In-session, `/reload-plugins` picks it up without restarting. The plugin will also be submitted to the official Anthropic marketplace — once approved, a shorter `claude plugin install rails-query@claude-plugins-official` will work too.\n\n## Requirements\n\n- **Rails 8.2+** (the app you're querying). Earlier versions don't ship the `rails query` command.\n- **`jq`** on your PATH if you want the skill's suggested extraction patterns to work (`jq '.rows[0][0]'`).\n- **For remote use: Kamal** with an alias added to `config/deploy.yml`:\n\n  ```yaml\n  aliases:\n    query: 'app exec -q --reuse -p -r console \"rails query\"'\n  ```\n\n  Your `console` role should be configured with read-replica DB access. See the skill body for the reasoning behind each flag.\n\n## How triggering works\n\nThe skill is described broadly so Claude invokes it whenever a task would naturally be solved by querying a Rails database — not just when the user types `/rails-query:rails-query`. Try:\n\n> \"How many users registered last week?\"\n\n> \"What's in the `mailboxes` table?\"\n\n> \"Explain this query: `Post.published.limit(100)`\"\n\n## Further reading\n\n- [rails/rails#57156](https://github.com/rails/rails/pull/57156) — the PR that added `rails query` to Rails 8.2. Read this for the full design, rationale, and command surface.\n- [Kamal `app` commands](https://kamal-deploy.org/docs/commands/app/) — for wiring `bin/kamal query` to `rails query` on deployed environments.\n\n## Contributing\n\nIssues and PRs welcome at https://github.com/lewispb/rails-query-skill.\n\n## License\n\nMIT\n",
  "bytes": 3331,
  "sha": "8c7cdeedaae9fa91699636e41f972bb2ca9ba8c719e712e41e34b4c10728e23a",
  "repo_slug": "lewispb/rails-query-skill",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_lewispb_rails_query_skill_rails_query_ff602cea/readme"
}