solo-setup

TotalClaw 作者 fortunto2

从现有 PRD 和 CLAUDE.md 自动生成项目工作流程配置 (docs/workflow.md),零问题。当用户说“设置工作流程”、“配置 TDD”、“连接开发工作流程”时或在 /plan 之前运行 /scaffold 后使用。请勿用于创始人设置(使用 /init)或项目脚手架(使用 /scaffold)。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~fortunto2-solo-setup
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~fortunto2-solo-setup/file -o fortunto2-solo-setup.md
# /setup

Auto-generate project workflow config from existing PRD and CLAUDE.md. Zero interactive questions — all answers extracted from project data that already exists after `/scaffold`.

## When to use

After `/scaffold` creates a project, before `/plan`. Creates `docs/workflow.md` so `/plan` and `/build` can work.

## MCP Tools (use if available)

- `project_info(name)` — get project details, detected stack
- `kb_search(query)` — search for dev principles, manifest, stack templates
- `codegraph_query(query)` — check project dependencies in code graph

If MCP tools are not available, fall back to reading local files only.

## Steps

1. **Detect project root:**
   - If `$ARGUMENTS` is provided, look for a project with that name in the current directory or `projects_dir` from `~/.solo-factory/defaults.yaml`.
   - Otherwise use current working directory.
   - Verify the directory exists and has `CLAUDE.md`.
   - If not found, ask via AskUserQuestion.

2. **Check if already initialized:**
   - If `docs/workflow.md` exists, warn and ask whether to regenerate.

3. **Read project data** (parallel — all reads at once):
   - `CLAUDE.md` — tech stack, architecture, commands, Do/Don't
   - `docs/prd.md` — problem, users, solution, features, metrics, pricing
   - `package.json` or `pyproject.toml` — exact dependency versions
   - `Makefile` — available commands
   - Linter configs (`.eslintrc*`, `eslint.config.*`, `.swiftlint.yml`, `ruff.toml`, `detekt.yml`)

4. **Read ecosystem sources** (optional — enhances quality):
   - Detect stack name from CLAUDE.md (look for "Stack:" or the stack name in tech section).
   - If MCP `kb_search` available: search for stack template and dev-principles.
   - Otherwise: look for `stacks/<stack>.yaml` and `dev-principles.md` in `.solo/` or plugin templates directory (if accessible).
   - If neither available: derive all info from CLAUDE.md + package manifest (sufficient).

5. **Detect languages** from package manifest:
   - `package.json` → TypeScript
   - `pyproject.toml` → Python
   - `*.xcodeproj` or `Package.swift` → Swift
   - `build.gradle.kts` → Kotlin

6. **Create docs directory if needed:**
   ```bash
   mkdir -p docs
   ```

7. **Generate `docs/workflow.md`:**
   Based on dev-principles (from MCP/KB or built-in defaults):
   ```markdown
   # Workflow — {ProjectName}

   ## TDD Policy
   **Moderate** — Tests encouraged but not blocking. Write tests for:
   - Business logic and validation
   - API route handlers
   - Complex algorithms
   Tests optional for: UI components, one-off scripts, prototypes.

   ## Test Framework
   {from package manifest devDeps: vitest/jest/pytest/xctest}

   ## Commit Strategy
   **Conventional Commits**
   Format: `<type>(<scope>): <description>`
   Types: feat, fix, refactor, test, docs, chore, perf, style

   ## Verification Checkpoints
   **After each phase completion:**
   1. Run tests — all pass
   2. Run linter — no errors
   3. Run build — successful (if applicable)
   4. Manual smoke test

   ## Branch Strategy
   - `main` — production-ready
   - `feat/<track-id>` — feature branches
   - `fix/<description>` — hotfixes
   ```

8. **Update `CLAUDE.md`** — add workflow reference to Key Documents section if not present.

9. **Show summary and suggest next step:**
   ```
   Setup complete for {ProjectName}!

   Created:
     docs/workflow.md — TDD moderate, conventional commits

   Next: /plan "Your first feature"
   ```

## Common Issues

### CLAUDE.md not found
**Cause:** Project not scaffolded or running from wrong directory.
**Fix:** Run `/scaffold` first, or ensure you're in the project root with CLAUDE.md.

### workflow.md already exists
**Cause:** Previously set up.
**Fix:** Skill warns and asks whether to regenerate. Existing file is preserved unless you confirm overwrite.

### Wrong test framework detected
**Cause:** Multiple test frameworks in devDependencies.
**Fix:** Skill picks the first found. Edit `docs/workflow.md` manually to specify the correct framework.

---

## 中文说明

# /setup

从现有的 PRD 和 CLAUDE.md 自动生成项目工作流配置。零交互式提问 —— 所有答案均从 `/scaffold` 执行后已存在的项目数据中提取。

## 何时使用

在 `/scaffold` 创建项目之后、`/plan` 之前。创建 `docs/workflow.md`,以便 `/plan` 和 `/build` 能够正常工作。

## MCP 工具(若可用则使用)

- `project_info(name)` — 获取项目详情、检测到的技术栈
- `kb_search(query)` — 搜索开发原则、清单(manifest)、技术栈模板
- `codegraph_query(query)` — 在代码图(code graph)中检查项目依赖

如果 MCP 工具不可用,则回退为仅读取本地文件。

## 步骤

1. **检测项目根目录:**
   - 如果提供了 `$ARGUMENTS`,则在当前目录或 `~/.solo-factory/defaults.yaml` 中的 `projects_dir` 内查找同名项目。
   - 否则使用当前工作目录。
   - 验证该目录存在且包含 `CLAUDE.md`。
   - 若未找到,通过 AskUserQuestion 询问。

2. **检查是否已初始化:**
   - 如果 `docs/workflow.md` 已存在,则发出警告并询问是否重新生成。

3. **读取项目数据**(并行 —— 一次性完成所有读取):
   - `CLAUDE.md` — 技术栈、架构、命令、Do/Don't
   - `docs/prd.md` — 问题、用户、解决方案、功能、指标、定价
   - `package.json` 或 `pyproject.toml` — 精确的依赖版本
   - `Makefile` — 可用命令
   - Linter 配置(`.eslintrc*`、`eslint.config.*`、`.swiftlint.yml`、`ruff.toml`、`detekt.yml`)

4. **读取生态系统来源**(可选 —— 提升质量):
   - 从 CLAUDE.md 检测技术栈名称(查找 "Stack:" 或技术章节中的技术栈名称)。
   - 如果 MCP `kb_search` 可用:搜索技术栈模板和 dev-principles。
   - 否则:在 `.solo/` 或插件模板目录中查找 `stacks/<stack>.yaml` 和 `dev-principles.md`(若可访问)。
   - 如果两者都不可用:从 CLAUDE.md + 包清单推导出全部信息(足够)。

5. **检测语言**,依据包清单:
   - `package.json` → TypeScript
   - `pyproject.toml` → Python
   - `*.xcodeproj` 或 `Package.swift` → Swift
   - `build.gradle.kts` → Kotlin

6. **如有需要,创建 docs 目录:**
   ```bash
   mkdir -p docs
   ```

7. **生成 `docs/workflow.md`:**
   基于 dev-principles(来自 MCP/KB 或内置默认值):
   ```markdown
   # Workflow — {ProjectName}

   ## TDD Policy
   **Moderate** — Tests encouraged but not blocking. Write tests for:
   - Business logic and validation
   - API route handlers
   - Complex algorithms
   Tests optional for: UI components, one-off scripts, prototypes.

   ## Test Framework
   {from package manifest devDeps: vitest/jest/pytest/xctest}

   ## Commit Strategy
   **Conventional Commits**
   Format: `<type>(<scope>): <description>`
   Types: feat, fix, refactor, test, docs, chore, perf, style

   ## Verification Checkpoints
   **After each phase completion:**
   1. Run tests — all pass
   2. Run linter — no errors
   3. Run build — successful (if applicable)
   4. Manual smoke test

   ## Branch Strategy
   - `main` — production-ready
   - `feat/<track-id>` — feature branches
   - `fix/<description>` — hotfixes
   ```

8. **更新 `CLAUDE.md`** —— 如果尚不存在,则在 Key Documents 章节中添加对工作流的引用。

9. **显示摘要并建议下一步:**
   ```
   Setup complete for {ProjectName}!

   Created:
     docs/workflow.md — TDD moderate, conventional commits

   Next: /plan "Your first feature"
   ```

## 常见问题

### 找不到 CLAUDE.md
**原因:** 项目未脚手架化,或在错误的目录中运行。
**解决:** 先运行 `/scaffold`,或确保你处于包含 CLAUDE.md 的项目根目录中。

### workflow.md 已存在
**原因:** 之前已设置过。
**解决:** 技能会发出警告并询问是否重新生成。除非你确认覆盖,否则现有文件会被保留。

### 检测到错误的测试框架
**原因:** devDependencies 中存在多个测试框架。
**解决:** 技能会选择找到的第一个。请手动编辑 `docs/workflow.md` 指定正确的框架。