Makefile Workflow
Create or refine Makefiles that encode a reliable developer workflow. Mirror the project's existing tooling (Go, Node, Bazel, Supabase, etc.) and use low-noise output for successful runs.
Instructions
- Ask for essentials if missing:
- Primary language(s) and tooling (Go, Node, Bazel, Python, etc.)
- Lint/format/test commands already in use
- Whether the project wants
all,check, andfixtargets
- Start with a clear, consistent target taxonomy:
all: full local workflow (format + fix + tests + build + check-* targets)check: CI-friendly checks (no mutation), prefercheck-*targetsformat+check-formatlint+fixtest,build,coverage,clean
- Use the stricter naming convention for non-mutating checks:
- Prefer
check-*over names liketype-check,bundle-check - Example:
check-astro,check-bundle
- Prefer
- Reduce output noise for successful runs:
- If the repo has
scripts/quiet-run.sh, wrap commands like:@./scripts/quiet-run.sh "Label" <command> - Only use it where the project already does; don't invent a helper without asking.
- If the repo has
- Use
.PHONYfor non-file targets and group related sections with comments. - Keep shell-safe loops and cross-platform sed where needed:
- Prefer
rgfor file lists. - Avoid scanning
node_modulesor vendor directories.
- Prefer
- For Go projects, include
golangci-lintverification hashes if.golangci.ymlis present. - For frontend projects, prefer
npm run <task>orpnpm run <task>to preserve project scripts. - If generation or formatting changes files, add
check-generatedorcheck-formatthat fails on a dirty git diff. - For large repos, consider stamp files to avoid repeated work.
- Ensure Makefiles work correctly with
make -j(parallel execution):- Targets that modify files (e.g.,
format,fix) must declare dependencies to prevent concurrent writes. For example,fixshould depend onformatsince both write to the same files. - Validation or check targets that run after writes should depend on the write targets. For example,
validate-fullshould depend onfix. - Read-only targets (e.g.,
check-format,lint,test) are safe to run in parallel and need no extra ordering. - If correct ordering cannot be expressed through dependencies, add
.NOTPARALLELto the Makefile.
- Targets that modify files (e.g.,
Recommended target patterns
Minimal workflow
all:format fix test buildcheck:check-format lint test build- Parallel-safety deps:
fix: format(both mutate files)
Go + linters
lint-golangci,fix-golangci,verify-golangci-configcoverage,coverage-html,coverage-report,clean-coverage
Frontend + Supabase
check-astro,check-bundle,test-e2e,db-push,db-reset,db-status,db-gen-types
Output expectations
When asked to create or update a Makefile:
- Produce a ready-to-run Makefile tailored to the project.
- Preserve existing targets and semantics; only add or adjust as needed.
- Call out any assumptions (package manager, tools, coverage thresholds).
Converted and distributed by TomeVault — claim your Tome and manage your conversions.