trouble-shooting

v1.0.0

问题排查与上下文隔离。用户说报错了/遇到问题时,创建隔离环境(worktree/subagent)专门排查,当前主线上下文保持不变。解决后回到主线继续。触发词:报错了、有问题、排查。

1· 71·0 current·0 all-time
byGracie ♡@graceqx

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for graceqx/trouble-shooting.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "trouble-shooting" (graceqx/trouble-shooting) from ClawHub.
Skill page: https://clawhub.ai/graceqx/trouble-shooting
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install trouble-shooting

ClawHub CLI

Package manager switcher

npx clawhub@latest install trouble-shooting
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
The skill's name/description match what the included scripts do: create isolated troubleshooting environments, save snapshots, apply/discard changes, and archive results. However, the package metadata declares no required binaries while the scripts call git heavily (git worktree, git merge, git branch, git checkout). Git is a legitimate dependency for this purpose but is not declared.
Instruction Scope
SKILL.md stays on-topic describing worktree vs subagent flows. The runtime scripts operate on the local repository and filesystem: writing .trouble-shooting/active.json and archive files, creating/removing worktrees, merging branches, and deleting temporary branches. There are no network endpoints or secret exfiltration steps. The instructions give the agent discretion to create and apply changes in the repo, so user consent/confirmation before applying merges is important.
Install Mechanism
This is instruction-only with bundled scripts and no install spec; nothing is downloaded or executed from remote URLs. That is a low-risk install profile.
Credentials
The skill requests no environment variables or external credentials and the scripts do not attempt to read secrets or external configs. The local file writes are limited to a .trouble-shooting directory and git operations on the repository.
Persistence & Privilege
always is false and the skill does not request system-wide persistent privileges. It creates local state (.trouble-shooting) inside the working directory and manipulates git branches, which is appropriate for a troubleshooting helper but does modify repository state.
Assessment
Before installing or running this skill: 1) Be aware it expects git to be available (scripts call git commands) though git is not declared; install git if needed. 2) The scripts will create a .trouble-shooting directory, temporary worktree folders, and temporary git branches (named trouble/<id>), and may merge changes into your current branch or delete branches — back up or commit/uncommitted-work stash before using. 3) Review the three included Python scripts (start/finish/list) — they run local subprocesses and modify the repo; ensure you trust them in your environment. 4) During 'apply' the tool attempts an automatic merge (git merge --no-edit) and will fail if conflicts exist; be prepared to resolve conflicts manually. 5) If you need stricter safety, run start_troubleshoot.py in 'subagent' mode (no worktree) or run the scripts in a disposable clone first. If you want higher assurance, ask the author to declare git as a required binary and to add explicit confirmation prompts before destructive operations.

Like a lobster shell, security has layers — review code before you run it.

latestvk973z7cfdkxdbnksrmf9mgrf9h85f7zb
71downloads
1stars
1versions
Updated 4d ago
v1.0.0
MIT-0

Trouble Shooting - 上下文隔离的问题排查

核心概念

  • 主线 Agent:当前的所有对话历史 = 主线任务,保持不变
  • 隔离环境:新建的 worktree/subagent,专门用于排查问题
  • 切换:遇到问题 → 切到隔离环境 → 解决 → 切回主线

工作流程

主线 Agent(当前所有上下文)
       ↓ 用户说"报错了"
   ━━━━━━━━━━━━━━━━━━━━━
   启动隔离排查
   ━━━━━━━━━━━━━━━━━━━━━
       ↓
  创建隔离环境(二选一)
  ┌────────────────────┐
  │ 选项1: Worktree    │  ← 物理隔离,推荐
  │ 选项2: Subagent    │  ← 逻辑隔离,worktree 失败时用
  └────────────────────┘
       ↓
  [在隔离环境内排查问题]
       ↓
  用户确认解决 / 说"解决了"
       ↓
  销毁隔离环境
       ↓
  回到主线 Agent(上下文完整保留)

使用方式

1. 启动排查

触发:说"报错了"、"有问题"、或直接 /trouble-shooting

交互

用户:报错了,useEffect 无限循环

Claude(主线 Agent):
🔧 启动问题排查

当前主线上下文已保护。
创建隔离环境...

请选择:
[1] Worktree 隔离(推荐,文件系统级隔离)
[2] Subagent 隔离(快速,上下文级隔离)

用户:1

Claude:
✅ Worktree 已创建: ../project-trouble-0327-xxxx
🔍 切换到隔离环境排查问题...

[自动进入 worktree,开始排查]

2. 在隔离环境内排查

Worktree 模式

  • 在新目录中修改代码,不会影响原分支
  • 可以自由尝试各种解决方案
  • 找到方案后,可以选择应用 worktree 的变更或丢弃

Subagent 模式

  • 创建子 agent,只接收问题相关信息
  • 子 agent 分析后返回诊断结果
  • 主线 agent 根据结果决定是否应用方案

3. 结束排查

找到解决方案后,询问用户:

💡 问题定位完成
原因:useEffect 缺少依赖数组
方案:添加 [userId] 依赖

请确认:
[1] 问题解决,应用变更并回到主线
[2] 继续排查
[3] 放弃本次尝试,回到主线(丢弃隔离环境变更)

用户:1

4. 回到主线

Claude:
✅ 隔离环境变更已应用
🗑️ 隔离环境已清理
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 回到主线

主线上下文完整保留,继续之前的任务...

完整示例(Worktree 模式)

主 Agent(主线):
用户:
正在开发登录页面,现在用 useEffect 做轮询,
但是报错了说 Maximum update depth exceeded
[上下文...]

Claude:
🔧 启动问题排查(Worktree 隔离)
主线上下文已保护

✅ 创建 worktree: ../project-trouble-0327-a1b2
正在切换到隔离环境...

--- 【切换到 Worktree】 ---

隔离环境 Agent:
让我分析这个问题...

查看 src/pages/Login.tsx 第 45 行:
问题确认:useEffect 中 setState 且未指定依赖数组

试修方案:
```diff
- useEffect(() => {
+ useEffect(() => {
     const timer = setInterval(refresh, 5000);
     return () => clearInterval(timer);
- });
+ }, [userId]);

验证通过,问题解决。

--- 【回到主 Agent】 ---

Claude: 💡 诊断结果:缺少依赖数组 ✅ 已在隔离环境验证

请确认: [1] 应用变更并回到主线 ← [2] 继续排查 [3] 放弃

用户:1

Claude: ✅ 已应用变更 🗑️ 已清理 worktree ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎯 回到主线

登录页面开发继续... [主线上下文完整保留]


## 隔离策略选择

| 策略 | 适用场景 | 特点 |
|-----|---------|------|
| Worktree | 需要修改代码验证 | 物理隔离,安全可靠 |
| Subagent | 纯诊断分析 | 轻量快速,无文件变更 |

默认优先尝试 Worktree,失败时自动降级到 Subagent。

## 命令别名

- `/trouble-shooting` - 启动排查
- `/trouble-shooting solved` - 手动标记解决
- `/trouble-shooting back` - 放弃排查,回到主线

## 脚本说明

| 脚本 | 用途 |
|-----|------|
| `start_troubleshoot.py <title>` | 保存主线快照,创建隔离环境 |
| `finish_troubleshoot.py <apply|discard>` | 应用或丢弃变更,清理隔离环境 |
| `list_troubleshoots.py` | 列出历史问题及解决方案 |

## 核心原则

1. **主线无需确认**:当前 agent 的所有上下文就是主线
2. **切出去解决**:真正的隔离,不在当前上下文解决
3. **回来无感**:主线上下文自动保留,无缝继续

Comments

Loading comments...