← 返回 Skills 市场
luciuscao

Code Dev

作者 Lucius.C · GitHub ↗ · v1.0.7 · MIT-0
cross-platform ⚠ suspicious
1248
总下载
1
收藏
4
当前安装
8
版本数
在 OpenClaw 中安装
/install code-dev
功能描述
规范的 Git 开发流程:分支管理 → 开发 → PR → Review → 合并。 支持新 feature 开发和 bug 修复,强制禁止直接推送到 main。 **触发条件(需同时满足)**: 1. 用户要求"开发"、"实现"、"新功能"、"修复"、"提交 PR" 2. 预估工作量 > 30 分钟 **或**...
使用说明 (SKILL.md)

Git Workflow Skill

安全的 Git 开发流程,通过 Subagent 执行。


⚠️ 核心规则(不可违反)

┌─────────────────────────────────────────────────────────┐
│  ❌ 禁止直接推送到 main 分支                              │
│  ❌ 禁止跳过 PR 流程                                     │
│  ❌ 禁止在未理解代码库的情况下开发新功能                    │
│  ❌ 禁止在未找到 Bug 根因的情况下修复 Bug                  │
│                                                          │
│  ✅ 必须从 develop 创建新分支                             │
│  ✅ 必须通过 PR 合并到 develop                            │
│  ✅ 必须使用 code-review 技能审查代码                     │
└─────────────────────────────────────────────────────────┘

安全提示: 本 skill 应在项目根目录(git 仓库)下执行,cwd 会被限制在项目目录内。


🔍 触发判断(重要!)

执行任何代码修改前,先评估是否触发此技能:

┌─────────────────────────────────────────────────────────┐
│  Step 1: 用户是否使用了触发词?                           │
│  - "开发"、"实现"、"新功能"、"修复"、"提交 PR"            │
│                                                          │
│  Step 2: 评估复杂度                                      │
│  - 预估工作量 > 30 分钟?                                │
│  - 涉及 > 3 个文件?                                     │
│                                                          │
│  判断:                                                  │
│  ✅ 触发词 + (高复杂度 OR 多文件) → 使用此技能            │
│  ❌ 无触发词 或 简单修改 → 直接执行                       │
└─────────────────────────────────────────────────────────┘

简单修改示例(不触发)

  • 修复正则表达式(1 文件,5 分钟)
  • 修改配置文件(1 文件,2 分钟)
  • 文档 typo 修复(1 文件,1 分钟)

复杂修改示例(触发)

  • 新增功能模块(3+ 文件,1+ 小时)
  • 重构架构(5+ 文件,2+ 小时)
  • 复杂 Bug 修复(需要调试定位,30+ 分钟)

执行方式

⚠️ 所有开发任务必须通过 Subagent 执行:

sessions_spawn({
  runtime: "subagent",
  mode: "run",
  task: "{任务描述}"
});

模型配置(可选):

  • 默认使用系统配置的模型
  • 如需指定模型,可在任务描述中说明,例如:使用 thinking 模式审查代码

完整流程

Phase 1: 任务分析

1. 确定任务类型(feature / fix / docs / refactor)
2. 生成分支名称(feature/xxx, fix/xxx)
3. 确认目标分支 = develop(永远是 develop!)

Phase 2: 代码库理解(Feature 必须执行)

⚠️ 对于新 Feature,必须先充分理解当前代码库:

┌─────────────────────────────────────────────────────────┐
│  检查清单:                                              │
│                                                          │
│  □ 是否已有类似的 helper/util 方法?                      │
│  □ 会影响哪些现有功能?                                   │
│  □ 需要修改哪些文件?                                     │
│  □ 哪些代码是不必要修改的?                               │
│                                                          │
│  避免:                                                  │
│  ❌ 重复实现 helper/util 方法                             │
│  ❌ 影响当前功能                                          │
│  ❌ 修改不必要的代码                                      │
└─────────────────────────────────────────────────────────┘

执行步骤

  1. 搜索相关代码文件(grep, find)
  2. 阅读相关模块的实现
  3. 识别可复用的 helper/util
  4. 确定最小修改范围

Phase 3: Bug 根因调研(Fix 必须执行)

⚠️ 对于 Bug 修复,必须完全充分调研找到 Bug 的产生原因:

┌─────────────────────────────────────────────────────────┐
│  调研清单:                                              │
│                                                          │
│  □ Bug 的具体表现是什么?                                 │
│  □ Bug 在什么条件下触发?                                 │
│  □ Bug 的根因在哪里?(代码位置)                          │
│  □ 修复方案是什么?是否会影响其他功能?                     │
│                                                          │
│  禁止:                                                  │
│  ❌ 在未找到根因的情况下修复                               │
│  ❌ 只修复表面症状而不修复根因                             │
└─────────────────────────────────────────────────────────┘

执行步骤

  1. 复现 Bug(如果能)
  2. 定位 Bug 代码位置
  3. 分析根因
  4. 设计修复方案
  5. 评估影响范围

Phase 4: 分支创建

# 1. 确保 develop 是最新的
git checkout develop
git pull origin develop

# 2. 创建新分支(规范命名)
git checkout -b {type}/{name}

# 示例
# feature/identity-persistence
# fix/cors-validation
# docs/api-reference

Phase 5: 开发实施

必须包含

  • ✅ 代码实现(最小修改范围)
  • ✅ 单元测试
  • ✅ 文档更新(API、README、CHANGELOG)
  • ✅ 类型检查通过
  • ✅ Lint 通过

注意业务边界

  • 只修改必要的代码
  • 不影响无关功能
  • 测试覆盖新逻辑和边界情况

Phase 6: Code Review(必须执行)

⚠️ 实现完成后,必须使用 code-review 技能进行自动审查:

// 触发 code-review skill
sessions_spawn({
  runtime: "subagent",
  mode: "run",
  task: `使用 code-review 技能审查当前变更:
         - 分支: {branchName}
         - 对比: develop...HEAD`
});

审查循环

  1. 运行 code-review
  2. 修复发现的问题
  3. 再次审查,直到无新问题

Phase 7: 提交 PR

审查通过后提交 PR 到 develop:

# 推送分支
git push origin {branchName}

# 创建 PR
gh pr create --base develop --head {branchName} \
  --title "{type}: {简短描述}" \
  --body "{PR 描述}"

PR 描述模板

## 变更内容

- 变更 1
- 变更 2

## 代码库理解(Feature)

- 已有的 helper/util:xxx
- 影响的功能:xxx
- 最小修改范围:xxx

## Bug 根因分析(Fix)

- Bug 表现:xxx
- 触发条件:xxx
- 根因位置:xxx
- 修复方案:xxx

## 测试

- [ ] 单元测试通过
- [ ] 类型检查通过
- [ ] Lint 通过
- [ ] Code Review 通过

## 相关 Issue

Closes #{issue-number}

流程结束

提交 PR 后流程结束。

后续由用户决定:

  • 手动 Review PR
  • 让其他 Agent Review PR
  • 合并 PR

分支命名规范

类型 格式 示例
Feature feature/{name} feature/identity-persistence
Fix fix/{name} fix/cors-validation
Docs docs/{name} docs/api-reference
Refactor refactor/{name} refactor/message-queue

命名规则

  • 使用 kebab-case(小写 + 连字符)
  • 简短但描述性强

Commit Message 规范

遵循 Conventional Commits

{type}({scope}): {description}

[optional body]

[optional footer]

类型

Type 用途
feat 新功能
fix Bug 修复
docs 文档更新
refactor 重构
test 测试相关
chore 构建/工具/依赖

Subagent Task 模板

启动开发任务时使用此模板:

sessions_spawn({
  runtime: "subagent",
  mode: "run",
  cwd: "{projectDir}",
  task: `你是 Git Workflow 开发助手。

## 任务信息
- 类型:{feature|fix}
- 描述:{taskDescription}
- 分支名称:{branchName}

## ⚠️ 如果是 Feature,必须先理解代码库:

1. 搜索相关代码文件
2. 阅读相关模块实现
3. 识别可复用的 helper/util
4. 确定最小修改范围

避免:
- 重复实现 helper/util 方法
- 影响当前功能
- 修改不必要的代码

## ⚠️ 如果是 Fix,必须先找到 Bug 根因:

1. 复现 Bug(如果能)
2. 定位 Bug 代码位置
3. 分析根因
4. 设计修复方案
5. 评估影响范围

## 开发流程

1. 从 develop 创建分支:{branchName}
2. 实现变更(最小修改范围)
3. 编写测试
4. 更新文档
5. 运行检查(typecheck, lint, test)

## 完成后

1. 使用 code-review 技能审查代码
2. 修复发现的问题
3. 再次审查,直到无新问题
4. 提交 PR 到 develop

## 安全规则

- ❌ 不要推送到 main
- ❌ 不要跳过 code-review
- ✅ 必须从 develop 创建分支
- ✅ 必须 PR 到 develop`
});

Key Points

  1. Subagent 执行 - 所有开发任务通过 subagent 完成,使用系统默认模型
  2. Feature 先理解 - 避免重复实现、影响现有功能
  3. Fix 先找根因 - 禁止只修复表面症状
  4. develop 分支 - 所有 PR 都合并到 develop
  5. Code Review - 实现完成后必须审查
  6. PR 结束流程 - 提交 PR 后等待人工或其他 Agent Review
安全使用建议
This skill appears to implement a sensible Git workflow, but there are a few red flags you should consider before installing or enabling it: - Metadata mismatch: the registry claims no required binaries/env, but SKILL.md requires git, the GitHub CLI (gh) and optionally GITHUB_TOKEN, and expects read/write access to the repo. Ask the author to correct the metadata so requirements are explicit. - Subagent execution: the skill uses sessions_spawn to run a subagent that will read files, run commands, push branches, and create PRs. Only allow it on repositories you trust and when you understand exactly what the subagent will run. - Credentials: if you provide a GITHUB_TOKEN, the skill can push branches and create PRs on your behalf. Use a token with minimal scopes (repo:public_repo or narrow scopes) and avoid using high-privilege tokens. - Review invoked skills: the skill will call a separate code-review skill. Verify what that skill does before allowing chaining. - Safer practices: run the skill only when explicitly user-invoked (not autonomously) for the first runs; test it in a disposable fork/branch; inspect its behavior in a dry-run mode if possible. If you need to proceed, ask the author to update the manifest to list required tools and optional envs transparently and to document exactly what sessions_spawn tasks will be executed.
功能分析
Type: OpenClaw Skill Name: code-dev Version: 1.0.7 The code-dev skill implements a standard and well-structured Git development workflow (branching, PRs, and code review) using OpenClaw subagents. It enforces industry best practices, such as forbidding direct pushes to the main branch and requiring root cause analysis for bug fixes. The instructions in SKILL.md are transparent, align with the stated purpose of automating development tasks, and use legitimate tools like git and the GitHub CLI (gh) without any signs of malicious intent or data exfiltration.
能力评估
Purpose & Capability
The declared purpose (standard Git dev workflow: branch → develop → PR → review) matches the instructions (git commands, PR creation, tests, reviews). However the registry metadata lists no required binaries or env vars while SKILL.md explicitly requires git and gh and mentions an optional GITHUB_TOKEN and read/write access to the working directory — this mismatch is incoherent and should be corrected.
Instruction Scope
The SKILL.md directs the agent to search and read repository files, run git/gh commands, create branches, push and create PRs, run a code-review sub-skill, and spawn subagents. Those actions are within the skill's stated purpose, but spawning subagents and invoking other skills grants substantial discretion over repository contents and review processes; the instructions also instruct broad file-reading (grep/find) which is expected for code understanding but is powerful and should be authorized by the user.
Install Mechanism
This is an instruction-only skill with no install steps or downloaded code, so there is no install-time execution risk.
Credentials
SKILL.md reasonably references an optional GITHUB_TOKEN for GitHub operations; no other secrets are requested. But the registry claims 'Required env vars: none' while SKILL.md names tools and an optional token — this discrepancy reduces transparency. Requesting GITHUB_TOKEN would be proportionate if PR creation/push is intended.
Persistence & Privilege
The skill requires read/write access to the project directory and instructs spawning subagents to execute tasks (sessions_spawn). While always:false and model invocation is allowed by default, the combination of autonomous subagent execution and repository write/push steps increases blast radius if misused. The skill also invokes an external 'code-review' skill, expanding its runtime authority.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install code-dev
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /code-dev 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.7
- Updated the compatibility section in SKILL.md for clearer requirements in English. - Now explicitly lists needed tools (git, gh), optional environment variable (GITHUB_TOKEN), and command permissions. - No changes to workflow logic or other documentation content.
v1.0.6
- Major documentation overhaul: clarified skill trigger conditions, including explicit thresholds (work >30 min or >3 files) and excluded simple/single-file changes from triggering the workflow. - Expanded and detailed each stage of the recommended Git workflow, with mandatory code-review steps and specific checklist items for both feature development and bugfixes. - Reorganized guidance into distinct “Phases” with clear do’s/don’ts, sample shell commands, templates for Subagent, PR message, and commit messages. - Added compatibility and environment notes, metadata, and stricter enforcement of code-review integration. - Removed old references and legacy guides; all essential rules and examples are now included directly in the main documentation.
v1.0.5
- 移除了 SKILL.md 中关于兼容性和 openclaw metadata 的说明 - 其余内容未变,核心流程与规则保持一致
v1.0.4
**Summary: Adds reference docs and streamlines workflow in documentation.** - Added reference files: WORKFLOW.md, SUBAGENT_TEMPLATE.md, COMMIT.md for clearer workflow, usage, and commit guidelines - Updated SKILL.md: streamlined and clarified Git workflow steps, rules, and code samples - Improved pre-checks and clarified feature/fix requirements in documentation - Made "code-review" skill usage conditional, adding manual review guidance if unavailable - Updated and reorganized branch naming conventions, compatibility section, and references
v1.0.3
- 添加了兼容性说明,包括依赖环境、权限描述和认证提示,可读性更强。 - 明确强调 skill 必须在项目根目录(git 仓库)下执行,并补充了安全提示。 - 其余功能和使用流程无变动,仅文档补充完善。
v1.0.2
- Updated requirements configuration: replaced tools/credentials with binaries/env and introduced granular permissions for filesystem and subprocess access. - Removed explicit default model from Subagent task configuration; now uses system default unless otherwise specified in the task. - Clarified that all development tasks run via Subagent with the system's default model unless noted. - Improved and clarified documentation for permissions, environment variables, and process invocation. - No changes to functional workflow or core development principles; all process and safety rules remain enforced.
v1.0.1
- 增加了 author、repository、tags、requirements、permissions 信息至 skill 元数据,提升可用性与集成度 - 新增 _meta.json 文件,完善 skill 元数据结构 - 现支持 GITHUB_TOKEN 与 gh 工具集成,自动化 PR 流程 - 明确 skill 权限需求:读写文件、执行子进程 - 文档保持原有 Git 工作流规范与安全高标准
v1.0.0
- 初始发布 code-dev 技能,实现规范的 Git 分支管理、开发、PR 与 code-review 流程 - 强制禁止直接推送到 main 或跳过 PR/code-review,确保开发安全 - 支持 feature 开发和 bug 修复,区分分支和流程(需先理清代码库或分析 bug 根因) - 所有开发通过 subagent 自动化执行,统一开发、检查和提交流程 - 提供完整命名、提交信息、PR 模板和分支规范,便于标准化协作
元数据
Slug code-dev
版本 1.0.7
许可证 MIT-0
累计安装 4
当前安装数 4
历史版本数 8
常见问题

Code Dev 是什么?

规范的 Git 开发流程:分支管理 → 开发 → PR → Review → 合并。 支持新 feature 开发和 bug 修复,强制禁止直接推送到 main。 **触发条件(需同时满足)**: 1. 用户要求"开发"、"实现"、"新功能"、"修复"、"提交 PR" 2. 预估工作量 > 30 分钟 **或**... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1248 次。

如何安装 Code Dev?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install code-dev」即可一键安装,无需额外配置。

Code Dev 是免费的吗?

是的,Code Dev 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Code Dev 支持哪些平台?

Code Dev 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Code Dev?

由 Lucius.C(@luciuscao)开发并维护,当前版本 v1.0.7。

💬 留言讨论