building-dagster-assetslisted
Install: claude install-skill Unknown-333/awesome-data-engineering-skills
# Building Dagster Assets
## When to use
- Creating or refactoring Dagster software-defined assets and jobs.
- Modeling tables/files/ML models as assets with lineage.
- Adding partitions, backfills, asset checks, schedules, or sensors.
- Do NOT use for Airflow (use the Airflow skills).
## Workflow
```
- [ ] Model each output as an @asset; declare deps via function args
- [ ] Add partitions for time/category-sliced data
- [ ] Move IO (reads/writes) into IO managers or resources
- [ ] Add asset checks for data quality
- [ ] Schedule/sensor to materialize
```
1. **Think in assets, not tasks.** An asset is a persistent object (a table, file,
model). Declare dependencies by referencing upstream assets as function
parameters — Dagster builds the lineage graph automatically.
2. **Partition** assets that are naturally sliced (by day, region) so you can
materialize/backfill one slice at a time.
3. **Resources and IO managers** hold connections and read/write logic, keeping
asset bodies focused on transformation and making them testable.
4. **Asset checks** attach data quality assertions to an asset.
## Patterns
**Partitioned assets with a dependency:**
```python
import dagster as dg
daily = dg.DailyPartitionsDefinition(start_date="2026-01-01")
@dg.asset(partitions_def=daily)
def raw_orders(context: dg.AssetExecutionContext) -> None:
day = context.partition_key
write_parquet(f"raw/orders/{day}.parquet", fetch_orders(day))
@dg.asset(partitions_def=daily)
d