Activates when starting a new project or analyzing an existing project. Trigger keywords: 初始化项目, 初始化, init, 分析项目, 项目诊断, 扫描项目. Initializes directory structure, copies CLAUDE.md.template, or analyzes existing project state.
Scanned 9/6/2026
Install to Claude Code
npx -y skills add mingfer/m-skills --skill m-init --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of M Init?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/mingfer-m-init)More formats (shields.io, HTML) on the badges page.
---
name: m-init
description: >
Activates when starting a new project or analyzing an existing project.
Trigger keywords: 初始化项目, 初始化, init, 分析项目, 项目诊断, 扫描项目.
Initializes directory structure, copies CLAUDE.md.template, or analyzes existing project state.
updated: "2026-05-14"
---
## Role
You are a **Project Initializer**. Your job is to either:
- Set up a new project with the m-* skill system
- Analyze an existing project and report its state
---
## Entry Gate
Ask user which scenario:
```
AskUserQuestion(
question: "m-init — 项目初始化或分析\n\n选择操作:",
options: [
{ label: "[1] 新项目初始化", description: "创建目录结构、复制 CLAUDE.md、初始化 index 文件" },
{ label: "[2] 分析已有项目", description: "扫描 docs/ 目录,报告现有状态和下一步建议" }
]
)
```
---
## Scenario A: New Project Initialization
TaskCreate("m-init: 新项目初始化", status: "in_progress", activeForm: "初始化目录结构...")
### Step 1: Create Directory Structure
Create the following directories:
```
docs/
├── requirements/
│ └── index.md
├── designs/
│ ├── index.md
│ └── adr/
│ └── index.md
├── plans/
│ └── index.md
└── tests/
└── index.md
```
### Step 2: Initialize Index Files
**`docs/requirements/index.md`**:
```markdown
# 需求文档索引
> 更新时间: YYYY-MM-DD
## 功能需求
| 功能 | 状态 | 更新日期 |
|------|------|---------|
| (none) | — | — |
```
**`docs/designs/index.md`**:
```markdown
# 设计文档索引
> 更新时间: YYYY-MM-DD
## 功能设计
| 功能 | 状态 | 更新日期 |
|------|------|---------|
| (none) | — | — |
```
**`docs/designs/adr/index.md`**:
```markdown
# Architecture Decision Records
> 更新时间: YYYY-MM-DD
## Records
| ADR | 标题 | 状态 | 日期 |
|-----|------|------|------|
| (none) | — | — | — |
```
**`docs/plans/index.md`**:
```markdown
# 执行计划索引
> 更新时间: YYYY-MM-DD
## 功能计划
| 功能 | Wave 数 | 任务数 | 阻塞数 | 状态 |
|------|---------|--------|--------|------|
| (none) | — | — | — | — |
```
**`docs/tests/index.md`**:
```markdown
# 测试文档索引
> 更新时间: YYYY-MM-DD
## 功能测试
| 功能 | 测试用例数 | 回归向量 | 状态 |
|------|-----------|---------|------|
| (none) | — | — | — |
```
### Step 3: Copy CLAUDE.md.template
```
AskUserQuestion(
question: "是否复制 CLAUDE.md.template 到项目根目录?\n\n这是 AI Skills 技能体系的配置文件,AI 将通过它自动发现文档位置。",
options: [
{ label: "→ 复制", description: "复制到项目根目录 CLAUDE.md" },
{ label: "跳过", description: "稍后手动复制" }
]
)
```
If user confirms:
1. Read `skills/CLAUDE.md.template`
2. Write to `<project-root>/CLAUDE.md`
### Step 4: Git Init (Optional)
```
AskUserQuestion(
question: "是否初始化 Git 仓库?",
options: [
{ label: "→ git init", description: "git init + 初始 commit" },
{ label: "跳过", description: "项目已有 git 或不使用 git" }
]
)
```
If user confirms:
1. `git init`
2. `git add .`
3. `git commit -m "init: 项目初始化,m-* 技能体系就绪"`
### Step 5: Summary
Display initialization result:
```
✅ 项目初始化完成
目录结构:
docs/requirements/ # 需求文档
docs/designs/ # 设计文档
docs/designs/adr/ # 架构决策记录
docs/plans/ # 执行计划
docs/tests/ # 测试文档
CLAUDE.md # AI Skills 配置
下一步:
→ m-req 开始第一个功能的需求分析
```
TaskUpdate(taskId, status: "completed")
```
AskUserQuestion(
question: "初始化完成。下一步?",
options: [
{ label: "→ m-req", description: "开始需求分析" },
{ label: "结束", description: "稍后用 'm-req' 开始" }
]
)
```
---
## Scenario B: Analyze Existing Project
TaskCreate("m-init: 分析已有项目", status: "in_progress", activeForm: "扫描项目目录...")
### Step 1: Scan Project Structure
Scan and report:
1. **docs/ 结构**:
- `docs/requirements/` — 存在哪些需求文档?
- `docs/designs/` — 存在哪些设计文档?有哪些 ADR?
- `docs/plans/` — 存在哪些执行计划?
- `docs/tests/` — 存在哪些测试文档?
2. **CLAUDE.md**:
- 项目根目录是否有 CLAUDE.md?
- 是否指向有效的 docs/ 结构?
3. **git 状态**:
- 是否是 git 仓库?
- 最近提交是什么?
### Step 2: Report Project State
Display analysis report:
```markdown
## 项目状态报告
### docs/ 结构
| 类型 | 状态 | 内容 |
|------|------|------|
| requirements | ✅/❌ | N 个文档: [list] |
| designs | ✅/❌ | N 个文档: [list] |
| plans | ✅/❌ | N 个功能: [list] |
| tests | ✅/❌ | N 个功能: [list] |
### CLAUDE.md
- 状态: ✅ 存在 / ❌ 缺失
- 建议: [如缺失,建议复制模板]
### Git
- 状态: ✅ 是仓库 / ❌ 不是仓库
- 最近提交: [last commit message]
### 缺失项
- [ ] 功能 X: 需求已存在,设计/计划/测试 缺失
- [ ] 功能 Y: 全部缺失
```
### Step 3: Recommend Next Steps
```
AskUserQuestion(
question: "项目分析完成。\n\n摘要:N 个已有功能 | N 个缺失项\n\n推荐下一步:",
options: [
{ label: "→ 补充缺失项", description: "按缺失顺序引导:需求 → 设计 → 测试 → 计划 → 执行" },
{ label: "→ 初始化缺失结构", description: "创建 docs/ 子目录和 index 文件,不填充内容" },
{ label: "结束", description: "已了解项目状态" }
]
)
```
**Option A — 补充缺失项**:
继续执行 m-req / m-design / m-test / m-plan,填充对应功能。
**Option B — 仅初始化结构**:
只创建 docs/ 子目录和 index 文件,不写内容。
TaskUpdate(taskId, status: "completed")
---
## Progress Tracking
- Step 1 完成 → TaskUpdate(id, activeForm: "创建目录结构...")
- Step 2 完成 → TaskUpdate(id, activeForm: "初始化 index 文件...")
- Step 3 完成 → TaskUpdate(id, activeForm: "复制 CLAUDE.md...")
- 完成 → TaskUpdate(id, status: "completed")
---
## AskUserQuestion 规范
`→` 继续/下一步 | `[1]` `[2]` 数字快速选择
详细模板见 `skills/reference/cli-interaction.md`。
---
## Exit Gate
- [ ] 新项目:目录结构创建完成,index 文件初始化完成
- [ ] 分析项目:docs/ 扫描完成,报告已展示,建议已给出
- [ ] Git commit 完成(如果用户选择)
---
## Changelog
### v1.0.0 (2026-05-14)
- Initial release
- 支持两个场景:新项目初始化 + 已有项目分析
- TaskCreate 进度追踪
- AskUserQuestion 交互
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!