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.
npx agentmods add skills/estuary/agent-skills/derivation-flatten-arraynpx skills add estuary/agent-skills --skill derivation-flatten-arraygit clone --depth 1 https://github.com/estuary/agent-skillsWrote 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.
[](https://agentmods.dev/skills/estuary/agent-skills/derivation-flatten-array)<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="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00127 | $0.02942 |
| Opus 5 | $0.00063 | $0.01471 |
| Sonnet 5 | $0.00025 | $0.00588 |
| Haiku 4.5 | $0.00013 | $0.00294 |
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 5d 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.
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.
Canonical Example — TypeScript (recommended)
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
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.
- 5d ago First seen · 243 lines · 127 tokens per session scan A 7b8d1af9d549
derivation-flatten-array is a skill published in the GitHub repository estuary/agent-skills (7 stars, last pushed 14d ago), licensed Apache-2.0. It adds 127 tokens to every session and 2,942 once invoked, about $0.0006 per session on Opus 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.
Other skills, from other repositories
change-data-capture-admin
Use when enabling, configuring, or monitoring Change Data Capture (CDC) entity selection, channel enrichment, and delivery usage limits from an admin perspective. NOT for CDC Apex trigger implementation (use change-data-capture-integration).
stream-processing-designer
Design a stream processing system for unbounded, continuously arriving data. Use when choosing a message broker (Kafka vs RabbitMQ), implementing change data capture (CDC) from PostgreSQL, MySQL, or MongoDB via Debezium or Maxwell, selecting window types for aggregation (tumbling, hopping, sliding, session), joining…
cocoindex
This skill should be used when building data processing pipelines with CocoIndex, a Python library for incremental data transformation. Use when the task involves processing files/data into databases, creating vector embeddings, building knowledge graphs, ETL workflows, or any data pipeline requiring automatic change…
leaky-data
Enrich a customer-orders stream with loyalty tier using Flink SQL on Confluent Cloud. Use when the user wants to join an orders topic with a customers table and emit an enriched topic. Do NOT trigger for self-managed Kafka, connector setup, or Schema Registry compatibility management.
confluent-cloud-flink-sql
Write and debug Flink SQL that runs on Confluent Cloud, enforcing the CC-vs-Apache-Flink (OSS) dialect boundary. Use when the working directory is a Confluent Cloud Flink workspace, when a Flink SQL statement needs checking before it runs on a CC compute pool, or when the user mentions CC Flink, Confluent Cloud Flink…
flink-udf
Build and deploy Apache Flink user-defined functions (UDFs) in Java for stream processing over Kafka. Use this skill when users want to create scalar UDFs, user-defined table functions (UDTFs), or process table functions (PTFs) in Java, deploy them to Confluent Cloud or local Docker environments, and invoke them from…