mcpField
W
wizard

wizard

github.com/terrylicaAgent 工作流145 次安装1 天前更新
代码仓库

关于 wizard

这是一个交互式 RU 配置 Skill,引导用户选择工作领域、将其标记为鼓励或禁止,并解决冲突。最终指导会保存到项目配置中。

主要功能

  1. 01选择工作领域
  2. 02将项目分类为鼓励或禁止
  3. 03添加自定义工作领域
  4. 04解决指导冲突
  5. 05清空现有指导

适用场景

  1. 01设置 RU 工作循环的优先事项
  2. 02排除指定工作领域
  3. 03添加自定义指导并处理重叠项

安装

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

$npx skills add https://github.com/terrylica/cc-skills --skill wizard

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

附带文件references/evolution-log.md

详细介绍

RU:向导

使用 AskUserQuestion 的交互式配置向导。中立地展示工作类别,让用户将每项归类为鼓励或禁止,然后解决冲突。

自我进化技能:此技能会在使用过程中不断改进。如果指令有误、参数发生偏移,或需要采用变通方案,请立即修复此文件,不要拖延。仅针对真实且可复现的问题进行更新。

参数

  • --clear:开始前清除现有指导(全新配置)

步骤 1:选择工作领域

中立地展示所有工作类别。让用户选择要配置的类别:

questions:
  - question: "Which work areas do you want to configure? (Select all relevant)"
    header: "Work Areas"
    multiSelect: true
    options:
      - label: "Bug fixes"
        description: "Fix errors, exceptions, crashes"
      - label: "Feature completion"
        description: "Finish incomplete features"
      - label: "Performance"
        description: "Speed, memory, efficiency"
      - label: "Error handling"
        description: "Edge cases, validation"
      - label: "Security"
        description: "Vulnerability fixes, auth improvements"
      - label: "Documentation"
        description: "README, docstrings, comments"
      - label: "Dependency upgrades"
        description: "Version bumps, lock files"
      - label: "Code formatting"
        description: "Linting, style changes"
      - label: "Test expansion"
        description: "Adding tests for existing code"
      - label: "Refactoring"
        description: "Code restructuring, DRY improvements"
      - label: "API changes"
        description: "Endpoints, contracts, interfaces"
      - label: "Database changes"
        description: "Schema, migrations, queries"

步骤 2:为每项选择分类

对于步骤 1 中选择的每一项,询问是鼓励还是禁止:

questions:
  - question: "For '[ITEM]': Should RU prioritize or avoid this?"
    header: "Classify"
    multiSelect: false
    options:
      - label: "Encourage (Prioritize)"
        description: "RU should actively seek this type of work"
      - label: "Forbid (Avoid)"
        description: "RU should not work on this unless necessary"
      - label: "Skip (No preference)"
        description: "Leave neutral, neither prioritize nor avoid"

对每项所选内容重复此操作。跟踪归类为以下类别的项目:

  • 鼓励:添加到 guidance.encouraged[]
  • 禁止:添加到 guidance.forbidden[]
  • 跳过:不添加到任一列表

步骤 3:自定义项目

询问用户是否要添加预定义列表中没有的自定义项目:

questions:
  - question: "Do you want to add custom work areas?"
    header: "Custom"
    multiSelect: false
    options:
      - label: "No, use selected items only"
        description: "Proceed with the items already configured"
      - label: "Yes, add custom items"
        description: "I'll type specific topics to configure"

如果用户选择“是”,提示输入文本,然后针对每个自定义项目询问:

  • “鼓励还是禁止‘[custom item]’?”

步骤 4:检测冲突

完成所有分类后,检查是否存在冲突(同一项目同时出现在鼓励列表和禁止列表中)。

以下情况可能导致冲突:

  • 用户意外地在两个类别中选中了同一项目
  • 自定义项目与预定义类别重复

如果检测到冲突:

questions:
  - question: "'[ITEM]' is marked both Encouraged AND Forbidden. Which takes priority?"
    header: "Conflict"
    multiSelect: false
    options:
      - label: "Encourage wins"
        description: "Prioritize this work, remove from forbidden"
      - label: "Forbid wins"
        description: "Avoid this work, remove from encouraged"
      - label: "Remove both"
        description: "Leave neutral, no guidance for this item"

对每项冲突重复此操作,直到全部解决。

步骤 5:保存配置

收集并验证所有选择后,运行此脚本进行保存:

/usr/bin/env bash << 'RU_CONFIGURE_SAVE'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"

# Ensure config file exists with guidance structure
mkdir -p "$PROJECT_DIR/.claude"
if [[ ! -f "$CONFIG_FILE" ]]; then
    echo '{"guidance": {"forbidden": [], "encouraged": []}}' > "$CONFIG_FILE"
fi

# Ensure guidance structure exists
if ! jq -e '.guidance' "$CONFIG_FILE" >/dev/null 2>&1; then
    jq '. + {guidance: {forbidden: [], encouraged: []}}' "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
fi

echo "Configuration saved to: $CONFIG_FILE"
echo ""
echo "Current guidance:"
echo "  Forbidden: $(jq -r '.guidance.forbidden | length' "$CONFIG_FILE") items"
echo "  Encouraged: $(jq -r '.guidance.encouraged | length' "$CONFIG_FILE") items"
echo ""
jq -r '.guidance.forbidden[]' "$CONFIG_FILE" 2>/dev/null | while read item; do
    echo "  ✗ FORBID: $item"
done
jq -r '.guidance.encouraged[]' "$CONFIG_FILE" 2>/dev/null | while read item; do
    echo "  ✓ ENCOURAGE: $item"
done
echo ""
echo "To view: /ru:settings show"
echo "To modify: /ru:forbid or /ru:encourage"
RU_CONFIGURE_SAVE

流程摘要

┌─────────────────────────────────────────────────────────────┐
│  Step 1: Work Area Selection (neutral, multiSelect)         │
│  [ ] Bug fixes    [ ] Features     [ ] Performance          │
│  [ ] Docs         [ ] Deps         [ ] Formatting           │
│  [ ] Tests        [ ] Security     [ ] Refactoring          │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│  Step 2: Classify Each (for each selected item)             │
│  "For 'Bug fixes': Encourage / Forbid / Skip?"              │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│  Step 3: Custom Items (optional)                            │
│  "Add custom work areas?" → If yes, classify each           │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│  Step 4: Conflict Resolution (if any)                       │
│  "'X' is both Encouraged AND Forbidden. Which wins?"        │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│  Step 5: Save config + Display summary                      │
└─────────────────────────────────────────────────────────────┘

添加项目辅助工具

使用以下 bash 代码片段添加 AskUserQuestion 选择的项目:

/usr/bin/env bash << 'ADD_GUIDANCE_ITEM'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"
TYPE="${1:-forbidden}"  # "forbidden" or "encouraged"
ITEM="${2:-}"           # Item to add

if [[ -z "$ITEM" ]]; then
    exit 0
fi

# Ensure file exists
mkdir -p "$PROJECT_DIR/.claude"
if [[ ! -f "$CONFIG_FILE" ]]; then
    echo '{"guidance": {"forbidden": [], "encouraged": []}}' > "$CONFIG_FILE"
fi

# Add item with timestamp
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
jq --arg item "$ITEM" --arg ts "$TIMESTAMP" \
    ".guidance.${TYPE} = ((.guidance.${TYPE} // []) + [\$item] | unique) | .guidance.timestamp = \$ts" \
    "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
ADD_GUIDANCE_ITEM

清除指导辅助工具

使用 --clear 参数在启动向导前重置:

/usr/bin/env bash << 'CLEAR_GUIDANCE'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"

if [[ -f "$CONFIG_FILE" ]]; then
    TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
    jq --arg ts "$TIMESTAMP" \
        '.guidance = {forbidden: [], encouraged: [], timestamp: $ts}' \
        "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
    echo "Guidance cleared."
fi
CLEAR_GUIDANCE

故障排除

问题原因解决方案
jq 错误配置文件格式错误运行 /ru:settings reset 重新创建
未显示选项AskUserQuestion 问题检查是否设置了 multiSelect
配置未保存缺少 .claude 目录使用 mkdir -p .claude 创建
未显示冲突同一项目大小写不同对项目使用完全相同的文本
自定义输入为空跳过了文本提示重新运行向导并输入项目

执行后反思

此技能完成后,在结束任务前进行反思:

  1. 确认位置。 — 找到此 SKILL.md 的规范路径,然后再编辑。
  2. 哪里出了问题? — 修复导致问题的指令。
  3. 有什么效果超出预期? — 将其提升为推荐实践。
  4. 有什么发生了偏移? — 修复任何已不符合实际情况的脚本、引用或依赖项。
  5. 记录下来。 — 在演进日志中记录触发原因、修复内容和证据。

不要拖延。下一次调用会继承你留下的一切。

评论

支持 Markdown