agentleFS
ethosagentethosagent/ethos/skills/document/export-csv/SKILL.md

export-csv

Skill22 starsChanged 8 days agoMITView on GitHub

Export tabular data as a well-formed CSV file. No installation required — uses write_file only. Always includes a header row, correctly quotes fields containing commas, double-quotes, or newlines, and writes UTF-8. Output is written to the working directory as <slug>.csv.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use \n (LF) as the line terminator.

    line 79
  2. Very specific:

    Use write_file to write the complete CSV content to a relative path, which resolves inside the working directory:

    line 83
  3. Very specific:

    Write the file as UTF-8. Do not add a BOM unless the user says they will open it in Excel on Windows (Excel sometimes needs a UTF-8 BOM to …

    line 91
  4. Distinctive:

    If the file has an unusual number of rows or columns, mention the count:

    line 99
  5. Distinctive:

    All generated files go to the working directory.

    line 114
  6. Distinctive:

    Always tell the user the exact output path after completion.

    line 115
  7. Very specific:

    Every field containing ,, ", or a newline must be wrapped in double-quotes.

    line 117
  8. Very specific:

    Every " inside a quoted field must be escaped as "".

    line 118

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Export CSV

Export tabular data as a well-formed CSV file. No installation required — uses write_file only. Output is written to the working directory as <slug>.csv. Always produces a header row and correctly escapes all field values.

When to use this skill

  • User asks to export data as CSV, save a table as CSV, or download rows as a CSV file.
  • User says "give me a CSV", "export this as CSV", "save this table to a file I can open in Excel".
  • The data is tabular and the user doesn't need formatting or formulas — just the data.

When NOT to use this skill

  • User needs formulas, multiple sheets, or formatted cells — use export-excel.
  • User wants a PDF or HTML report — use make-pdf or make-html-report.
  • The data is not tabular (free-form text, nested structures).

CSV escaping rules

Apply these rules to every field before writing:

ConditionRule
Field contains a comma (,)Wrap the entire field in double-quotes: hello, world → "hello, world"
Field contains a double-quote (")Wrap in double-quotes AND escape each inner " by doubling it: say "hi" → "say ""hi"""
Field contains a newline (\n or \r\n)Wrap the entire field in double-quotes
Field contains none of the aboveWrite as-is — no quotes needed
Field is emptyWrite as empty string (two consecutive commas: ,,) — do NOT write null or undefined
Field is a numberWrite as-is — no quotes
Field is a dateWrite in ISO 8601 format: YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss

The first row is always the header row. Headers follow the same escaping rules.

Examples:

name,age,city,notes
Alice,30,New York,"Joined in 2024, active user"
Bob,25,London,"Said ""hello"" on first call"
Carol,28,Paris,

In the above:

  • "Joined in 2024, active user" is quoted because it contains a comma.
  • "Said ""hello"" on first call" is quoted and the inner quotes are doubled.
  • Carol's notes field is empty — just an empty string at end of line.

Workflow

Step 1: Format the data as CSV text

From the user's data:

  1. Identify all columns — these become the header row.
  2. Apply escaping rules (table above) to every field value.
  3. Assemble rows, one per line, fields separated by ,.
  4. The first line is always the header.
  5. Use \n (LF) as the line terminator. Do not use \r\n unless the user specifically requests Windows line endings.

Step 2: Write to file

Use write_file to write the complete CSV content to a relative path, which resolves inside the working directory:

<slug>.csv

Where <slug> is a lowercase-hyphenated identifier derived from the data or user's request (e.g. user-list-2026-06, product-inventory, q2-transactions).

Write the file as UTF-8. Do not add a BOM unless the user says they will open it in Excel on Windows (Excel sometimes needs a UTF-8 BOM to detect encoding:  prepended to the content).

Step 3: Confirm to the user

Tell the user:

"CSV exported to: <slug>.csv in the working directory — visible in the Documents tab."

If the file has an unusual number of rows or columns, mention the count:

"CSV exported to: <slug>.csv in the working directory — 3 columns, 42 rows (plus header)."

Anti-patterns

  • Do not omit the header row — a CSV without headers is not useful to most consumers.
  • Do not use single quotes for quoting fields — RFC 4180 specifies double-quotes only.
  • Do not write null, undefined, or N/A for empty fields unless the user explicitly asks — use an empty string.
  • Do not add trailing commas at the end of rows.
  • Do not write a BOM by default — only add it if the user says they need Excel on Windows compatibility.
  • Do not add extra whitespace around commas — Alice, 30 is two different values from Alice,30.

Hard rules

  • All generated files go to the working directory. Always write a relative path — never write outside the working directory.
  • Always tell the user the exact output path after completion.
  • The first row must always be the header row.
  • Every field containing ,, ", or a newline must be wrapped in double-quotes.
  • Every " inside a quoted field must be escaped as "".
  • The slug must be lowercase, hyphen-separated, and contain no spaces or special characters.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.