Comprehensive toolkit for validating, linting, and optimizing Makefiles. Use this skill when working with Makefiles (Makefile, makefile, *.mk files), validating build configurations, checking for best practices, identifying security issues, or debugging Makefile problems.
Overall
score
100%
Does it follow best practices?
Validation for skill structure
-n --dry-run validation; catches errors with line numbers.DELETE_ON_ERROR, .PHONY declarations, $(MAKE) for recursive calls, .ONESHELL error handlingrm/sudo/curl/wget, command injection, .EXPORT_ALL_VARIABLES leakage.NOTPARALLEL, .INTERMEDIATE/.SECONDARY, VPATH usage, incremental build efficiencySee references/best-practices.md, references/common-mistakes.md, and references/bake-tool.md for detailed explanations.
# Validate a Makefile
bash scripts/validate_makefile.sh Makefile========================================
MAKEFILE VALIDATOR
========================================
File: Makefile
[SYNTAX CHECK (GNU make)]
✓ No syntax errors found
[MBAKE VALIDATION]
✓ mbake validation passed
[MBAKE FORMAT CHECK]
⚠ Formatting issues found
Run 'mbake format Makefile' to fix formatting issues
Or run 'mbake format --diff Makefile' to preview changes
[CUSTOM CHECKS]
⚠ No .PHONY declarations found
✗ Potential spaces instead of tabs in recipes detected
ℹ No VPATH/vpath declarations found
========================================
VALIDATION SUMMARY
========================================
Errors: 1
Warnings: 2
Info: 1
⚠ Validation PASSED with warningsbash .claude/skills/makefile-validator/scripts/validate_makefile.sh Makefile# Preview changes
mbake format --diff Makefile
# Apply formatting
mbake format Makefile
# Re-validate
bash .claude/skills/makefile-validator/scripts/validate_makefile.sh Makefile# 1. Validate current state
bash scripts/validate_makefile.sh legacy.mk
# 2. Fix critical errors (tabs, syntax), then apply formatting
mbake format legacy.mk
# 3. Add .PHONY declarations
mbake format --auto-insert-phony-declarations legacy.mk
# 4. Re-validate
bash scripts/validate_makefile.sh legacy.mk
# 5. Reference best-practices.md for modernization guidanceThe validator automatically checks for hardcoded credentials, unsafe variable expansion in dangerous commands, and command injection vulnerabilities. Reference references/common-mistakes.md for detailed explanations and fixes.
For pre-commit hooks, CI/CD pipelines (e.g. GitHub Actions), and self-validating Makefile targets, use the validation script at .claude/skills/makefile-validator/scripts/validate_makefile.sh and match on files named Makefile, makefile, or *.mk. The script's exit codes (0/1/2) map cleanly to pass/warn/fail states for any automation context. See references/bake-tool.md for CI/CD configuration details.
make -n)minphony, phonydeclared rules)
go install github.com/checkmake/checkmake/cmd/checkmake@latestmbake is automatically installed in an isolated venv per invocation and cleaned up on exit — no manual installation required.
makefile-validator/
├── skill.md # This file
├── scripts/
│ └── validate_makefile.sh # Main validation script
├── references/
│ ├── best-practices.md # Makefile best practices
│ ├── common-mistakes.md # Common Makefile mistakes
│ └── bake-tool.md # mbake tool reference (config, CI/CD, advanced features)
└── assets/
├── good-makefile.mk # Well-written example
└── bad-makefile.mk # Anti-patterns examplembake doesn't recognize some valid GNU Make special targets (.DELETE_ON_ERROR, .SUFFIXES, .ONESHELL, .POSIX) — the validator filters these false positives and surfaces them as informational messages. The mbake format --check vs mbake format output may also differ; this is a known upstream issue. See references/bake-tool.md for full details including mbake configuration (~/.bake.toml) and format-disable comments.
Install with Tessl CLI
npx tessl i pantheon-ai/makefile-validator