Makefile Generator
This skill creates a Makefile with important commands tailored to the project type.
Instructions
When this skill is invoked:
-
Detect project type by checking for these files:
File Project Type package.jsonNode.js / JavaScript tsconfig.jsonTypeScript Cargo.tomlRust go.modGo requirements.txt/pyproject.toml/setup.pyPython pom.xmlJava (Maven) build.gradle/build.gradle.ktsJava/Kotlin (Gradle) deps.edn/project.cljClojure dune-project/*.opamOCaml GemfileRuby mix.exsElixir CMakeLists.txtC/C++ (CMake) *.csproj/*.sln.NET / C# -
Check for existing Makefile: If one exists, ask user whether to overwrite or merge.
-
Analyze project specifics:
# For Node.js - check package.json scripts cat package.json | grep -A 20 '"scripts"' # For Python - check for common tools ls pyproject.toml setup.py setup.cfg tox.ini .flake8 2>/dev/null # For Go - check module name head -1 go.mod -
Generate Makefile with these standard targets:
Required Targets (all projects)
.PHONY: help run test clean deps build lint format docs help: ## Show this help message run: ## Run the application test: ## Run tests clean: ## Clean build artifacts deps: ## Install dependencies build: ## Build the project lint: ## Run linter format: ## Format code docs: ## Generate documentationProject-Specific Commands
Node.js / TypeScript:
deps: npm install run: npm start test: npm test build: npm run build lint: npm run lint format: npm run format || npx prettier --write . clean: rm -rf node_modules dist build coverage .next docs: npm run docs || npx typedocPython:
VENV := .venv PYTHON := $(VENV)/bin/python PIP := $(VENV)/bin/pip deps: python -m venv $(VENV) $(PIP) install -r requirements.txt run: $(PYTHON) -m <module_name> test: $(PYTHON) -m pytest build: $(PYTHON) -m build lint: $(PYTHON) -m flake8 . || $(PYTHON) -m ruff check . format: $(PYTHON) -m black . clean: rm -rf $(VENV) __pycache__ .pytest_cache dist build *.egg-info .ruff_cache docs: $(PYTHON) -m sphinx docs docs/_buildRust:
deps: cargo fetch run: cargo run test: cargo test build: cargo build --release lint: cargo clippy -- -D warnings format: cargo fmt clean: cargo clean docs: cargo doc --openGo:
BINARY := <binary_name> deps: go mod download run: go run . test: go test ./... build: go build -o $(BINARY) . lint: golangci-lint run format: go fmt ./... clean: rm -f $(BINARY) go clean docs: godoc -http=:6060Java (Maven):
deps: mvn dependency:resolve run: mvn exec:java test: mvn test build: mvn package -DskipTests lint: mvn checkstyle:check format: mvn spotless:apply clean: mvn clean docs: mvn javadoc:javadocJava/Kotlin (Gradle):
deps: ./gradlew dependencies run: ./gradlew run test: ./gradlew test build: ./gradlew build lint: ./gradlew check format: ./gradlew spotlessApply clean: ./gradlew clean docs: ./gradlew javadocTypeScript:
deps: npm install run: npx ts-node src/index.ts test: npm test build: npx tsc lint: npx eslint src/ format: npx prettier --write src/ clean: rm -rf node_modules dist build coverage .tsbuildinfo docs: npx typedoc src/ typecheck: ## Run type checking without emitting npx tsc --noEmitClojure (deps.edn):
deps: clojure -P run: clojure -M -m <main-namespace> test: clojure -M:test build: clojure -T:build uber lint: clojure -M:clj-kondo --lint src/ format: clojure -M:cljfmt fix clean: rm -rf target .cpcache docs: clojure -M:codox repl: ## Start a REPL clojure -M:replClojure (Leiningen):
deps: lein deps run: lein run test: lein test build: lein uberjar lint: lein clj-kondo --lint src/ format: lein cljfmt fix clean: lein clean docs: lein codox repl: ## Start a REPL lein replOCaml (Dune):
deps: opam install . --deps-only run: dune exec <binary_name> test: dune runtest build: dune build lint: opam exec -- ocamlformat --check . format: dune fmt clean: dune clean docs: dune build @doc watch: ## Build with file watching dune build --watch utop: ## Start utop REPL dune utop -
Always include help target (self-documenting):
.DEFAULT_GOAL := help help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' -
Add useful extras based on project:
watch- for projects with file watching capabilitydocker- if Dockerfile existsdeploy- placeholder if deployment configs existcheck- run all validation (lint + test)dev- development mode with hot reload
-
Write the Makefile and confirm with user.
Output Format
# Makefile for <project_name>
# Generated by makefile-gen skill
#
# Usage: make [target]
# Run 'make help' to see all available targets.
.DEFAULT_GOAL := help
.PHONY: help deps run test build lint format clean docs check dev
# ... targets ...
Notes
- Use tabs (not spaces) for Makefile indentation
- Include
.PHONYdeclarations for all non-file targets - Add
## descriptioncomments for help target to pick up - If project uses multiple languages, include targets for all
- Respect existing tooling choices (e.g., if project uses pnpm, use pnpm not npm)
