mcpField
I
issue-discover

issue-discover

github.com/catlog22测试与质量2.1k67 次安装19 周前更新
代码仓库

关于 issue-discover

issue-discover 是用于创建问题和发现潜在问题的技能,支持按多个视角或提示词探索。它会将请求路由到对应阶段,并通过 `ccw issue` 命令行处理问题数据。

主要功能

  1. 01根据 URL 或描述创建问题
  2. 02从多个视角发现问题
  3. 03根据提示词迭代探索
  4. 04自动识别操作并支持自动模式

适用场景

  1. 01根据 GitHub URL 创建问题
  2. 02检查代码路径中的错误或安全问题
  3. 03使用提示词探索代码库中的问题

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/catlog22/claude-code-workflow --skill issue-discover

安装后在 Claude Code 中输入/issue-discover确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

phases/
01-issue-new.md
02-discover.md
03-discover-by-prompt.md
04-quick-execute.md

详细介绍

Issue Discover

涵盖三个入口的统一问题发现与创建技能:手动创建问题、基于视角的问题发现,以及提示词驱动的探索。

架构概览

┌─────────────────────────────────────────────────────────────────┐
│  Issue Discover Orchestrator (SKILL.md)                          │
│  → Action selection → Route to phase → Execute → Summary         │
└───────────────┬─────────────────────────────────────────────────┘
                │
                ├─ request_user_input: Select action
                │
    ┌───────────┼───────────┬───────────┐
    ↓           ↓           ↓           │
┌─────────┐ ┌─────────┐ ┌─────────┐   │
│ Phase 1 │ │ Phase 2 │ │ Phase 3 │   │
│  Create │ │Discover │ │Discover │   │
│   New   │ │  Multi  │ │by Prompt│   │
└─────────┘ └─────────┘ └─────────┘   │
     ↓           ↓           ↓          │
  Issue      Discoveries  Discoveries   │
(registered)  (export)    (export)      │
     │           │           │          │
     │           ├───────────┤          │
     │           ↓                      │
     │     ┌───────────┐               │
     │     │  Phase 4  │               │
     │     │Quick Plan │               │
     │     │& Execute  │               │
     │     └─────┬─────┘               │
     │           ↓                      │
     │     .task/*.json                 │
     │           ↓                      │
     │     Direct Execution             │
     │           │                      │
     └───────────┴──────────────────────┘
                  ↓ (fallback/remaining)
          issue-resolve (plan/queue)
                  ↓
            /issue:execute

核心设计原则

  1. 操作驱动路由:由 request_user_input 选择操作,然后加载单个阶段
  2. 渐进式阶段加载:仅阅读所选阶段文档
  3. CLI 优先的数据访问:所有问题的 CRUD 操作均通过 ccw issue CLI 命令执行
  4. 支持自动模式:-y 标志跳过操作选择并自动检测
  5. 子 Agent 生命周期:通过 spawn_agent → wait_agent → close_agent 显式管理生命周期
  6. 按路径加载角色:在 MANDATORY FIRST STEPS 中通过路径引用加载子 Agent 角色

自动模式

使用 --yes 或 -y 时:跳过操作选择,根据输入类型自动检测操作。

用法

issue-discover <input>
issue-discover [FLAGS] "<input>"

# Flags
-y, --yes              Skip all confirmations (auto mode)
--action <type>        Pre-select action: new|discover|discover-by-prompt

# Phase-specific flags
--priority <1-5>       Issue priority (new mode)
--perspectives <list>  Comma-separated perspectives (discover mode)
--external             Enable Exa research (discover mode)
--scope <pattern>      File scope (discover/discover-by-prompt mode)
--depth <level>        standard|deep (discover-by-prompt mode)
--max-iterations <n>   Max exploration iterations (discover-by-prompt mode)

# Examples
issue-discover https://github.com/org/repo/issues/42                              # Create from GitHub
issue-discover "Login fails with special chars"                                    # Create from text
issue-discover --action discover src/auth/**                                       # Multi-perspective discovery
issue-discover --action discover src/api/** --perspectives=security,bug            # Focused discovery
issue-discover --action discover-by-prompt "Check API contracts"                   # Prompt-driven discovery
issue-discover -y "auth broken"                                                    # Auto mode create

执行流程

Input Parsing:
   └─ Parse flags (--action, -y, --perspectives, etc.) and positional args

Action Selection:
   ├─ --action flag provided → Route directly
   ├─ Auto-detect from input:
   │   ├─ GitHub URL or #number → Create New (Phase 1)
   │   ├─ Path pattern (src/**, *.ts) → Discover (Phase 2)
   │   ├─ Short text (< 80 chars) → Create New (Phase 1)
   │   └─ Long descriptive text (≥ 80 chars) → Discover by Prompt (Phase 3)
   └─ Otherwise → request_user_input to select action
   └─ Initialize progress tracking: functions.update_plan([...phases])

Phase Execution (load one phase):
   ├─ Phase 1: Create New          → phases/01-issue-new.md
   ├─ Phase 2: Discover            → phases/02-discover.md
   └─ Phase 3: Discover by Prompt  → phases/03-discover-by-prompt.md

Post-Phase:
   └─ Summary + Next steps recommendation
阶段参考文档
阶段文档加载时机用途
阶段 1phases/01-issue-new.md操作 = 创建新问题根据 GitHub URL 或文本描述创建问题
阶段 2phases/02-discover.md操作 = 发现从多个视角发现问题(bug、安全、测试等)
阶段 3phases/03-discover-by-prompt.md操作 = 按提示词发现通过 Gemini 规划进行提示词驱动的迭代探索
阶段 4phases/04-quick-execute.md阶段后 = 快速规划并执行将高置信度发现转为任务并直接执行

核心规则

  1. 先选择操作:加载任何阶段前,始终先确定操作
  2. 仅加载单个阶段:只阅读所选阶段文档,绝不加载所有阶段
  3. CLI 数据访问:所有问题操作均使用 ccw issue CLI,绝不直接读取文件
  4. 保留内容:每个阶段都包含原始命令中的完整执行逻辑
  5. 自动检测输入:智能解析输入,减少显式指定 --action 标志的需要
  6. ⚠️ 关键:不要停止:这是一个连续的多阶段工作流。每个阶段完成后,立即继续下一阶段
  7. 渐进式阶段加载:仅在某阶段即将执行时才阅读其文档
  8. 显式生命周期管理:wait_agent 完成后始终调用 close_agent,以释放资源

输入处理

自动检测逻辑
function detectAction(input, flags) {
  // 1. Explicit --action flag
  if (flags.action) return flags.action;

  const trimmed = input.trim();

  // 2. GitHub URL → new
  if (trimmed.match(/github\.com\/[\w-]+\/[\w-]+\/issues\/\d+/) || trimmed.match(/^#\d+$/)) {
    return 'new';
  }

  // 3. Path pattern (contains **, /, or --perspectives) → discover
  if (trimmed.match(/\*\*/) || trimmed.match(/^src\//) || flags.perspectives) {
    return 'discover';
  }

  // 4. Short text (< 80 chars, no special patterns) → new
  if (trimmed.length > 0 && trimmed.length < 80 && !trimmed.includes('--')) {
    return 'new';
  }

  // 5. Long descriptive text → discover-by-prompt
  if (trimmed.length >= 80) {
    return 'discover-by-prompt';
  }

  // Cannot auto-detect → ask user
  return null;
}
操作选择(request_user_input)
// When action cannot be auto-detected
const answer = functions.request_user_input({
  questions: [{
    header: "Action",
    id: "action",
    question: "What would you like to do?",
    options: [
      {
        label: "Create New Issue (Recommended)",
        description: "Create issue from GitHub URL, text description, or structured input"
      },
      {
        label: "Discover Issues",
        description: "Multi-perspective discovery: bug, security, test, quality, performance, etc."
      },
      {
        label: "Discover by Prompt",
        description: "Describe what to find — Gemini plans the exploration strategy iteratively"
      }
    ]
  }]
});  // BLOCKS (wait for user response)

// Route based on selection
// answer.answers.action.answers[0] → selected label
const actionMap = {
  "Create New Issue (Recommended)": "new",
  "Discover Issues": "discover",
  "Discover by Prompt": "discover-by-prompt"
};

// Initialize progress tracking (MANDATORY)
functions.update_plan([
  { id: "action-select", title: "Action Selection", status: "completed" },
  { id: "phase-exec", title: `Phase: ${selectedAction}`, status: "in_progress" },
  { id: "post-phase", title: "Post-Phase: Next Steps", status: "pending" }
])

数据流

User Input (URL / text / path pattern / descriptive prompt)
    ↓
[Parse Flags + Auto-Detect Action]
    ↓
[Action Selection] ← request_user_input (if needed)
    ↓
[Read Selected Phase Document]
    ↓
[Execute Phase Logic]
    ↓
[Summary + Next Steps]
    ├─ After Create → Suggest issue-resolve (plan solution)
    └─ After Discover → Suggest export to issues, then issue-resolve

子 Agent API 参考

spawn_agent

创建新的子 Agent 并分配任务。

const agentId = spawn_agent({
  agent_type: "{agent_type}",
  message: `
## TASK ASSIGNMENT

### MANDATORY FIRST STEPS (Agent Execute)
1. Execute: ccw spec load --category exploration
2. Execute: ccw spec load --category debug (known issues cross-reference)

## TASK CONTEXT
${taskContext}

## DELIVERABLES
${deliverables}
`
})
wait_agent

获取子 Agent 的结果(这是获取结果的唯一方式)。

const result = wait_agent({
  timeout_ms: 1800000  // 30 minutes
})

if (result.timed_out) {
  // Handle timeout via 4-step cascade: status probe → force finalize → close
}

// Check completion status
if (result.status[agentId].completed) {
  const output = result.status[agentId].completed;
}
followup_task

向活动中的子 Agent 分配新工作(用于澄清或跟进)。

followup_task({
  target: agentId,
  message: `
## CLARIFICATION ANSWERS
${answers}

## NEXT STEP
Continue with plan generation.
`
})
close_agent

清理子 Agent 资源(不可撤销)。

close_agent({ target: agentId })

核心指南

数据访问原则:问题文件可能非常大。为避免上下文溢出:

操作正确方式错误方式
列出问题(简要)ccw issue list --status pending --briefRead('issues.jsonl')
读取问题详情ccw issue status <id> --jsonRead('issues.jsonl')
创建问题echo '...' | ccw issue create直接写入文件
更新状态ccw issue update <id> --status ...直接编辑文件

始终使用 CLI 命令执行 CRUD 操作。绝不直接读取整个 issues.jsonl。

错误处理

错误解决方法
未检测到操作显示包含全部 3 个选项的 request_user_input
操作类型无效显示可用操作并重新提示
阶段执行失败报告错误,建议手动处理
未匹配到文件(发现)检查目标模式并确认路径存在
Gemini 规划失败(按提示词发现)使用 qwen 备用方案重试
Agent 生命周期错误确保在错误处理路径中调用 close_agent,以防资源泄漏

阶段执行后的下一步

进度:functions.update_plan([{id: "phase-exec", status: "completed"}, {id: "post-phase", status: "in_progress"}])

阶段执行成功后,建议采取以下下一步操作:

// After Create New (issue created)
functions.request_user_input({
  questions: [{
    header: "Next Step",
    id: "next_after_create",
    question: "Issue created. What next?",
    options: [
      { label: "Plan Solution (Recommended)", description: "Generate solution via issue-resolve" },
      { label: "Create Another", description: "Create more issues" },
      { label: "Done", description: "Exit workflow" }
    ]
  }]
});  // BLOCKS (wait for user response)
// answer.answers.next_after_create.answers[0] → selected label

// After Discover / Discover by Prompt (discoveries generated)
functions.request_user_input({
  questions: [{
    header: "Next Step",
    id: "next_after_discover",
    question: `Discovery complete: ${findings.length} findings, ${executableFindings.length} executable. What next?`,
    options: [
      { label: "Quick Plan & Execute (Recommended)", description: `Fix ${executableFindings.length} high-confidence findings directly` },
      { label: "Export to Issues", description: "Convert discoveries to issues" },
      { label: "Done", description: "Exit workflow" }
    ]
  }]
});  // BLOCKS (wait for user response)
// answer.answers.next_after_discover.answers[0] → selected label
// If "Quick Plan & Execute (Recommended)" → Read phases/04-quick-execute.md, execute

// Mark workflow complete
functions.update_plan([{ id: "post-phase", status: "completed" }])

相关技能和命令

  • issue-resolve - 规划解决方案、转换产物、根据头脑风暴结果创建队列
  • issue-manage - 交互式问题 CRUD 操作
  • /issue:execute - 使用基于 DAG 的并行编排执行队列
  • ccw issue list - 列出所有问题
  • ccw issue status <id> - 查看问题详情

评论

支持 Markdown