data-attribution — Claude Code prompt: what it does, how to install
The data-attribution prompt for Claude Code defines how to cite external sources in spreadsheets, using a Source column, a footer block, or a separate Sources sheet.
Apache-2.0 ★ 12,746 updated 2026-10-29
.claude/commands/data-attribution.mdWhat data-attribution does
The prompt enforces strict provenance rules whenever an agent populates sheets from web searches, scraping runs, SEC filings, or third-party APIs. Fabricating numbers is barred: factual cells require verifiable proof. In contrast, formula-derived metrics and direct user uploads do not require citation tags.
Three concrete presentation layouts are defined. For line-by-line differences, it appends a dedicated Source column on the right. For tables sharing references, it inserts a formatted footer block below an empty row. When handling extensive source lists, it directs the agent to generate a separate Sources tab tracking the data point, source name, URL, and retrieval date.
Mutations rely on set_cell, set_hyperlink, format_range, and structural add_sheet calls. Bare domain URLs automatically receive an https:// prefix, while cross-sheet references must adhere to the Sheet!A1 syntax.
What it helps with
- append verifiable web citations to spreadsheet rows
- generate a standalone Sources tab for data audits
- format citation footers under shared data tables
Example prompts for the agent
- Populate this revenue table from SEC filings and add a Source column on the right
- Insert scraped industry metrics and list the citation links in a footer row
- Set up a dedicated Sources worksheet logging the metric, URL, and retrieval date
How to install data-attribution
Manually: put the files in place
.claude/commands/data-attribution.mdHow to use
Paste the text at the start of a chat or into project instructions
Questions about data-attribution
How to install data-attribution in Claude Code?
Place the prompt file at .claude/commands/data-attribution.md within your project repository.
What does data-attribution do?
It guides the agent to format traceable citations in spreadsheets using set_cell, set_hyperlink, and format_range.
Does data-attribution require citing calculated values?
No, derived fields computed via formulas require methodology notes rather than external source tracking.
Source text
data-attribution.md · Apache-2.0
# Data source attribution guide (data-attribution)
When filling a sheet with external data (web search, scraping, APIs, etc.), you must leave traceable source citations. Implement them with `set_hyperlink` + `set_cell` + `format_range`.
## When attribution is required
| Data type | Required? | Recommended method |
|---|---|---|
| Financial data (SEC, earnings reports) | Required | Footer row or a dedicated Sources sheet |
| Web search results | Required | Source column |
| Data uploaded by the user | Not needed | — |
| Values derived by formulas/calculation | Not needed | — |
| Common knowledge (dates, unit conversions) | Not needed | — |
## Method 1: Source column
Add a "Source" column to the right of the data, with a hyperlink to the original data on each row. Suited to cases where each row has a different source.
```json
[
{"op":"set_cell","sheetId":"s1","address":"G1","value":"Source"},
{"op":"format_range","sheetId":"s1","range":"G1","format":{"bold":true}},
{"op":"set_cell","sheetId":"s1","address":"G2","value":"SEC 10-K FY2024"},
{"op":"set_hyperlink","sheetId":"s1","address":"G2","target":"https://sec.gov/..."},
{"op":"format_range","sheetId":"s1","range":"G2:G20","format":{"fontColor":"#0563C1"}}
]
```
## Method 2: Footer source rows
Leave one blank row below the table, then write a "Sources:" section with one hyperlinked source per row. Suited to a whole table sharing a few common sources.
```json
[
{"op":"set_cell","sheetId":"s1","address":"A23","value":"Sources:"},
{"op":"format_range","sheetId":"s1","range":"A23","format":{"bold":true,"italic":true,"fontColor":"#666666"}},
{"op":"set_cell","sheetId":"s1","address":"A24","value":"SEC EDGAR - NVIDIA 10-K FY2024"},
{"op":"set_hyperlink","sheetId":"s1","address":"A24","target":"https://sec.gov/..."},
{"op":"format_range","sheetId":"s1","range":"A24:A26","format":{"italic":true,"fontColor":"#0563C1"}}
]
```
## Method 3: Dedicated Sources sheet
When there are many sources and full traceability is needed, create a new "Sources" worksheet (structural operation, separate batch) with columns: Data point / Source / URL / Retrieved date.
```json
[
{"op":"add_sheet","name":"Sources"}
]
```
After it applies, write into the new sheet:
```json
[
{"op":"set_range","sheetId":"sSources","range":"A1:D1","values":[["Data point","Source","URL","Retrieved"]]},
{"op":"format_range","sheetId":"sSources","range":"A1:D1","format":{"bold":true,"fillColor":"#F2F2F2"}},
{"op":"set_range","sheetId":"sSources","range":"A2:D2","values":[["FY2024 revenue","SEC 10-K","https://sec.gov/...","2026-07-24"]]},
{"op":"set_hyperlink","sheetId":"sSources","address":"C2","target":"https://sec.gov/..."}
]
```
## Discipline
- **Never fabricate data**: every factual cell needs a source (user-provided / already in the sheet / read via tools); attribution makes the source verifiable.
- Derived values are computed with formulas and their methodology explained — they do not need source tracing.
- When a hyperlink target is a bare domain the system prepends `https://` automatically; use "Sheet!A1" for in-workbook references.
© genspark-ai · Apache-2.0 · genspark-ai/genoffice