Works with Apache Avro data serialization: schema authoring, avro-tools conversion, Python avro library usage, and schema evolution.
Agentic Workflow: Read -> Reason -> Act (avro)
You are Avro (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for avro
- Domain: Works with Apache Avro data serialization: schema authoring, avro-tools conversion, Python avro library usage, and schema evolution.
- avro-tools: Convert, inspect, and manipulate Avro data files. —
java -jar avro-tools.jar getmeta file.avro
- python-avro: Serialize and deserialize Avro with the Python library. —
pip install avro
- schema-evolution: Test schema resolution between writer and reader schemas. —
java -jar avro-tools.jar --version
- Check
knowledge and prerequisites: java, pip, python
2. Reason — think for avro
- For
avro-tools: Convert, inspect, and manipulate Avro data files. — decide which checks to run
- For
python-avro: Serialize and deserialize Avro with the Python library. — decide which checks to run
- For
schema-evolution: Test schema resolution between writer and reader schemas. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with avro tools
- Tools:
Glob, Grep, Read, Java, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
avro:091cb949
Avro
What this skill does
Works with Apache Avro serialization: writing schemas, converting data with avro-tools, reading/writing data files in Python, and testing schema evolution (resolution) between writer and reader schemas.
When to use
- Serializing records for Kafka or data lakes (compact, typed, evolvable)
- Converting JSON lines to Avro for storage efficiency
- Verifying a schema change is backward compatible
Real commands
# Inspect metadata
java -jar avro-tools.jar getmeta events.avro
# Convert Avro to JSON
java -jar avro-tools.jar tojson events.avro | head -5
# JSON to Avro
java -jar avro-tools.jar fromjson data.json --schema-file schema.avsc
# Generate sample data
java -jar avro-tools.jar random --schema-file user.avsc --count 100 sample.avro
# Python
pip install avro
python -c "import avro.schema; s=avro.schema.parse(open('user.avsc').read()); print(s.fullname)"
Schema example
{
"type": "record",
"name": "User",
"namespace": "com.example",
"fields": [
{"name": "id", "type": "long"},
{"name": "email", "type": "string"}
]
}
Schema evolution
- Adding a field with a default is backward compatible
- Test resolution:
avro-tools tojson --schema-file reader_v2.avsc writer_v1.avro
Testing
- Round-trip: fromjson then tojson should reproduce input
- Run evolution checks in CI with both schema versions
Best practices
- Never remove fields without defaults unless coordinated
- Store the writer schema in the .avro container header
- Use Avro IDs in a schema registry for Kafka payloads
Capabilities
avro-tools
Convert, inspect, and manipulate Avro data files.
Parameters:
schema_file (string): Avro schema .avsc file
count (number): Number of records for random generation
Commands:
java -jar avro-tools.jar getmeta file.avro
java -jar avro-tools.jar tojson file.avro
java -jar avro-tools.jar fromjson data.json --schema-file schema.avsc
java -jar avro-tools.jar cat file.avro
java -jar avro-tools.jar random --schema-file schema.avsc --count 10 test.avro
Examples:
- java -jar avro-tools.jar tojson events.avro | head -5
- java -jar avro-tools.jar getmeta events.avro | head -20
- java -jar avro-tools.jar random --schema-file user.avsc --count 100 sample.avro
python-avro
Serialize and deserialize Avro with the Python library.
Parameters:
schema (string): Avro schema JSON
file (string): .avro data file to read/write
Commands:
pip install avro
python -c "import avro; print(avro.__version__)"
python -c "from avro.datafile import DataFileWriter; from avro.io import DatumWriter; print('ok')"
python -m avro
Examples:
- python -c "import avro.schema; s=avro.schema.parse(open('user.avsc').read()); print(s.fullname)"
- python -c "from avro import schema; print(schema.parse('"string"').fullname)"
- python -c "import avro.datafile as d; print([x for x in dir(d) if 'Writer' in x or 'Reader' in x])"
schema-evolution
Test schema resolution between writer and reader schemas.
Parameters:
writer_schema (string): Original schema used at write time
reader_schema (string): New schema for reading
Commands:
java -jar avro-tools.jar --version
java -jar avro-tools.jar tojson --schema-file reader.avsc writer.avro
python -c "import avro.io as io; print([x for x in dir(io) if 'Reader' in x])"
java -jar avro-tools.jar compile schema schema.avsc /tmp/out
Examples:
- java -jar avro-tools.jar tojson --schema-file reader_v2.avsc writer_v1.avro | head -3
- python -c "from avro.io import DatumReader; r=DatumReader(reader_schema, writer_schema); print('resolution ready')"
- java -jar avro-tools.jar compile schema v2.avsc gen/
References
1---2name: "avro"3description: "Works with Apache Avro data serialization: schema authoring, avro-tools conversion, Python avro library usage, and schema evolution. Use when working with avro tools, python avro, schema evolution, api or when the user mentions avro tools, python avro, schema evolution, api."4license: "MIT"5compatibility: "Requires java, pip, python."6metadata:7 source: https://skillmd.com/skills/opknock/avro8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(java:*) Bash(pip:*) Bash(python:*)"12---1314Works with Apache Avro data serialization: schema authoring, avro-tools conversion, Python avro library usage, and schema evolution.1516## Agentic Workflow: Read -> Reason -> Act (avro)1718You are **Avro** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `avro`21- Domain: Works with Apache Avro data serialization: schema authoring, avro-tools conversion, Python avro library usage, and schema evolution.22- **avro-tools**: Convert, inspect, and manipulate Avro data files. — `java -jar avro-tools.jar getmeta file.avro`23- **python-avro**: Serialize and deserialize Avro with the Python library. — `pip install avro`24- **schema-evolution**: Test schema resolution between writer and reader schemas. — `java -jar avro-tools.jar --version`25- Check `knowledge` and `prerequisites: java, pip, python`2627### 2. Reason — think for `avro`28- For `avro-tools`: Convert, inspect, and manipulate Avro data files. — decide which checks to run29- For `python-avro`: Serialize and deserialize Avro with the Python library. — decide which checks to run30- For `schema-evolution`: Test schema resolution between writer and reader schemas. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `avro` tools34- Tools: `Glob`, `Grep`, `Read`, `Java`, `Bash` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `avro:091cb949`3738# Avro3940## What this skill does4142Works with Apache Avro serialization: writing schemas, converting data with avro-tools, reading/writing data files in Python, and testing schema evolution (resolution) between writer and reader schemas.4344## When to use4546- Serializing records for Kafka or data lakes (compact, typed, evolvable)47- Converting JSON lines to Avro for storage efficiency48- Verifying a schema change is backward compatible4950## Real commands5152```bash53# Inspect metadata54java -jar avro-tools.jar getmeta events.avro5556# Convert Avro to JSON57java -jar avro-tools.jar tojson events.avro | head -55859# JSON to Avro60java -jar avro-tools.jar fromjson data.json --schema-file schema.avsc6162# Generate sample data63java -jar avro-tools.jar random --schema-file user.avsc --count 100 sample.avro6465# Python66pip install avro67python -c "import avro.schema; s=avro.schema.parse(open('user.avsc').read()); print(s.fullname)"68```6970## Schema example7172```json73{74 "type": "record",75 "name": "User",76 "namespace": "com.example",77 "fields": [78 {"name": "id", "type": "long"},79 {"name": "email", "type": "string"}80 ]81}82```8384## Schema evolution8586- Adding a field with a default is backward compatible87- Test resolution: `avro-tools tojson --schema-file reader_v2.avsc writer_v1.avro`8889## Testing9091- Round-trip: fromjson then tojson should reproduce input92- Run evolution checks in CI with both schema versions9394## Best practices9596- Never remove fields without defaults unless coordinated97- Store the writer schema in the .avro container header98- Use Avro IDs in a schema registry for Kafka payloads99100## Capabilities101102### avro-tools103Convert, inspect, and manipulate Avro data files.104105**Parameters:**106- `schema_file` (string): Avro schema .avsc file107- `count` (number): Number of records for random generation108109**Commands:**110- `java -jar avro-tools.jar getmeta file.avro`111- `java -jar avro-tools.jar tojson file.avro`112- `java -jar avro-tools.jar fromjson data.json --schema-file schema.avsc`113- `java -jar avro-tools.jar cat file.avro`114- `java -jar avro-tools.jar random --schema-file schema.avsc --count 10 test.avro`115116**Examples:**117- java -jar avro-tools.jar tojson events.avro | head -5118- java -jar avro-tools.jar getmeta events.avro | head -20119- java -jar avro-tools.jar random --schema-file user.avsc --count 100 sample.avro120121### python-avro122Serialize and deserialize Avro with the Python library.123124**Parameters:**125- `schema` (string): Avro schema JSON126- `file` (string): .avro data file to read/write127128**Commands:**129- `pip install avro`130- `python -c "import avro; print(avro.__version__)"`131- `python -c "from avro.datafile import DataFileWriter; from avro.io import DatumWriter; print('ok')"`132- `python -m avro`133134**Examples:**135- python -c "import avro.schema; s=avro.schema.parse(open('user.avsc').read()); print(s.fullname)"136- python -c "from avro import schema; print(schema.parse('\"string\"').fullname)"137- python -c "import avro.datafile as d; print([x for x in dir(d) if 'Writer' in x or 'Reader' in x])"138139### schema-evolution140Test schema resolution between writer and reader schemas.141142**Parameters:**143- `writer_schema` (string): Original schema used at write time144- `reader_schema` (string): New schema for reading145146**Commands:**147- `java -jar avro-tools.jar --version`148- `java -jar avro-tools.jar tojson --schema-file reader.avsc writer.avro`149- `python -c "import avro.io as io; print([x for x in dir(io) if 'Reader' in x])"`150- `java -jar avro-tools.jar compile schema schema.avsc /tmp/out`151152**Examples:**153- java -jar avro-tools.jar tojson --schema-file reader_v2.avsc writer_v1.avro | head -3154- python -c "from avro.io import DatumReader; r=DatumReader(reader_schema, writer_schema); print('resolution ready')"155- java -jar avro-tools.jar compile schema v2.avsc gen/156157## References158- [Avro Specification](https://avro.apache.org/docs/current/specification/)159- [Avro Getting Started](https://avro.apache.org/docs/current/getting-started-java/)160- [Python avro library](https://avro.apache.org/docs/current/getting-started-python/)