makefile-generation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTable of Contents
目录
Makefile Generation Skill
Makefile生成技能
Generate a Makefile with standard development targets for Python, Rust, or TypeScript projects.
为Python、Rust或TypeScript项目生成带有标准开发目标的Makefile。
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
- 需要为无Makefile的项目创建Makefile
- 希望为Makefile添加新目标
- 在多个项目中标准化构建自动化流程
- 设置开发工作流命令
- 创建特定语言的构建目标
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 instead for updating existing Makefiles
/attune:upgrade-project
- Makefile已存在且内容最新
- 项目完全使用其他构建系统(例如仅使用npm scripts)
- 复杂的自定义构建流程不符合标准模式
- 更新现有Makefile请使用
/attune:upgrade-project
Standard Targets
标准目标
Python Makefile
Python Makefile
Common targets:
- - Show available targets
help - - Install dependencies with uv
install - - Run ruff linting
lint - - Format code with ruff
format - - Run mypy type checking
typecheck - - Run pytest
test - - Run tests with coverage report
test-coverage - - Run all quality checks
check-all - - Remove generated files and caches
clean - - Build distribution packages
build - - Publish to PyPI
publish
常见目标:
- - 显示可用目标
help - - 使用uv安装依赖
install - - 运行ruff代码检查
lint - - 使用ruff格式化代码
format - - 运行mypy类型检查
typecheck - - 运行pytest测试
test - - 运行测试并生成覆盖率报告
test-coverage - - 运行所有质量检查
check-all - - 删除生成的文件和缓存
clean - - 构建分发包
build - - 发布至PyPI
publish
Rust Makefile
Rust Makefile
Common targets:
- - Show available targets
help - - Format with rustfmt
fmt - - Run clippy
lint - - Cargo check
check - - Run tests
test - - Build release binary
build - - Clean build artifacts
clean
常见目标:
- - 显示可用目标
help - - 使用rustfmt格式化代码
fmt - - 运行clippy代码检查
lint - - 执行Cargo检查
check - - 运行测试
test - - 构建发布版本二进制文件
build - - 清理构建产物
clean
TypeScript Makefile
TypeScript Makefile
Common targets:
- - Show available targets
help - - Install npm dependencies
install - - Run ESLint
lint - - Format with Prettier
format - - Run tsc type checking
typecheck - - Run Jest tests
test - - Build for production
build - - Start development server
dev
常见目标:
- - 显示可用目标
help - - 安装npm依赖
install - - 运行ESLint代码检查
lint - - 使用Prettier格式化代码
format - - 运行tsc类型检查
typecheck - - 运行Jest测试
test - - 构建生产版本
build - - 启动开发服务器
dev
Workflow
工作流程
1. Detect Language
1. 检测语言
bash
undefinedbash
undefinedCheck for language indicators
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.if [ -f "pyproject.toml" ]; then
LANGUAGE="python"
elif [ -f "Cargo.toml" ]; then
LANGUAGE="rust"
elif [ -f "package.json" ]; then
LANGUAGE="typescript"
fi
**验证:** 添加`--help`参数运行命令以验证可用性。2. Load Template
2. 加载模板
python
from pathlib import Path
template_path = Path("plugins/attune/templates") / language / "Makefile.template"Verification: Run the command with flag to verify availability.
--helppython
from pathlib import Path
template_path = Path("plugins/attune/templates") / language / "Makefile.template"验证: 添加参数运行命令以验证可用性。
--help3. Collect Project Info
3. 收集项目信息
python
metadata = {
"PROJECT_NAME": "my-project",
"PROJECT_MODULE": "my_project",
"PYTHON_VERSION": "3.10",
}Verification: Run the command with flag to verify availability.
--helppython
metadata = {
"PROJECT_NAME": "my-project",
"PROJECT_MODULE": "my_project",
"PYTHON_VERSION": "3.10",
}验证: 添加参数运行命令以验证可用性。
--help4. Render Template
4. 渲染模板
python
from template_engine import TemplateEngine
engine = TemplateEngine(metadata)
engine.render_file(template_path, Path("Makefile"))Verification: Run the command with flag to verify availability.
--helppython
from template_engine import TemplateEngine
engine = TemplateEngine(metadata)
engine.render_file(template_path, Path("Makefile"))验证: 添加参数运行命令以验证可用性。
--help5. Verify
5. 验证
bash
make helpVerification: Run to verify build configuration.
make --dry-runbash
make help验证: 运行以验证构建配置。
make --dry-runCustomization
自定义
Users can add custom targets after the generated ones:
makefile
undefined用户可以在生成的目标后添加自定义目标:
makefile
undefined============================================================================
============================================================================
CUSTOM TARGETS
CUSTOM TARGETS
============================================================================
============================================================================
deploy: build ## Deploy to production
./scripts/deploy.sh
**Verification:** Run the command with `--help` flag to verify availability.deploy: build ## Deploy to production
./scripts/deploy.sh
**验证:** 添加`--help`参数运行命令以验证可用性。Related Skills
相关技能
- - Full project initialization
Skill(attune:project-init) - command - Makefile testing and validation
/abstract:make-dogfood
- - 完整项目初始化
Skill(attune:project-init) - 命令 - Makefile测试与验证
/abstract:make-dogfood