微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🤖

后台驱动的智能编程助手

kilocli-coding-agent · vv0.0.9
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
专业技能 安全 S 级 作者 codewithnathan97 公开目录收录
433 下载 144 安装 1.3k 收藏 2.3k 浏览

简介

Kilo CLI 编程代理技能,通过后台进程实现自动化代码生成、PR 审查与批量任务处理,依托专业 CLI 工具提升开发效率。

原始描述

Run Kilo CLI via background process for programmatic control.

通过你的 Agent 添加

安装目录:kilocli-coding-agent/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/kilocli-coding-agent/
Codex CLI~/.codex/skills/kilocli-coding-agent/
DeepSeek Harness~/.agents/skills/kilocli-coding-agent/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

Kilo CLI Coding Agent 是一个将 Kilo CLI 集成到 OpenClaw 工作流的技能,主打后台优先的编程任务执行模式。核心用法围绕 bash workdir:XXX background:true 模式展开:用户指定工作目录后,在后台启动 Kilo CLI 进程执行代码生成、PR 审查等任务,通过 process 系列操作(log/poll/write/kill)进行会话管理。支持三种典型场景:

  1. 代码构建:使用 --full-auto 或 --yolo 标志让 Kilo CLI 自动完成项目搭建
  2. PR 审查:通过 git diff 对比分支差异,支持单条或批量并行审查
  3. 多 Issue 修复:结合 git worktree 和 tmux 实现隔离式并行开发

文档特别强调工作目录隔离原则——使用 mktemp -d 创建临时空间,避免在 ~/clawd// 等敏感目录运行,防止 Kilo CLI 读取无关文件或干扰 live 实例。

显著优点

  • 并行处理能力:可同时启动多个 Kilo CLI 会话处理批量 PR 审查,配合 process action:list 统一监控
  • 环境隔离机制:workdir 参数将代理限制在指定目录,,git worktree 实现分支级隔离,避免代码冲突
  • 灵活的任务模式:后台模式适合自动化脚本,tmux 模式保留交互能力,覆盖不同复杂度场景
  • 详尽的实践指南:提供 PR 模板(Razor Standard)、安全规则清单、并行修复的完整命令链,降低上手门槛

潜在缺点与局限性

  • 外部依赖重:必须预先全局安装 @kilocode/cli,且其安全性完全独立于本 skill
  • 无内置输入验证:用户提供的 prompt 直接传递给 Kilo CLI,存在间接命令注入风险
  • 网络行为不可控:所有网络操作由 Kilo CLI 代理,skill 本身无法审计或限制数据传输
  • 学习曲线陡峭:需要同时掌握 bash 后台进程管理、tmux 会话操作、git worktree 等进阶工具链
  • 平台限制:依赖 npm 生态和 Unix-like 环境,Windows 用户需额外配置

适合的目标群体

  • 技术团队负责人:需要批量审查 PR、分配修复任务的场景
  • 全栈开发者:希望用自然语言驱动代码生成,同时保持对执行过程的控制
  • 开源维护者:处理大量社区贡献时,可通过并行审查提升响应速度
  • DevOps 工程师:需要将 AI 编程能力集成到 CI/CD 或自动化脚本中

使用风险

  • 性能风险:并行启动过多 Kilo CLI 实例可能耗尽系统资源,建议根据 CPU/内存情况控制并发数
  • 依赖项风险:Kilo CLI 版本更新可能破坏兼容性,需锁定版本或及时跟进变更日志
  • 数据泄露风险:虽然 skill 建议隔离工作目录,但用户若忽视警告在敏感目录运行,可能导致内部文档被 Kilo CLI 读取
  • 会话残留风险:后台进程若未正确清理(kill),可能长期占用系统资源,建议配合 process action:list 定期检查

技能正文


name: kilocli-coding-agent description: Run Kilo CLI via background process for programmatic control.

IMPORTANT: You need to have Kilo CLI installed and configured so OpenClaw can use it without any issue.

npm install -g @kilocode/cli

Coding Agent (background-first)

Use bash background mode for non-interactive coding work. For interactive coding sessions, use the tmux skill (always, except very simple one-shot prompts).

The Pattern: workdir + background

# Create temp space for chats/scratch work
SCRATCH=$(mktemp -d)

# Start agent in target directory ("little box" - only sees relevant files)
bash workdir:$SCRATCH background:true command:"<agent command>"
# Or for project work:
bash workdir:~/project/folder background:true command:"<agent command>"
# Returns sessionId for tracking

# Monitor progress
process action:log sessionId:XXX

# Check if done  
process action:poll sessionId:XXX

# Send input (if agent asks a question)
process action:write sessionId:XXX data:"y"

# Kill if needed
process action:kill sessionId:XXX

Why workdir matters: Agent wakes up in a focused directory, doesn't wander off reading unrelated files (like your soul.md 😅).


Kilo CLI

Building/Creating (use --full-auto or --yolo)

bash workdir:~/project background:true command:"kilo run \"Build a snake game with dark theme\""

Reviewing PRs (vanilla, no flags)

⚠️ CRITICAL: Never review PRs in Clawdbot's own project folder!

  • Either use the project where the PR is submitted (if it's NOT ~/Projects/clawdbot)
  • Or clone to a temp folder first
# Option 1: Review in the actual project (if NOT clawdbot)
bash workdir:~/Projects/some-other-repo background:true command:"kilo run \"Review current branch against main branch\""

# Option 2: Clone to temp folder for safe review (REQUIRED for clawdbot PRs!)
REVIEW_DIR=$(mktemp -d)
git clone https://github.com/clawdbot/clawdbot.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130
bash workdir:$REVIEW_DIR background:true command:"kilo run \"Review current branch against main branch\""
# Clean up after: rm -rf $REVIEW_DIR

# Option 3: Use git worktree (keeps main intact)
git worktree add /tmp/pr-130-review pr-130-branch
bash workdir:/tmp/pr-130-review background:true command:"kilo run \"Review current branch against main branch\""

Why? Checking out branches in the running Clawdbot repo can break the live instance!

Batch PR Reviews (parallel army!)

# Fetch all PR refs first
git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'

# Deploy the army - one Kilo CLI per PR!
bash workdir:~/project background:true command:"kilo run \"Review PR #86. git diff origin/main...origin/pr/86\""
bash workdir:~/project background:true command:"kilo run \"Review PR #87. git diff origin/main...origin/pr/87\""
bash workdir:~/project background:true command:"kilo run \"Review PR #95. git diff origin/main...origin/pr/95\""
# ... repeat for all PRs

# Monitor all
process action:list

# Get results and post to GitHub
process action:log sessionId:XXX
gh pr comment <PR#> --body "<review content>"

Tips for PR Reviews

  • Fetch refs first: git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'
  • Use git diff: Tell Kilo CLI to use git diff origin/main...origin/pr/XX
  • Don't checkout: Multiple parallel reviews = don't let them change branches
  • Post results: Use gh pr comment to post reviews to GitHub

tmux (interactive sessions)

Use the tmux skill for interactive coding sessions (always, except very simple one-shot prompts). Prefer bash background mode for non-interactive runs.


Parallel Issue Fixing with git worktrees + tmux

For fixing multiple issues in parallel, use git worktrees (isolated branches) + tmux sessions:

# 1. Clone repo to temp location
cd /tmp && git clone git@github.com:user/repo.git repo-worktrees
cd repo-worktrees

# 2. Create worktrees for each issue (isolated branches!)
git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main

# 3. Set up tmux sessions
SOCKET="${TMPDIR:-/tmp}/kilo-fixes.sock"
tmux -S "$SOCKET" new-session -d -s fix-78
tmux -S "$SOCKET" new-session -d -s fix-99

# 4. Launch Kilo CLI in each (after npm install!)
tmux -S "$SOCKET" send-keys -t fix-78 "cd /tmp/issue-78 && npm install && kilo run 'Fix issue #78: <description>. Commit and push.'" Enter
tmux -S "$SOCKET" send-keys -t fix-99 "cd /tmp/issue-99 && npm install && kilo run 'Fix issue #99: <description>. Commit and push.'" Enter

# 5. Monitor progress
tmux -S "$SOCKET" capture-pane -p -t fix-78 -S -30
tmux -S "$SOCKET" capture-pane -p -t fix-99 -S -30

# 6. Check if done (prompt returned)
tmux -S "$SOCKET" capture-pane -p -t fix-78 -S -3 | grep -q "❯" && echo "Done!"

# 7. Create PRs after fixes
cd /tmp/issue-78 && git push -u origin fix/issue-78
gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..."

# 8. Cleanup
tmux -S "$SOCKET" kill-server
git worktree remove /tmp/issue-78
git worktree remove /tmp/issue-99

Why worktrees? Each Kilo CLI works in isolated branch, no conflicts. Can run 5+ parallel fixes!

Why tmux over bash background? Kilo CLI is interactive — needs TTY for proper output. tmux provides persistent sessions with full history capture.


⚠️ Rules

  1. Respect tool choice — if user asks for Kilo CLI, use Kilo CLI. NEVER offer to build it yourself!
  2. Be patient — don't kill sessions because they're "slow"
  3. Monitor with process:log — check progress without interfering
  4. --full-auto for building — auto-approves changes
  5. vanilla for reviewing — no special flags needed
  6. Parallel is OK — run many Kilo CLI processes at once for batch work
  7. NEVER start Kilo CLI in ~/clawd/ — it'll read your soul docs and get weird ideas about the org chart! Use the target project dir or /tmp for blank slate chats
  8. NEVER checkout branches in ~/Projects/clawdbot/ — that's the LIVE Clawdbot instance! Clone to /tmp or use git worktree for PR reviews

PR Template (The Razor Standard)

When submitting PRs to external repos, use this format for quality & maintainer-friendliness:

## Original Prompt
[Exact request/problem statement]

## What this does
[High-level description]

**Features:**
- [Key feature 1]
- [Key feature 2]

**Example usage:**
```bash
# Example
command example
```

## Feature intent (maintainer-friendly)
[Why useful, how it fits, workflows it enables]

## Prompt history (timestamped)
- YYYY-MM-DD HH:MM UTC: [Step 1]
- YYYY-MM-DD HH:MM UTC: [Step 2]

## How I tested
**Manual verification:**
1. [Test step] - Output: `[result]`
2. [Test step] - Result: [result]

**Files tested:**
- [Detail]
- [Edge cases]

## Session logs (implementation)
- [What was researched]
- [What was discovered]
- [Time spent]

## Implementation details
**New files:**
- `path/file.ts` - [description]

**Modified files:**
- `path/file.ts` - [change]

**Technical notes:**
- [Detail 1]
- [Detail 2]

---

Key principles:

  1. Human-written description (no AI slop)
  2. Feature intent for maintainers
  3. Timestamped prompt history
  4. Session logs if using Kilo CLI agent

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

development-engineeringautomationgitdevopsproductivitybackendproject-program-management

同类 Skill