derivation-flatten-array

derivation-flatten-array is a skill for Claude Code from estuary/agent-skills. It costs 127 tokens per session (2,942 once invoked), scanned A, original, Apache-2.0.

An Estuary data-pipeline guide for turning each element of a nested array into its own output document. For example, one order with several line items becomes several line-item documents.

In plain words
What is it for?
Use it to unpack order items, tags, categories, nested JSON arrays, or array columns into one-record-per-item data.
Why use it?
It converts nested data into separate records that databases and analytics tools can process more easily. This avoids keeping many items packed inside one document.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the estuary-derivations plugin — 8 skills shipped together

Good fit Use it to unpack order items, tags, categories, nested JSON arrays, or array columns into one-record-per-item data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/estuary/agent-skills/derivation-flatten-array
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add estuary/agent-skills --skill derivation-flatten-array
Clone the repo
git clone --depth 1 https://github.com/estuary/agent-skills

Made for: Claude Code.

Or install estuary-derivations, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for derivation-flatten-array

README.md
[![agentmods](https://agentmods.dev/badge/skills/estuary/agent-skills/derivation-flatten-array/github.svg)](https://agentmods.dev/skills/estuary/agent-skills/derivation-flatten-array)
Your own site
<a href="https://agentmods.dev/skills/estuary/agent-skills/derivation-flatten-array"><img src="https://agentmods.dev/badge/skills/estuary/agent-skills/derivation-flatten-array/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for derivation-flatten-array

Your own site · 80×15
<a href="https://agentmods.dev/skills/estuary/agent-skills/derivation-flatten-array"><img src="https://agentmods.dev/badge/skills/estuary/agent-skills/derivation-flatten-array.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,942 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00127 $0.02942
Opus 5.5 $0.00051 $0.01177
Sonnet 5.5 $0.00025 $0.00588
Haiku 4.5 $0.00013 $0.00294

Measured 2mo ago against content hash 7b8d1af9d549, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

derivation-flatten-array scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/derivation-flatten-array/SKILL.md · 243 lines

How it starts

The opening of the file, as written. The whole thing — 243 lines — stays where its author put it; the contents beside it link to each section on GitHub.

derivation-flatten-array

Stateless Estuary derivation that emits many output documents from a single source document by iterating over a nested array.

Prereq: read derivation-basics first for concepts, project layout, workflow, and language choice.

Docs: https://docs.estuary.dev/guides/flatten-array/ — the official TypeScript walkthrough for this exact pattern. Read it alongside this skill.

When to use this over alternatives

  • Normalising nested JSON: {order_id, line_items: [...]} → one doc per line item
  • Exploding tags/categories: {article_id, tags: ["a", "b", "c"]} → one doc per tag
  • Unpacking array columns from source databases for analytics
  • Preparing data for systems that prefer normalised 1-row-per-item tables

If the array isn't in the source document itself (e.g., you need to join across collections to assemble it), use derivation-join-collections. If you just need to keep the array intact but change how it's materialised (e.g., MongoDB flow_document), you don't need a derivation at all.

Orders arrive with an embedded array of line items. We emit one document per line item, carrying order context (customer, date) onto each row.

Project layout

my-derivation/
├── flow.yaml
├── schema.yaml
└── flatten.ts

schema.yaml

The output schema describes one line item — not the array:

type: object
properties:
  order_id:
    type: string
  line_id:
    type: string
  customer_id:
    type: string
  order_date:
    type: string
    format: date-time
  product_id:
    type: string
  product_name:
    type: string
  quantity:
    type: integer
  unit_price:
    type: number
  line_total:
    type: number
required: [order_id, line_id, product_id]

flow.yaml

collections:
  acmeCo/normalized/order-line-items:
    writeSchema: schema.yaml
    readSchema:
      allOf:
        - $ref: flow://write-schema
        - $ref: flow://inferred-schema
    key: [/order_id, /line_id]
    derive:
      using:
        typescript:
          module: flatten.ts
      transforms:
        - name: flattenLineItems
          source: acmeCo/production/orders
          shuffle: any

Read the full file on GitHub · 243 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 243 lines · 127 tokens per session scan A 7b8d1af9d549

Subscribe to this mod's changes

derivation-flatten-array is a skill published in the GitHub repository estuary/agent-skills (7 stars, last pushed 4d ago), licensed Apache-2.0. It adds 127 tokens to every session and 2,942 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

derivation-flatten-array compared with skills from other repositories

derivation-flatten-array next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
derivation-flatten-arrayestuary/agent-skillsSkill74d agoApache-2.0A127Claude Code
change-data-capture-adminBanibrataChatterjee/AwesomeSalesforceSkillsSkill46mo agoApache-2.0B50Claude Code, Codex
stream-processing-designerbookforge-ai/bookforge-skillsSkill426mo agoCC-BY-SA-4.0A240Claude Code
cocoindexcocoindex-io/cocoindexSkill12ktodayApache-2.0A88Claude Code, Codex
leaky-dataconfluentinc/agent-skillsSkill6412d agoApache-2.0A60Claude Code
confluent-cloud-flink-sqlconfluentinc/agent-skillsSkill6412d agoApache-2.0A234Claude Code
flink-udfconfluentinc/agent-skillsSkill6412d agoApache-2.0A189Claude Code