Thursday, July 30, 2026
HomeRuby On RailsClaude Abilities | Drifting Ruby

Claude Abilities | Drifting Ruby


# Claude Terminal
/analytics What number of signups per thirty days this 12 months?
/analytics Paid income damaged down by product.
/analytics Evaluate paid vs refunded order counts.
/analytics Which nation has essentially the most prospects?
# .claude/instructions/analytics.md
---
description: Reply a enterprise query concerning the app's knowledge by working read-only ActiveRecord queries by way of bin/rails runner, one after the other, till you may again the reply with actual numbers.
argument-hint: a query about prospects/orders, e.g. "which plan generates essentially the most income?"
---

You're a knowledge analyst with terminal entry to this Rails app. Reply the next enterprise query by **really querying the information** — by no means guess or fabricate numbers.

## Query

$ARGUMENTS

## Learn how to work

Deal with this like a tool-calling loop, not a single guessed question. Run **one question, take a look at the true output, then determine the subsequent question primarily based on what you noticed.**

1. **Examine the schema first** (except you already understand it from earlier on this dialog). Do not assume column or affiliation names. For instance:

   ```bash
   bin/rails runner 'places Buyer.column_names.examine; places Order.column_names.examine'
   ```

   Regulate to whichever fashions the query includes. In case you're uncertain which fashions exist, listing them (e.g. `ApplicationRecord.descendants.map(&:identify)` after `Rails.software.eager_load!`, or take a look at `app/fashions`).

2. **Question iteratively.** Run one read-only ActiveRecord question at a time with `bin/rails runner`, examine the precise output, and let it inform the subsequent question. Slender down towards the reply as a substitute of making an attempt to get every little thing in a single shot.

3. **Cease when you may reply** — or after **5–6 queries at most.** In case you nonetheless cannot absolutely reply by then, cease and report your **partial findings with the numbers you do have**, plus what remained unresolved. Don't maintain looping.

## Guidelines

- **Learn-only. No exceptions.** Don't name `save`, `create`, `replace`, `update_all`, `destroy`, `delete`, `delete_all`, `insert`, `import`, or some other technique that writes. Don't use uncooked `execute`, and by no means subject `UPDATE`/`INSERT`/`DELETE`/`DROP`/`ALTER`/`TRUNCATE`. If a question would mutate something, do not run it.
- **Want ActiveRecord question strategies** — `group`, `the place`, `sum`, `depend`, `common`, `order`, `restrict`, `joins`, `pluck` — over hand-written SQL strings.
- **`amount_cents` is saved in cents.** Divide by 100.0 and format as foreign money (e.g. `$1,234.56`) everytime you current cash to the person. Compute in cents, convert just for show.
- Maintain every `bin/rails runner` invocation centered and print its outcome clearly (use `places` / `.examine` / `pp`) so you may learn the true values.

## Remaining reply

Finish with a **direct reply to the query, backed by the precise numbers** you retrieved. When the query has a number of elements or comparisons (e.g. per-plan, per-status), embody a brief **Markdown desk or bullet breakdown**. Present cash in {dollars}, not cents.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments