Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .claude/commands/init-context-engineering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: "Initialize Context Engineering Environment"
description: "Initialize context engineering environment in target projects with automatic analysis and setup"
Usage: /init-context-engineering <target-directory>
Example: /init-context-engineering /path/to/target-project
---

# Initialize Context Engineering Environment

## Target Directory: $ARGUMENTS

Initialize context engineering environment in the specified target project by analyzing the project structure and creating all necessary directories, files, and configurations.

## Analysis Process

1. **Project Analysis**
- Detect project type (Python/TypeScript/Generic)
- Identify frameworks and dependencies
- Analyze existing code structure and patterns
- Determine testing frameworks and conventions

2. **Environment Setup**
- Create complete directory structure
- Generate project-specific CLAUDE.md
- Create customized command templates
- Set up configuration files

## Directory Structure Created

```
📦 target-project/
├── 📂 .claude/
│ ├── 🎯 settings.local.json
│ └── 📂 commands/
│ ├── 🎯 generate-prp.md
│ └── 🎯 execute-prp.md
├── 📂 context-engineering/
│ ├── 📂 features/
│ │ └── 🎯 INITIAL_EXAMPLE.md
│ ├── 📂 PRPs/
│ │ └── 📂 templates/
│ │ └── 🎯 prp_base.md
│ ├── 📂 examples/
│ └── 🎯 README.md
└── 🎯 CLAUDE.md
```

## Features Created

- **Project Analysis**: Automatic detection of project type, frameworks, and patterns
- **Customized CLAUDE.md**: Project-specific rules and conventions
- **Command Templates**: generate-prp and execute-prp commands tailored to the project
- **Chinese Documentation**: Comprehensive usage guide in Chinese
- **Template System**: PRP templates customized for the project's architecture
- **Example Features**: Ready-to-use feature examples for reference

## Usage Instructions

After initialization, users can:
1. Create feature requirements in `context-engineering/features/`
2. Generate PRPs using `/generate-prp <feature-file>`
3. Execute PRPs using `/execute-prp <prp-file>`
4. Follow the Chinese documentation in `context-engineering/README.md`

## Quality Assurance

- Validates target directory exists
- Analyzes project structure thoroughly
- Creates consistent, project-specific configurations
- Provides comprehensive feedback and next steps
- Includes error handling and validation
47 changes: 47 additions & 0 deletions features/20250807支持init-context-engineering命令.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## FEATURE:

当前项目是一个使用上下文工程来进行软件开发的模板项目,当前主要解决了新建项目的开发流程。
对于用户已有应用需要有对应的command来进行初始化,使得可以使用上下文工程来开发已有的应用。
请你帮我创建这样一个command(/init-context-engineering),使得可以在用户项目里初始化上下文工程开发环境。
* 生成/init-context-engineering.md在当前项目的.claude/commands目录下
* 用户执行/init-context-engineering命令时,会指定目标目录,例如/init-context-engineering /path/to/target-project
* 用户执行/init-context-engineering命令时,此命令需要能自动创建项目所需要的上下文工程目录结构
* 所有上下文工程相关的文档都放入目标项目的context-engineering目录下
* 此命令需要能从代码里先学习用户项目的开发规范和代码架构
* 结合当前上下文工程项目的使用方法和用户项目来初始化上下文工程环境, 后续用户可以直接在其项目工程里迭代开发
* 新增features目录,用于保存用户每次的需求输入
* 提供使用方法的文档README.md,方便该项目所有开发者使用
* 预期用户项目最终的目录结构如下:
```
📦 targert-project
├── 📂 .claude
│ ├── 🎯 settings.local.json
│ └── 📂 commands
│ ├── 🎯 generate-prp.md #用户通过执行/init-context-engineering命令生成; 内容和当前项目一样,可以结合目标项目微调
│ └── 🎯 execute-prp.md #用户通过执行/init-context-engineering命令生成; 内容和当前项目一样,可以结合目标项目微调
├── 📂 context-engineering # Context engineering project 用户通过执行/init-context-engineering命令生成
│ ├── 📂 features/ # Features directory 用户通过执行/init-context-engineering命令生成;用户后续将原始需求放入此目录
│ │ └── 🎯 INITIAL_EXAMPLE.md # 用户通过执行/init-context-engineering命令生成, 用于用户参考如何编写原始需求
│ ├── 📂 PRPs/ # PRPs directory 用户通过执行/init-context-engineering命令生成; 执行/generate-prp后生成的prp需要放入此目录,生成的prp文件名需要以日期开始
│ │ └── 📂 templates # 用户通过执行/init-context-engineering命令生成
│ │ └── 🎯 prp_base.md #prp基础模板,在执行/generate-prp时参考; 用户通过执行/init-context-engineering命令生成; 初始内容和当前项目一样, 并基于在目标项目代码学习到的规范和架构知识更新
│ ├── 📂 examples/ # Examples directory/ 用户通过执行/init-context-engineering命令生成;基于在目标项目代码学习到的规范和架构知识生成
│ └── 🎯 README.md # 上下文工程开发指南; 需要使用中文书写
├── 🎯 CLAUDDE.md #用户通过执行/init-context-engineering命令生成; 内容和当前项目一样
... 原有项目文件目录
```
* 文件和目录创建尽量不要依赖python, 优先使用claude-code的工具

* 特别注意:我们的目标是生成如上要求的/init-context-engineering命令即可,不用生成无关的代码和测试

## EXAMPLES:

[Provide and explain examples that you have in the `examples/` folder]

## DOCUMENTATION:
- [README.md](README.md)
- [CLAUDE.md](CLAUDE.md)

## OTHER CONSIDERATIONS:

[Any other considerations or specific requirements - great place to include gotchas that you see AI coding assistants miss with your projects a lot]