Skip to content
Agentmart
Submit a tool

makefiles

Use when writing or editing a Makefile, or when the user asks for one — sets the GNU Make header block, phony/real target rules, variable and recipe…

Skill by offspring

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/offspring-makefiles

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when writing or editing a Makefile, or when the user asks for one — sets the GNU Make header block, phony/real target rules, variable and recipe conventions used in this user's repos

Use cases: writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/makefiles

What's inside

Skill name
makefiles
Description
Use when writing or editing a Makefile, or when the user asks for one — sets the GNU Make header block, phony/real target rules, variable and recipe conventions used in this user's repos
License
MIT
Instructions
87 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Makefiles

GNU Make is the target (`make` resolves to gmake here); GNU-only features are fine.

## Header

Right after the `# -*- makefile -*-` line, put this block, then give every environment variable the Makefile reads a `?=` default so `--warn-undefined-variables` stays quiet:

```makefile
SHELL:=bash
.SHELLFLAGS:=-eu -o pipefail -c
.DELETE_ON_ERROR:
.SUFFIXES:
MAKEFLAGS+=--no-builtin-rules --warn-undefined-variables
.DEFAULT_GOAL:=all
```

- `SHELL` and `.SHELLFLAGS`: recipes fail on the first error, unset shell variable, or failed pipeline stage
- `.DELETE_ON_ERROR`: a half-written target file is removed when its recipe fails (directories are not, so keep a `configure`-style target that wipes and redoes a build tree)
- `.SUFFIXES` and `--no-builtin-rules`: no implicit `.c`/`.o` rules, so a typo'd target cannot silently match one
- `.DEFAULT_GOAL`: the default target is explicit, not "whichever comes first"

## Targets

- The first target is `all`, declared phony, and usually empty so a bare `make` does nothing by accident
- Declare `.PHONY:` directly above each target it applies to, one target per declaration, never in a single list at the top
- Every target that does not produce a file of the same name is phony (`build`, `clean`, `lint`, `run`, ...)
- Real file and directory targets are not phony; use them so `make` can skip work that is up to date
- Recurse with `$(MAKE)`, never bare `make`, so flags and the jobserver propagate

## Variables

- `:=` for simple assignment; `?=` for values the caller may override from the command line or environment
- Branch on the host once at the top (`HOST_OS:=$(shell uname -s)`) rather than inside recipes
- Fail early for missing prerequisites with `$(error ...)` at parse time or in the target that needs them

## Recipes

- Indented with a tab, never spaces
- One command per line; use `&&` only when a later command must not run after a failure that make would otherwise not see
- Prefix with `@` only for echo-style lines; let real commands print so the log shows what ran

## Detection

The first line is always:

```makefile
# -*- makefile -*-
```

It marks the file as a Makefile for editors even when it is not named `Makefile`.

## Example

```makefile
# -*- makefile -*-
SHELL:=bash
.SHELLFLAGS:=-eu -o pipefail -c
.DELETE_ON_ERROR:
.SUFFIXES:
MAKEFLAGS+=--no-builtin-rules --warn-undefined-variables
.DEFAULT_GOAL:=all

BUILD_TYPE?=Release
BUILD_DIR:=cmake-bld

.PHONY: all
all:

$(BUILD_DIR):
	cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -S . -B $(BUILD_DIR)

.PHONY: configure
configure:
	rm -rf $(BUILD_DIR)
	$(MAKE) $(BUILD_DIR)

.PHONY: build
build: $(BUILD_DIR)
	cmake --build $(BUILD_DIR)

.PHONY: clean
clean:
	rm -rf $(BUILD_DIR)
```

From offspring/offspring-claude-skills, MIT.

More from offspring/offspring-claude-skills

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 22, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from offspring

Cite this page

makefiles skill. Agent Mart. https://agentmart.dev/skills/offspring-makefiles (last updated 2026-10-24)