home / skills / athola / claude-night-market / makefile-generation

This skill generates language-specific Makefiles with testing, linting, and automation targets to standardize project setup and workflows.

npx playbooks add skill athola/claude-night-market --skill makefile-generation

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

Files (1)
SKILL.md
4.5 KB
---
name: makefile-generation
description: "Generate language-specific Makefiles with testing, linting, and automation targets. Use for project initialization and workflow standardization. Skip if Makefile exists."
# Custom metadata (not used by Claude for matching):
model: claude-sonnet-4
tools: [Read, Write, Bash]
category: infrastructure
tags: [makefile, automation, build-tools, development-workflow]
complexity: low
estimated_tokens: 1200
---
## Table of Contents

- [When To Use](#when-to-use)
- [Standard Targets](#standard-targets)
- [Python Makefile](#python-makefile)
- [Rust Makefile](#rust-makefile)
- [TypeScript Makefile](#typescript-makefile)
- [Workflow](#workflow)
- [1. Detect Language](#1-detect-language)
- [2. Load Template](#2-load-template)
- [3. Collect Project Info](#3-collect-project-info)
- [4. Render Template](#4-render-template)
- [5. Verify](#5-verify)
- [Customization](#customization)
- [Related Skills](#related-skills)


# Makefile Generation Skill

Generate a Makefile with standard development targets for Python, Rust, or TypeScript projects.

## When To Use

- Need a Makefile for a project without one
- Want to update Makefile with new targets
- Standardizing build automation across projects
- Setting up development workflow commands
- Creating language-specific build targets

## When NOT To Use

- Makefile already exists and is current
- Project uses alternative build system exclusively (e.g., npm scripts only)
- Complex custom build process that doesn't fit standard patterns
- Use `/attune:upgrade-project` instead for updating existing Makefiles

## Standard Targets

### Python Makefile

**Common targets**:
- `help` - Show available targets
- `install` - Install dependencies with uv
- `lint` - Run ruff linting
- `format` - Format code with ruff
- `typecheck` - Run mypy type checking
- `test` - Run pytest
- `test-coverage` - Run tests with coverage report
- `check-all` - Run all quality checks
- `clean` - Remove generated files and caches
- `build` - Build distribution packages
- `publish` - Publish to PyPI

### Rust Makefile

**Common targets**:
- `help` - Show available targets
- `fmt` - Format with rustfmt
- `lint` - Run clippy
- `check` - Cargo check
- `test` - Run tests
- `build` - Build release binary
- `clean` - Clean build artifacts

### TypeScript Makefile

**Common targets**:
- `help` - Show available targets
- `install` - Install npm dependencies
- `lint` - Run ESLint
- `format` - Format with Prettier
- `typecheck` - Run tsc type checking
- `test` - Run Jest tests
- `build` - Build for production
- `dev` - Start development server

## Workflow

### 1. Detect Language

```bash
# Check for language indicators
if [ -f "pyproject.toml" ]; then
    LANGUAGE="python"
elif [ -f "Cargo.toml" ]; then
    LANGUAGE="rust"
elif [ -f "package.json" ]; then
    LANGUAGE="typescript"
fi
```
**Verification:** Run the command with `--help` flag to verify availability.

### 2. Load Template

```python
from pathlib import Path

template_path = Path("plugins/attune/templates") / language / "Makefile.template"
```
**Verification:** Run the command with `--help` flag to verify availability.

### 3. Collect Project Info

```python
metadata = {
    "PROJECT_NAME": "my-project",
    "PROJECT_MODULE": "my_project",
    "PYTHON_VERSION": "3.10",
}
```
**Verification:** Run the command with `--help` flag to verify availability.

### 4. Render Template

```python
from template_engine import TemplateEngine

engine = TemplateEngine(metadata)
engine.render_file(template_path, Path("Makefile"))
```
**Verification:** Run the command with `--help` flag to verify availability.

### 5. Verify

```bash
make help
```
**Verification:** Run `make --dry-run` to verify build configuration.

## Customization

Users can add custom targets after the generated ones:

```makefile
# ============================================================================
# CUSTOM TARGETS
# ============================================================================

deploy: build ## Deploy to production
	./scripts/deploy.sh
```
**Verification:** Run the command with `--help` flag to verify availability.

## Related Skills

- `Skill(attune:project-init)` - Full project initialization
- `Skill(abstract:makefile-dogfooder)` - Makefile testing and validation
## Troubleshooting

### Common Issues

**Command not found**
Ensure all dependencies are installed and in PATH

**Permission errors**
Check file permissions and run with appropriate privileges

**Unexpected behavior**
Enable verbose logging with `--verbose` flag

Overview

This skill generates language-specific Makefiles for Python, Rust, or TypeScript projects, adding standard development, testing, linting, and automation targets. It skips generation if a Makefile already exists and focuses on project initialization and workflow standardization. Use it to quickly add a consistent set of targets across repositories. Templates are customizable so teams can extend or replace generated targets.

How this skill works

The skill detects the project language by checking for pyproject.toml, Cargo.toml, or package.json. It loads the corresponding Makefile template, collects basic project metadata (name, module, runtime version), and renders a Makefile in the project root. After generation it runs basic verification like make help or make --dry-run and leaves room for user customization.

When to use it

  • Initializing a new project that lacks a Makefile
  • Standardizing CI/dev workflows across multiple repos
  • Adding common targets for testing, linting, formatting, and build
  • Quickly scaffolding a Makefile for Python, Rust, or TypeScript projects
  • Updating or regenerating a Makefile when project tooling changes

Best practices

  • Skip generation if a valid Makefile already exists to avoid overwriting custom logic
  • Review and commit the generated Makefile before running destructive targets like clean or publish
  • Customize templates to include organization-specific CI, deployment, or release steps
  • Keep templates minimal and add project-specific targets under a CUSTOM TARGETS section
  • Verify generated targets locally with make help and make --dry-run before CI usage

Example use cases

  • Generate a Python Makefile with targets: install, lint (ruff), format, typecheck (mypy), test (pytest), test-coverage, build, publish
  • Create a Rust Makefile that provides fmt, lint (clippy), check, test, build, and clean targets
  • Produce a TypeScript Makefile to run install, lint (ESLint), format (Prettier), typecheck (tsc), test (Jest), dev, and build
  • Standardize developer onboarding by adding the same help and install targets across multiple repositories
  • Add a custom deploy target beneath generated targets to integrate an existing deployment script

FAQ

Will this overwrite an existing Makefile?

No. The skill skips generation if a Makefile already exists to prevent accidental overwrites.

Can I customize the generated Makefile?

Yes. Templates are intended to be modified; add organization-specific targets in the CUSTOM TARGETS section.

Which languages are supported?

Out of the box it supports Python, Rust, and TypeScript by detecting common manifest files.