
CLAUDE.md is great for code rules. It breaks on data questions.
CLAUDE.md is a Markdown file at the root of a repository. Claude Code loads it on the first turn of every conversation. It is the place teams encode the things they would otherwise say out loud to a new contributor: "we use pnpm, never npm", "API routes live under apps/api/src/routes", "prefer named exports".
The job CLAUDE.md does is configuration of agent behavior. It does not, and should not, contain the answers to data questions. It contains the rules the agent should follow when answering anything.
Same idea, other vendors: AGENTS.md is the file OpenAI Codex reads. The convention is shared. What each vendor's agent does with the file is that vendor's call, so read their docs before assuming identical behavior.
The file that holds the SQL your team actually trusts
CHION.md is the skills-and-truth half of the pair: a compiled bundle of your team's saved and reviewed PostgreSQL queries, with a shared-rules header (the canonical revenue definition, the active-customer rule, the timezone convention) that every query inherits. Where CLAUDE.md tells the agent how to behave, CHION.md tells it which SQL the business has already agreed on. It is a contract, not a prompt: the answer is the query finance already signed off on.
The full anatomy (the root header, the per-query SKILL.md files, and the Postgres-grounded refresh model) lives in the CHION.md spec.
Behavior rules vs saved and reviewed SQL: which file owns what
The clearest way to see the difference is to put the two files in adjacent columns and read across each row.
| Facet | CLAUDE.md | CHION.md |
|---|---|---|
| Scope | Repo-wide. One file at the root that every Claude Code conversation loads first. | A bundle of saved and reviewed SQL skills. One SKILL.md per query your team already trusts, plus a shared CHION.md header. |
| Owner | You (or your engineering team). Hand-edited. Lives next to your source code. | Compiled by Chion from queries saved and reviewed in the workspace. Re-emitted every refresh. |
| What it contains | Agent behavior, conventions, project context: "use pnpm", "the API is in /api", "prefer named exports". | A portable SKILL.md per saved and reviewed query: name, a description carrying the trigger vocabulary, the actual SQL, and a short why. |
| Lifecycle | Edited by humans, committed to git, changes when the project changes. | Generated, versioned, supersedable. New saved and reviewed query in Chion equals a new SKILL.md on next export. |
| Filename convention | CLAUDE.md at repo root, or ~/.claude/CLAUDE.md for rules you want in every repo. AGENTS.md is the file Codex reads for the same purpose. | CHION.md and CONNECT.md at the root of the exported bundle, with a SKILL.md under skills/<role>/. |
| When the SQL is wrong, you fix it... | By rewriting the SQL the agent generated. | By saving and reviewing a corrected query inside Chion. The SKILL.md export updates on next refresh. |
Notice that no row contains overlap. The two files answer different questions, which is why teams who adopt both stop arguing about whether the agent or the data is wrong, and start fixing whichever one actually is.
Using CLAUDE.md and CHION.md together
At runtime, the two files run a tiny relay. CLAUDE.md goes first, because it is loaded before the conversation begins. It teaches the agent your conventions and tells it where to look when a data question appears: "if the user asks about revenue, MRR, or churn, route to the relevant SKILL.md under skills/finance".
When the data question arrives, the agent resolves the matching SKILL.md from the CHION.md bundle. That SKILL.md carries a saved and reviewed SELECT rather than a description of one, so the agent has a reviewed query to run instead of a blank page. What the runtime does with it is the runtime's behavior, not a Chion guarantee.
CLAUDE.md
Directs the agent. Conventions, routing rules, project context.
CHION.md + SKILL.md
Supplies the saved and reviewed SQL the agent runs. One SKILL.md per saved and reviewed query.
Trusted answer
Behavior plus truth. The agent acts your way and runs your SQL.
For more on how skills get authored on the Claude side of that relay, the claude code skills practical guide walks the SKILL.md authoring convention in depth. This page stays on the file contract itself.
Why a CLAUDE.md alone can't answer "what is MRR"
CLAUDE.md points at the answer; CHION.md holds it.
CLAUDE.md works beautifully for code. "Use pnpm, prefer named exports, the API lives under apps/api." These are rules a single contributor can write down and the whole team agrees on. SQL is different. The SQL that answers "what is MRR" depends on whether you count annualized contracts, whether refunds inside the period are subtracted, and which timezone the billing day rolls in. Two well-meaning engineers will write two different queries, and both will look correct.
That is the gap CHION.md fills. It is not a second behavior file; it is the place the business writes down which SQL is the answer. A CLAUDE.md telling Claude to "use the team's revenue definition" is a wish. A CHION.md bundle that ships a saved and reviewed mrr-by-plan/SKILL.md is the definition. The agent stops guessing and starts executing what your finance team already signed off on.
The agent stops guessing and starts executing what your finance team already signed off on.
This is also why CLAUDE.md for SQL alone is incomplete. A CLAUDE.md can route to SQL skills, but it cannot contain them at scale without becoming an unreviewable wall of queries. CHION.md is the file format that lets the SQL live next to the rest of your skills: one SKILL.md per saved and reviewed query, refreshable from your Chion workspace. You can auto-generate SQL skills from a plain-English question, then save the ones your team trusts.
Export saved and reviewed SQL once, run it in Claude Code or Codex
SKILL.md export is the operational verb that turns a workspace of saved and reviewed queries into a folder you can commit. It is intentionally short: four steps, the same every time.
Save a reviewed query
In Chion Studio, run a question, read the code-validated SELECT, then save it. Saving is the act of declaring that this query is the answer the team stands behind.
Export the bundle
From Skills, run Export. You get a folder: CHION.md and CONNECT.md at the root and one SKILL.md for the role you exported under skills/; your CLAUDE.md stays the file you maintain.
Drop it into your repo
Commit the folder. Claude Code reads CLAUDE.md for your behavior rules and loads a SKILL.md body when a prompt matches its description; Codex reads AGENTS.md. Check each runtime's documented discovery path once, then the routing is the same idea everywhere: behavior rules first, saved and reviewed SQL second.
Re-export when the database changes
Schema drift is solved by re-running export. The portable SKILL.md set is overwritten in place. Your CLAUDE.md never moves; the two files have separate jobs.
Here is what one of the resulting files looks like. Keep this minimal. A real export contains one file per saved and reviewed query, but the shape is the same.
---
name: monthly-recurring-revenue-by-plan
description: Use when asked for MRR, ARR, recurring revenue, or subscription revenue split by plan on the production Postgres warehouse.
license: Proprietary
metadata:
generator: chion.ai
source: chion://verified-queries/finance/mrr-by-plan
verified_at: 2026-05-22
---
# MRR by plan (verified)
Returns monthly recurring revenue grouped by plan_id for the
trailing 13 months. Uses the finance team's canonical revenue
rule from CHION.md (active subscriptions only, excludes refunds
inside the period).
```sql
SELECT date_trunc('month', billed_at) AS month,
plan_id,
SUM(amount_cents) / 100.0 AS mrr
FROM billing.invoice_line_items
WHERE status = 'paid'
AND billed_at >= now() - interval '13 months'
GROUP BY 1, 2
ORDER BY 1, 2;
```The frontmatter is the contract. The body is human-readable context. The SQL block is the saved and reviewed query Chion will keep in sync on every refresh. That is what a portable SKILL.md buys you: one file to move between Claude Code and Codex rather than two to maintain, with each runtime's discovery path still its own. Inside Chion the query runs as a read-only SELECT, capped at 1,000 rows, against credentials held in an AES-256-GCM vault, and the run is written to the security audit log.
The full anatomy of the CHION.md root header (including the shared rule layer and the saved and reviewed query index) lives on the CHION.md reference page.
Quick reference
- CLAUDE.md = agent behavior file. Hand-authored. One per repo.
- CHION.md = saved SQL skills bundle. Compiled from your saved and reviewed queries.
- SKILL.md = the open file format inside the CHION.md bundle. One per query.
- SKILL.md export emits CHION.md, CONNECT.md, and one SKILL.md for the role you exported.
- The two files do not overlap. CLAUDE.md says how to act. CHION.md says what is true. A CLAUDE.md SQL file is really both: CLAUDE.md routes the question, CHION.md holds the SQL.
- SQL skills export means: take the queries your team already trusts, package them as SKILL.md, ship them with your repo.
- Postgres Claude skills and SQL skills for Claude are the same SKILL.md format; the label refers to which database they were grounded in.
Frequently asked
What is CLAUDE.md, in one sentence?
CLAUDE.md is a Markdown file at the root of a repository that Claude Code reads on every conversation to learn the project conventions and how the agent should behave inside it.
What is CHION.md, in one sentence?
CHION.md is the root header of a packaged SQL skills bundle Chion exports from your saved and reviewed queries; it travels with a set of SKILL.md files that contain the actual saved and reviewed SQL.
Do I need both files?
Yes if you want both halves of the contract. CLAUDE.md tells the agent how to behave in your repo. CHION.md plus its SKILL.md files tell the agent which SQL it is allowed to trust. They do not overlap; they compose.
Is SKILL.md a Chion format or an open one?
SKILL.md is the open agent-skill convention used by Claude Code and others. Chion writes portable SKILL.md files that conform to that convention so the same bytes work in Claude and Codex without modification.
Where does the SQL inside a SKILL.md come from?
From queries your team has explicitly saved and reviewed inside Chion. The SKILL.md is a packaging of that query plus its metadata. No model writes the SQL into the file. The saved and reviewed query is the source of truth.
What about CLAUDE.md vs AGENTS.md?
Same idea, different vendor filenames: Claude Code reads CLAUDE.md, OpenAI Codex reads AGENTS.md. Each vendor decides what its own file does, so treat them as siblings rather than as one file with two names. The Chion export writes both so you do not have to pick.
Does the export include Postgres claude skills specifically?
Yes. Because the saved and reviewed queries originate from a connected Postgres database, every SKILL.md in the bundle is grounded in real Postgres column names, types, and joins. These are Postgres Claude skills because the schema they compile against is your own, not because of a label.
What is CLAUDE.md used for?
CLAUDE.md is the configuration file Claude Code reads at the start of every conversation in a repository. Teams use it to encode conventions ("use pnpm", "API routes live under apps/api/src/routes"), routing rules (which folders mean what), and project context the agent would otherwise have to guess at. It is the closest thing to a README written specifically for an agent.
How do I use CLAUDE.md in my repo?
Create a file named CLAUDE.md at the root of the repository, write the rules in plain Markdown (conventions, allowed tools, routing hints), and commit it. Claude Code loads it automatically on the first turn of every conversation in that repo. For SQL specifically, add a one-line routing rule like "for data questions, look under skills/" and pair it with a CHION.md bundle.
Can I put SQL inside CLAUDE.md?
You can, but it stops scaling fast. CLAUDE.md is hand-edited and reviewed in pull requests, so dropping every saved and reviewed team query into it turns it into an unreviewable wall. The cleaner pattern is CLAUDE.md for SQL at the routing layer only: CLAUDE.md says "for revenue questions, read finance/SKILL.md", and the actual SQL lives in the CHION.md-managed SKILL.md files.
Can a CLAUDE.md be used for SQL injection?
A CLAUDE.md is instructions, so poisoned instructions are a real risk. Chion limits the blast radius because the SQL that runs is a frozen, read-only SELECT, not text the file injects. See the prompt-injection defense guide for the full mechanism.
Give your CLAUDE.md a set of saved SQL skills
Connect a read-only Postgres role, save a query you already trust, and run SKILL.md export. The bundle drops into the same repo as your CLAUDE.md.