Padrões e boas práticas para Makefile em todos os projetos
66%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/infrastructure/makefile/SKILL.mdMakefile é padrão obrigatório em todos os projetos. Comandos principais DEVEM estar no Makefile.
Todo projeto deve ter:
.PHONY: help up down build test clean logs ps
help: ## Mostrar ajuda
@echo "Comandos disponíveis:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
up: ## Subir containers
docker compose up -d --build --remove-orphans
down: ## Parar containers
docker compose down
build: ## Build das imagens
docker compose build
test: ## Executar testes
docker compose run --rm test pytest
logs: ## Ver logs
docker compose logs -f
ps: ## Status dos containers
docker compose ps
clean: ## Limpar containers e volumes
docker compose down -v# ============================================
# DOCKER COMPOSE
# ============================================
.PHONY: up down build logs ps clean
up: ## Subir stack
docker compose up -d --build --remove-orphans
down: ## Parar stack
docker compose down
# ============================================
# TESTES
# ============================================
.PHONY: test test-cov test-watch
test: ## Executar testes
pytest
test-cov: ## Testes com cobertura
pytest --cov=src --cov-report=term-missing
# ============================================
# DESENVOLVIMENTO
# ============================================
.PHONY: install dev lint format
install: ## Instalar dependências
pip install -r requirements.txt
dev: ## Modo desenvolvimento
docker compose -f docker-compose.dev.yml up
lint: ## Linter
black --check .
flake8 .
format: ## Formatar código
black .# Variáveis
ENV ?= local
COMPOSE_FILE := docker-compose.yml
ifeq ($(ENV),prod)
COMPOSE_FILE := docker-compose.prod.yml
endif
up: ## Subir stack (ENV=local|prod)
docker compose -f $(COMPOSE_FILE) up -d --buildSEMPRE incluir help automático:
.PHONY: help
help: ## Mostrar ajuda
@echo "═══════════════════════════════════════════════"
@echo " PROJETO - MAKEFILE COMMANDS "
@echo "═══════════════════════════════════════════════"
@echo ""
@echo "Usage: make <target> ENV=local|prod"
@echo ""
@echo "Available Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-25s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := helpQuando usuário pede para executar algo:
Exemplo:
make up → Executa make upmake up no Makefile → Executa make up.PHONY: migrate test lint format
migrate: ## Rodar migrations
alembic upgrade head
test: ## Testes
pytest --cov=src --cov-report=term-missing
lint: ## Linter
black --check .
flake8 .
mypy src/
format: ## Formatar
black .
isort ..PHONY: migrate test collectstatic
migrate: ## Migrations
python manage.py migrate
test: ## Testes
python manage.py test
collectstatic: ## Static files
python manage.py collectstatic --noinput.PHONY: install test build
install: ## Instalar dependências
npm install
test: ## Testes
npm test
build: ## Build
npm run buildf84a77a
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.