rails_api_base: Instructions file for Claude Code

CLAUDE.md

rails_api_base CLAUDE.md is an instructions file for Claude Code from rootstrap/rails_api_base. It costs 2,081 tokens per session, scanned A, original, MIT.

A starter project for building Rails applications that provide JSON web APIs, with an administration website included.

In plain words
What is it for?
Use it to bootstrap a new Rails API, run the application, test it, manage users and permissions, view API documentation, and operate admin tools.
Why use it?
It documents the setup commands, testing workflow, Docker behavior, and the main API and administration areas so changes can be made consistently.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is rootstrap/rails_api_base's own configuration. It tells Claude Code how to work on rails_api_base itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything rails_api_base configures →

Reuse

Borrowing it

Nothing to install: this file belongs to rootstrap/rails_api_base. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/rootstrap/rails_api_base/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/rootstrap/rails_api_base

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rails_api_base CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/rootstrap/rails_api_base/claude-md/github.svg)](https://agentmods.dev/instructions/rootstrap/rails_api_base/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/rootstrap/rails_api_base/claude-md"><img src="https://agentmods.dev/badge/instructions/rootstrap/rails_api_base/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rails_api_base CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/rootstrap/rails_api_base/claude-md"><img src="https://agentmods.dev/badge/instructions/rootstrap/rails_api_base/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,081 This file is loaded in full into every session.
When invoked 2,081 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02081 $0.02081
Opus 5.5 $0.00832 $0.00832
Sonnet 5.5 $0.00416 $0.00416
Haiku 4.5 $0.00208 $0.00208

Measured 2mo ago against content hash f62052b3efd0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rails_api_base CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 108 lines

How it starts

The opening of the file, as written. The whole thing — 108 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What this repo is

Rootstrap's Rails API template — a Rails 8.1 / Ruby 4.0 boilerplate for JSON APIs. It is meant to be cloned and renamed via bin/bootstrap.sh --name=<project>, which seds rails_api_base to your project name across the codebase. The template ships with two parallel surfaces:

  • A JSON API under /api/v1/* (devise_token_auth, Pundit, Jbuilder, OpenAPI docs).
  • An admin web surface built on ActiveAdmin at /admin/*, with sub-mounts for Flipper (/admin/feature-flags) and GoodJob (/admin/background-jobs).

Common commands

The bin/* wrappers transparently dispatch to Docker (docker compose) when DOCKER_ENABLED=true in .env, otherwise run locally. Use them rather than calling bundle/rails/rspec directly so the same invocation works in both modes.

  • bin/dev — start Rails + JS/CSS bundling watchers (foreman / Procfile.dev). Defaults to port 3000.
  • bin/rspec [path] — run specs. bin/rspec . runs everything. bin/rspec spec/path/to_spec.rb:42 runs a single example. Pass -rm / --remove-containers to tear down docker test services after the run.
  • bin/rails … — any Rails command (bin/rails console, bin/rails db:migrate, …).
  • bin/bundle … — bundler commands.
  • bin/web <cmd> — arbitrary shell command inside the app container/environment.
  • bundle exec rails code:analysis — runs the full lint suite: Brakeman, RuboCop, Reek, rails_best_practices, i18n-tasks (see lib/tasks/code_analysis.rake). Use this before opening a PR.
  • bundle exec annotaterb models — refresh schema annotations on models (config in .annotaterb.yml).
  • yarn build:js --watch / yarn build:css --watch — JS/CSS bundling for ActiveAdmin assets (already wired into bin/dev).

Testing notes

  • Specs require a running Postgres (see docker-compose.yml / docker-compose.test.yml). .env.test provides test DB config.
  • bin/rspec headed by default; set HEADLESS=true for headless feature specs.
  • spec/rails_helper.rb wires several behaviors that affect how to write specs:
    • Prosopite scans every example for N+1 queries — fix the query, don't silence it.
    • rspec-retry retries failed examples (2x in CI via ENV['CI'], 1x locally). Don't paper over flakes by adding retries.
    • SimpleCov is started before Rails loads; coverage lands in coverage/.
    • Flipper resets to a memory adapter before each test, so feature-flag state is per-example. Enable in a before block.
    • Files under spec/forms/ are auto-tagged type: :form and get Shoulda matchers.
    • Files under spec/requests/api/ are picked up by rspec-openapi for API doc generation; other request specs are tagged openapi: false.
  • OpenAPI doc generation is triggered by OPENAPI=1 (CI only on main / changes to spec/requests/api/**). Docs are served at /api-docs (basic auth: SWAGGER_USERNAME / SWAGGER_PASSWORD).

Read the full file on GitHub · 108 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 108 lines · 2,081 tokens per session scan A f62052b3efd0

Subscribe to this mod's changes

rails_api_base CLAUDE.md is an instructions file published in the GitHub repository rootstrap/rails_api_base (634 stars, last pushed 2d ago), licensed MIT. It adds 2,081 tokens to every session, about $0.0083 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

rails_api_base CLAUDE.md compared with instructions from other repositories

rails_api_base CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rails_api_base CLAUDE.mdrootstrap/rails_api_baseInstructions file6342d agoMITA2,081Claude Code
graftcode graftcode-ruby.instructions.mdgrft-dev/graftcodeInstructions file9671mo agononeA4,609GitHub Copilot
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot