Use when creating, modifying, reviewing, or improving Taskfiles (task runner YAML files), or when translating Makefiles to Taskfiles. Provides primitives, patterns, style conventions, and best practices for writing idiomatic Taskfiles.
Taskfile is a YAML-based task runner similar to Make. It defines tasks with commands, dependencies, variables, and conditional execution. Tasks are defined in Taskfile.yml (or .yaml, .dist.yml variants).
| Convention | Example |
|---|---|
| 2-space indentation | Standard YAML |
| Uppercase variable names |
BUILD_DIR, VERSION |
| Kebab-case task names | build-docker, run-tests |
| Colon for namespacing | docker:build, test:unit |
| No whitespace in templates | {{.VAR}} not {{ .VAR }} |
Section order: version, includes, output/silent/method/run, vars, env, tasks
| Primitive | Purpose | Example |
|---|---|---|
cmds | Commands to run | cmds: [go build, go test] |
deps | Run tasks first (parallel) | deps: [clean, lint] |
vars | Task variables | vars: {VERSION: v1.0} |
env | Environment variables | env: {GO111MODULE: on} |
dir | Working directory | dir: ./src |
sources | Input files (fingerprinting) | sources: ['**/*.go'] |
generates | Output files | generates: [bin/app] |
status | Skip if commands succeed | status: [test -f bin/app] |
preconditions | Fail if conditions unmet | preconditions: [{sh: which go}] |
internal | Hide from task --list | internal: true |
desc | Description for --list | desc: Build the application |
aliases | Alternative names | aliases: [b] |
platforms | OS/arch restrictions | platforms: [linux, darwin] |