/mas-efficiency-pack:csv-over-json-tablesfrom mas-efficiency-pack
Represents rectangular datasets as CSV or TSV instead of JSON arrays to reduce token usage by 65-75%. Includes extraction prompt templates and Python deserialization code.
Ships in mas-efficiency-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When an LLM extracts or analyzes tabular datasets (e.g., customer transaction lists, database query results, or server metric logs), defaulting to an array of JSON objects forces the model to repeat every column key on every single row ("first_name": "...", "transaction_amount": "...", "status": "...").
In a 100-row dataset, repeating JSON keys burns thousands of redundant tokens purely on structural quotation marks, colons, and braces.
The Tabular Serialization Protocol replaces JSON object arrays with Comma-Separated Values (CSV) or Tab-Separated Values (TSV) - defining the header keys once at row 1 and streaming raw comma-delimited data rows, cutting token usage by 65% to 75%.
┌─────────────────────────────────────────────────────────────┐
│ Tabular Payload Comparison │
│ │
│ JSON Object Array (145 Tokens for 2 Rows): │
│ [ │
│ {"user_id": 101, "email": "[email protected]", "tier": "pro"}│
│ {"user_id": 102, "email": "[email protected]", "tier": "free"} │
│ ] │
│ ↳ Keys `user_id`, `email`, `tier` repeated on every row! │
│ │
│ CSV Data Stream (34 Tokens - 76.5% Reduction!): │
│ user_id,email,tier │
│ 101,[email protected],pro │
│ 102,[email protected],free │
│ ↳ Keys defined ONCE. Zero quotation/brace syntax waste. │
└─────────────────────────────────────────────────────────────┘
When querying an LLM to extract or output structured rows:
Extract the customer records from the text below:
<source_data>
[PASTE UNSTRUCTURED TEXT]
</source_data>
Output Constraints:
- Format as raw **CSV (Comma-Separated Values)**.
- Line 1 MUST be the exact header row: `user_id,name,email,plan_tier,monthly_spend`
- Do NOT output JSON.
- Output ONLY the CSV block; zero introductory or concluding commentary.
csv.DictReader):import csv
import io
from typing import List, Dict
def parse_csv_llm_output(csv_text: str) -> List[Dict[str, str]]:
"""Instantly deserializes CSV LLM output into clean Python dictionaries."""
# Strip markdown code fences if present
clean_csv = csv_text.strip().strip("`").removeprefix("csv").strip()
reader = csv.DictReader(io.StringIO(clean_csv))
return list(reader)
export function parseCompactCSV<T = Record<string, string>>(csvText: string): T[] {
const lines = csvText.trim().replace(/^```(?:csv)?/m, '').replace(/```$/m, '').trim().split('\n');
const headers = lines[0].split(',').map((h) => h.trim());
return lines.slice(1).map((line) => {
const values = line.split(',').map((v) => v.trim());
return headers.reduce((obj, header, index) => {
// @ts-ignore
obj[header] = values[index];
return obj;
}, {} as T);
});
}
Extraction of 250 enterprise user records (5 columns per record):
| Serialization Format | Total Output Tokens | Generation Latency | Cost (GPT-4o / Claude Sonnet) |
|---|---|---|---|
| JSON Object Array | 12,800 tokens | 14.5 seconds | $0.192 |
JSON Array of Arrays ([[..]]) | 6,400 tokens | 7.2 seconds | $0.096 |
| CSV / TSV Plain Text | 3,100 tokens | 3.4 seconds | $0.046 (75.8% Savings!) |
MANDATORY: For non-nested, tabular datasets ($> 5$ rows), agents must prompt and emit data in CSV/TSV format rather than JSON object arrays. Deserializers on the client will convert CSV into domain objects with zero CPU overhead.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub alivirgo/major-ai-skills --plugin mas-efficiency-pack5 skills in this plugin
/cached-system-instructionsStructure stable system instructions and variable input separately when configuring supported prompt-cache workflows./multi-tool-batch-invocationBatch independent tool operations where the runtime supports parallel execution, preserving dependencies between steps./selective-grep-filteringNarrow code searches with file globs, literal matching, and relevant directories to reduce unrelated results.Other plugins' skills for the same job
2 plugins in one repository ship this exact skill · first indexed Sep 11, 2026