project-init
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTable of Contents
目录
Project Initialization Skill
项目初始化Skill
Interactive workflow for initializing new software projects with complete development infrastructure.
用于初始化新软件项目的交互式工作流,包含完整的开发基础设施配置。
Use When
适用场景
- Starting a new Python, Rust, or TypeScript project
- Updating existing project tooling to current standards
- Need to set up git, GitHub workflows, pre-commit hooks, Makefile
- Want consistent project structure across team
- Converting unstructured project to best practices
- Adding missing configurations to established codebases
- 启动新的Python、Rust或TypeScript项目
- 将现有项目工具更新至当前标准
- 需要设置Git、GitHub工作流、pre-commit钩子、Makefile
- 希望团队内保持一致的项目结构
- 将非结构化项目转换为最佳实践规范
- 为成熟代码库添加缺失的配置
Workflow
工作流程
1. Detect or Select Language
1. 检测或选择编程语言
Load
modules/language-detection.md- Auto-detect from existing files (pyproject.toml, Cargo.toml, package.json)
- If ambiguous or empty directory, ask user to select
- Validate language is supported (python, rust, typescript)
加载
modules/language-detection.md- 从现有文件自动检测(pyproject.toml、Cargo.toml、package.json)
- 若存在歧义或目录为空,询问用户选择
- 验证语言是否受支持(python、rust、typescript)
2. Collect Project Metadata
2. 收集项目元数据
Load
modules/metadata-collection.mdGather:
- Project name (default: directory name)
- Author name and email
- Project description
- Language-specific settings:
- Python: version (default 3.10)
- Rust: edition (default 2021)
- TypeScript: framework (React, Vue, etc.)
- License type (MIT, Apache, GPL, etc.)
加载
modules/metadata-collection.md收集以下信息:
- 项目名称(默认:目录名称)
- 作者姓名和邮箱
- 项目描述
- 语言特定设置:
- Python:版本(默认3.10)
- Rust:版本(默认2021)
- TypeScript:框架(React、Vue等)
- 许可证类型(MIT、Apache、GPL等)
3. Review Existing Files
3. 检查现有文件
Check for existing configurations:
bash
ls -laVerification: Run the command with flag to verify availability.
--helpIf files exist (Makefile, .gitignore, etc.):
- Show what would be overwritten
- Ask for confirmation or selective overwrite
- Offer merge mode (preserve custom content)
检查现有配置:
bash
ls -la验证: 使用标志运行命令以确认可用性。
--help若存在文件(Makefile、.gitignore等):
- 展示将被覆盖的内容
- 询问用户确认或选择部分覆盖
- 提供合并模式(保留自定义内容)
4. Render and Apply Templates
4. 渲染并应用模板
Load
modules/template-rendering.mdRun initialization script:
bash
python3 plugins/attune/scripts/attune_init.py \
--lang {{LANGUAGE}} \
--name {{PROJECT_NAME}} \
--author {{AUTHOR}} \
--email {{EMAIL}} \
--python-version {{PYTHON_VERSION}} \
--description {{DESCRIPTION}} \
--path .Verification: Run the command with flag to verify availability.
--help加载
modules/template-rendering.md运行初始化脚本:
bash
python3 plugins/attune/scripts/attune_init.py \
--lang {{LANGUAGE}} \
--name {{PROJECT_NAME}} \
--author {{AUTHOR}} \
--email {{EMAIL}} \
--python-version {{PYTHON_VERSION}} \
--description {{DESCRIPTION}} \
--path .验证: 使用标志运行命令以确认可用性。
--help5. Initialize Git (if needed)
5. 初始化Git(如需要)
bash
undefinedbash
undefinedCheck if git is initialized
检查是否已初始化Git
if [ ! -d .git ]; then
git init
echo "Git repository initialized"
fi
**Verification:** Run `git status` to confirm working tree state.if [ ! -d .git ]; then
git init
echo "Git repository initialized"
fi
**验证:** 运行`git status`确认工作区状态。6. Verify Setup
6. 验证设置
Validate setup:
bash
undefined验证设置是否正确:
bash
undefinedCheck Makefile targets
检查Makefile目标
make help
make help
List created files
列出已创建的文件
git status
**Verification:** Run `git status` to confirm working tree state.git status
**验证:** 运行`git status`确认工作区状态。7. Next Steps
7. 后续步骤
Advise user to:
bash
undefined建议用户执行:
bash
undefinedInstall dependencies and hooks
安装依赖和钩子
make dev-setup
make dev-setup
Run tests to verify setup
运行测试以验证设置
make test
make test
See all available commands
查看所有可用命令
make help
**Verification:** Run `pytest -v` to verify tests pass.make help
**验证:** 运行`pytest -v`确认测试通过。Error Handling
错误处理
- Language detection fails: Ask user to specify
--lang - Script not found: Guide to plugin installation location
- Permission denied: Suggest on scripts
chmod +x - Git conflicts: Offer to stash or commit existing work
- 语言检测失败: 询问用户指定参数
--lang - 脚本未找到: 引导用户前往插件安装位置
- 权限拒绝: 建议对脚本执行操作
chmod +x - Git冲突: 提供暂存或提交现有工作的选项
Success Criteria
成功标准
- All template files created successfully
- No overwrites without user confirmation
- Git repository initialized
- shows available targets
make help - runs without errors (even if no tests yet)
make test
- 所有模板文件创建成功
- 未经用户确认不会覆盖任何文件
- Git仓库已初始化
- 显示可用目标
make help - 可正常运行(即使暂无测试用例)
make test
Examples
示例
Example 1: New Python Project
示例1:新建Python项目
**Verification:** Run `pytest -v` to verify tests pass.
User: /attune:project-init**验证:** 运行`pytest -v`确认测试通过。
User: /attune:project-initTroubleshooting
故障排除
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 flag
--verbose命令未找到
确保所有依赖已安装且在PATH中
权限错误
检查文件权限并使用适当权限运行
异常行为
使用标志启用详细日志
--verboseundefined