08_csv_transform — Claude Code prompt: what it does, how to install
08_csv_transform aggregates tabular order entries into customer spending totals and returns raw CSV without conversational filler.
MIT ★ 2,744 updated 2026-10-08
.claude/commands/08_csv_transform.mdWhat 08_csv_transform does
The prompt structures and summarizes transaction data. Given a source CSV containing order_id, customer, and amount_cents, it groups rows by buyer, sums their spending, divides the cents by 100, and rounds the resulting total_usd to two decimal places.
The final table begins with the header customer,total_usd and is ordered by total_usd descending. The prompt explicitly blocks backtick fences, introductory remarks, and trailing explanations. Emitting Markdown code tags causes pipeline failures when standard parsers read raw standard output, which makes the strict format directive necessary.
A built-in Python test function inspects the final output: it rejects phrases starting with greeting words or code ticks, parses the stream via the standard csv module, and confirms that column values match floating-point definitions.
What it helps with
- aggregate order lines into customer totals
- convert transaction cents into rounded dollar figures
- generate raw CSV output without code fences or polite greetings
- order final summary records descending by customer spend
Example prompts for the agent
- Transform this transaction CSV using the rules in
08_csv_transform - Summarize customer spending from this table and return CSV only
- Calculate
total_usdby buyer and sort the records descending
How to install 08_csv_transform
Manually: put the files in place
.claude/commands/08_csv_transform.mdHow to use
Paste the text at the start of a chat or into project instructions
Questions about 08_csv_transform
How to install 08_csv_transform in Claude Code?
Add the prompt file to your repository at .claude/commands/08_csv_transform.md.
What does 08_csv_transform do?
It processes raw CSV order records, calculates total dollar amounts grouped by customer, sorts them by spend, and outputs clean CSV text without conversational notes.
Why does the prompt ban Markdown code blocks?
It enforces strict raw text output so the output stream can be fed directly to another CSV parser without manual cleanup.
Source text
08_csv_transform.md · MIT
---
name: csv_transform
content_shape: structured-csv
reference_tokens_per_char: 0.38
description: Transform a CSV and output CSV only, with no prose preamble.
---
[session-metrics:compare-suite:v2:prompt=csv_transform]
Take the CSV below and output a new CSV with two columns: `customer` and `total_usd`. `total_usd` is `sum(amount_cents) / 100` rounded to 2 decimals for each customer. The first row must be the header `customer,total_usd`. Sort by `total_usd` descending. Output ONLY CSV — no code fences, no preamble, no trailing commentary.
---
```
order_id,customer,amount_cents
1001,acme,1299
1002,beta,499
1003,acme,2000
1004,gamma,350
1005,beta,1299
1006,acme,750
1007,gamma,2000
```
<!-- PREDICATE -->
````python
def check(text: str) -> bool:
import csv as _csv, io as _io
s = text.strip()
# Reject common preamble patterns.
lower = s.lower()
for pre in ("here", "sure", "i'll", "certainly", "```"):
if lower.startswith(pre):
return False
try:
rows = list(_csv.reader(_io.StringIO(s)))
except Exception:
return False
if not rows or rows[0] != ["customer", "total_usd"]:
return False
# Each data row: two columns, second parses as float.
for r in rows[1:]:
if len(r) != 2: return False
try: float(r[1])
except ValueError: return False
return len(rows) >= 2
````
© centminmod · MIT · centminmod/my-claude-code-setup