home / skills / laurigates / claude-plugins / configure-makefile

This skill checks and configures a Makefile to meet project standards, ensuring required targets and compliance with team conventions.

npx playbooks add skill laurigates/claude-plugins --skill configure-makefile

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
6.3 KB
---
model: haiku
created: 2025-12-16
modified: 2026-02-10
reviewed: 2025-12-16
description: Check and configure Makefile with standard targets for project standards
allowed-tools: Glob, Grep, Read, Write, Edit, AskUserQuestion, TodoWrite
argument-hint: "[--check-only] [--fix]"
name: configure-makefile
---

# /configure:makefile

Check and configure project Makefile against project standards.

## When to Use This Skill

| Use this skill when... | Use another approach when... |
|------------------------|------------------------------|
| Setting up a new Makefile for a project that requires Make | Project can use Just instead — use `/configure:justfile` (preferred) |
| Auditing existing Makefile for missing standard targets | Writing complex build rules with dependencies — consult GNU Make documentation |
| Ensuring Makefile follows team conventions (help target, PHONY, colors) | Project uses a language-native build system (cargo, go build) exclusively |
| Running CI/CD compliance checks on Makefile structure | Migrating from Makefile to Justfile — use `/configure:justfile` which handles migration |
| Adding language-specific build/test/lint targets to existing Makefile | Debugging a specific Make target — run `make -n <target>` directly |

## Context

- Project root: !`pwd`
- Makefile exists: !`find . -maxdepth 1 -name 'Makefile' 2>/dev/null`
- Makefile targets: !`grep -E '^[a-zA-Z_-]+:' Makefile 2>/dev/null`
- Package files: !`find . -maxdepth 1 \( -name 'package.json' -o -name 'pyproject.toml' -o -name 'Cargo.toml' -o -name 'go.mod' \) 2>/dev/null`
- Docker files: !`find . -maxdepth 1 \( -name 'Dockerfile' -o -name 'docker-compose.yml' -o -name 'compose.yml' \) 2>/dev/null`
- Server files: !`find src -maxdepth 1 \( -name 'server.*' -o -name 'main.*' \) 2>/dev/null`

## Parameters

Parse from `$ARGUMENTS`:

- `--check-only`: Report Makefile compliance status without modifications
- `--fix`: Apply fixes automatically without prompting

**Required Makefile targets**: `help`, `test`, `build`, `clean`, `lint`

## Execution

Execute this Makefile compliance check:

### Step 1: Detect project type

Read the context values and determine project type (in order):

1. **Python**: `pyproject.toml` or `requirements.txt` present
2. **Node**: `package.json` present
3. **Rust**: `Cargo.toml` present
4. **Go**: `go.mod` present
5. **Generic**: None of the above

Check for service indicators (start/stop needed):
- Has `docker-compose.yml` or `compose.yml` -> Docker Compose service
- Has `Dockerfile` + HTTP server code -> Container service
- Has `src/server.*` or `src/main.*` -> Application service

### Step 2: Analyze existing Makefile targets

If Makefile exists, check against required targets:

**Required targets for all projects:**

| Target | Purpose |
|--------|---------|
| `help` | Display available targets (default goal) |
| `test` | Run test suite |
| `build` | Build project artifacts |
| `clean` | Remove temporary files and build artifacts |
| `lint` | Run linters |

**Additional targets (context-dependent):**

| Target | When Required |
|--------|---------------|
| `start` | If project has runnable service |
| `stop` | If project has background service |
| `format` | If project uses auto-formatters |

### Step 3: Run compliance checks

| Check | Standard | Severity |
|-------|----------|----------|
| File exists | Makefile present | FAIL if missing |
| Default goal | `.DEFAULT_GOAL := help` | WARN if missing |
| PHONY declarations | All targets marked `.PHONY` | WARN if missing |
| Colored output | Color variables defined | INFO |
| Help target | Auto-generated from comments | WARN if missing |
| Language-specific | Commands match project type | FAIL if mismatched |

### Step 4: Generate compliance report

Print a report showing:
- Project type (detected)
- Each target with PASS/FAIL status and the command used
- Makefile structural checks (default goal, PHONY, colors, help)
- Missing targets list
- Issue count

If `--check-only` is set, stop here.

### Step 5: Create or update Makefile (if --fix or user confirms)

1. **Missing Makefile**: Create from standard template using the detected project type
2. **Missing targets**: Add targets with appropriate language-specific commands
3. **Missing defaults**: Add `.DEFAULT_GOAL`, `.PHONY`, color variables
4. **Missing help**: Add auto-generated help target using awk comment parsing

Use the language-specific commands below:

**Python (uv-based):**
- `lint`: `@uv run ruff check .`
- `format`: `@uv run ruff format .`
- `test`: `@uv run pytest`
- `build`: `@docker build -t {{PROJECT_NAME}} .`
- `clean`: `@find . -type f -name "*.pyc" -delete` + remove cache dirs

**Node.js:**
- `lint`: `@npm run lint`
- `format`: `@npm run format`
- `test`: `@npm test`
- `build`: `@npm run build`
- `clean`: `@rm -rf node_modules/ dist/ .next/ .turbo/`

**Rust:**
- `lint`: `@cargo clippy -- -D warnings`
- `format`: `@cargo fmt`
- `test`: `@cargo nextest run`
- `build`: `@cargo build --release`
- `clean`: `@cargo clean`

**Go:**
- `lint`: `@golangci-lint run`
- `format`: `@gofmt -s -w .`
- `test`: `@go test ./...`
- `build`: `@go build -o bin/{{PROJECT_NAME}}`
- `clean`: `@rm -rf bin/ dist/` + `@go clean`

### Step 6: Update standards tracking

Update `.project-standards.yaml`:

```yaml
components:
  makefile: "2025.1"
```

### Step 7: Print final report

Print a summary of changes applied, targets added, and suggest running `make help` to verify.

For the universal Makefile template structure, see [REFERENCE.md](REFERENCE.md).

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Quick compliance check | `/configure:makefile --check-only` |
| Auto-fix all issues | `/configure:makefile --fix` |
| List existing targets | `grep -E '^[a-zA-Z_-]+:' Makefile` |
| Dry-run a target | `make -n <target>` |
| Show default goal | `make -p \| grep '.DEFAULT_GOAL'` |

## Flags

| Flag | Description |
|------|-------------|
| `--check-only` | Report status without offering fixes |
| `--fix` | Apply fixes automatically |

## Examples

```bash
# Check current Makefile compliance
/configure:makefile --check-only

# Create/update Makefile for Python project
/configure:makefile --fix

# Check compliance and prompt for fixes
/configure:makefile
```

## See Also

- `/configure:all` - Run all compliance checks
- `/configure:workflows` - GitHub Actions workflows
- `/configure:dockerfile` - Docker configuration

Overview

This skill checks and configures a project's Makefile to meet team standards and include a set of required targets. It detects project type (Python, Node, Rust, Go, or Generic), inspects existing Makefile structure, and reports missing or misconfigured targets. When requested it can also generate or update a Makefile with language-appropriate commands and helpful defaults.

How this skill works

The skill reads repository indicators (package files, Docker files, server entrypoints) to determine project type and service behavior. It parses the Makefile for targets and structural elements (.DEFAULT_GOAL, .PHONY, help comments) and compares them to required standards. If run with --fix, it injects a standard template, adds missing targets using language-specific commands, and updates a standards tracking file.

When to use it

  • Setting up a Makefile for a new repository that should follow team conventions
  • Auditing an existing Makefile for missing or misconfigured standard targets
  • Enforcing CI/CD checks that require consistent Makefile structure
  • Adding language-specific build/test/lint targets to a repository
  • Quickly generating a baseline Makefile for a simple service or utility

Best practices

  • Run the skill with --check-only first to review issues before applying changes
  • Keep .DEFAULT_GOAL := help so onboarding users see available targets by default
  • Declare all routine targets in .PHONY to avoid name collisions with files
  • Use the help target comments pattern so help can be auto-generated and stays up to date
  • Prefer lightweight language-specific commands in Makefile targets and delegate heavy logic to scripts or npm/uv/cargo/go tooling

Example use cases

  • Repository missing Makefile: generate a standard Makefile for the detected language and add .PHONY, help, and defaults
  • CI job: run /configure:makefile --check-only to fail the pipeline if required targets are missing
  • Onboarding: add a help target so contributors can run make help to see standard tasks
  • Service repo with Docker: add start/stop targets when docker-compose or server files are present
  • Refactor: add lint and format targets that invoke the project’s canonical formatter and linter commands

FAQ

What targets are required?

The skill ensures help, test, build, clean, and lint exist; it may add start/stop/format when context requires them.

Will it modify files without consent?

No — by default it reports issues; use --fix to apply changes automatically.

How does it choose language-specific commands?

It detects project type from common files (pyproject.toml, package.json, Cargo.toml, go.mod) and injects commands matched to that language’s tooling.