improve-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ABOUTME: Skill for analyzing Claude Code sessions to improve or create skills

ABOUTME: 用于分析Claude Code会话以改进或创建Skill的工具

ABOUTME: Extracts session transcripts and provides structured improvement workflows

ABOUTME: 提取会话记录并提供结构化的改进工作流

Improve Skill

改进Skill

Analyze Claude Code session transcripts to enhance existing skills or create new ones.
分析Claude Code会话记录,以优化现有Skill或创建新Skill。

When to Use This Skill vs Others

何时使用本Skill而非其他Skill

Use improve-skill When:

当以下情况时使用improve-skill:

  • You've just finished a debugging/automation session and want to analyze it
  • You need to extract session transcript for offline review
  • You want to identify what went wrong in your workflow
  • You're creating new skills from successful workflows
  • You want to improve existing skills based on what you learned
  • Decision: Use AFTER you've completed a web-automation session
  • 你刚完成调试/自动化会话,想要对其进行分析
  • 你需要提取会话记录用于离线查看
  • 你想要识别工作流中出现的问题
  • 你正从成功的工作流中创建新Skill
  • 你想要根据所学改进现有Skill
  • 决策建议:在完成Web自动化会话后使用

Use web-automation When:

当以下情况时使用web-automation:

  • You're actively debugging or automating something NOW
  • Decision: Use BEFORE you would use improve-skill (this is the "doing" skill)
  • 你当前正在进行调试或自动化操作
  • 决策建议:在使用improve-skill之前使用(这是“执行”类Skill)

Typical Workflow

典型工作流

1. Run web-automation to debug/automate
   (this is the "doing" phase)

2. Save session transcript

3. Use improve-skill to analyze what happened
   (this is the "learning" phase)

4. Update skill documentation based on findings

5. Next time, your updated skill helps you work faster
1. 运行web-automation进行调试/自动化操作
   (这是“执行”阶段)

2. 保存会话记录

3. 使用improve-skill分析会话过程
   (这是“学习”阶段)

4. 根据分析结果更新Skill文档

5. 下次使用时,更新后的Skill可帮助你提升工作效率

🔄 RESUMED SESSION CHECKPOINT

🔄 恢复会话检查点

When a session is resumed from context compaction, verify skill improvement state:
┌─────────────────────────────────────────────────────────────┐
│  SESSION RESUMED - IMPROVE-SKILL VERIFICATION               │
│                                                             │
│  Before continuing skill improvement work:                  │
│                                                             │
│  1. Was I in the middle of session analysis?                │
│     → Check /tmp/ for extracted transcripts                 │
│     → Check summary for "analyzing", "extracting"           │
│                                                             │
│  2. Was I updating a skill?                                 │
│     → Check which skill was being modified                  │
│     → Run: uv run validate_skill.py on the skill            │
│                                                             │
│  3. Did the previous work complete?                         │
│     → Check todo list for pending analysis tasks            │
│     → Verify skill validation passed                        │
│                                                             │
│  If analysis was in progress:                               │
│  → Re-run the extraction/analysis scripts                   │
│  → Do NOT assume previous analysis is still valid           │
└─────────────────────────────────────────────────────────────┘
当从上下文压缩恢复会话时,请验证Skill改进状态:
┌─────────────────────────────────────────────────────────────┐
│  会话已恢复 - IMPROVE-SKILL 验证                           │
│                                                             │
│  在继续Skill改进工作之前:                                  │
│                                                             │
│  1. 我是否正在进行会话分析?                                │
│     → 检查/tmp/目录下的提取出的会话记录                     │
│     → 检查摘要中是否包含“analyzing”、“extracting”字样        │
│                                                             │
│  2. 我是否正在更新某个Skill?                                │
│     → 确认正在修改的Skill名称                               │
│     → 运行:uv run validate_skill.py 对该Skill进行验证       │
│                                                             │
│  3. 之前的工作是否已完成?                                  │
│     → 检查待办事项列表中是否有未完成的分析任务               │
│     → 验证Skill是否通过了有效性检查                         │
│                                                             │
│  如果分析正在进行中:                                       │
│  → 重新运行提取/分析脚本                                   │
│  → 请勿假设之前的分析结果仍然有效                           │
└─────────────────────────────────────────────────────────────┘

Quick Reference

快速参考

ScriptPurpose
extract_session.py
Extract session transcript to markdown
analyze_session.py
Analyze session for skill improvements
Run any script with
--help
for full options:
bash
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --help
脚本用途
extract_session.py
将会话记录提取为markdown格式
analyze_session.py
分析会话以提出Skill改进建议
运行任意脚本时添加
--help
参数查看完整选项:
bash
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --help

Workflows

工作流

1. Improve an Existing Skill

1. 改进现有Skill

When a skill didn't work as expected, extract the session and analyze it:
bash
undefined
当Skill未按预期工作时,提取会话记录并进行分析:
bash
undefined

Step 1: Extract the session transcript

步骤1:提取会话记录

uv run ~/.claude/skills/improve-skill/scripts/extract_session.py
--session-id <session-id>
--output /tmp/session.md
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py
--session-id <session-id>
--output /tmp/session.md

Step 2: Analyze for improvements

步骤2:分析并提出改进建议

uv run ~/.claude/skills/improve-skill/scripts/analyze_session.py
--transcript /tmp/session.md
--skill ~/.claude/skills/<skill-name>/SKILL.md
--output /tmp/analysis.md

Then start a **new Claude Code session** with:
Review the analysis in /tmp/analysis.md and update the skill accordingly.

**Why a new session?** Starting fresh ensures only the transcript and skill are loaded,
without prior context influencing the analysis.
uv run ~/.claude/skills/improve-skill/scripts/analyze_session.py
--transcript /tmp/session.md
--skill ~/.claude/skills/<skill-name>/SKILL.md
--output /tmp/analysis.md

随后启动一个**新的Claude Code会话**,并输入:
查看/tmp/analysis.md中的分析结果,并相应更新Skill。

**为何需要新会话?** 全新的会话可确保仅加载会话记录与目标Skill,避免过往上下文影响分析结果。

2. Create a New Skill from Session

2. 从会话创建新Skill

When you've done something successfully and want to capture it as a skill:
bash
undefined
当你成功完成某项操作并希望将其封装为Skill时:
bash
undefined

Step 1: Extract the session

步骤1:提取会话记录

uv run ~/.claude/skills/improve-skill/scripts/extract_session.py
--session-id <session-id>
--output /tmp/session.md
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py
--session-id <session-id>
--output /tmp/session.md

Step 2: Generate skill creation prompt

步骤2:生成创建Skill的提示词

uv run ~/.claude/skills/improve-skill/scripts/analyze_session.py
--transcript /tmp/session.md
--create-skill
--output /tmp/new_skill_prompt.md

Then start a **new session** to create the skill based on the analysis.
uv run ~/.claude/skills/improve-skill/scripts/analyze_session.py
--transcript /tmp/session.md
--create-skill
--output /tmp/new_skill_prompt.md

随后启动一个**新会话**,基于分析结果创建Skill。

3. Quick Session Review

3. 快速会话回顾

List recent sessions and extract the most recent one:
bash
undefined
列出近期会话并提取最新的会话记录:
bash
undefined

List recent sessions

列出近期会话

uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --list
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --list

Extract most recent session for current directory

提取当前目录下的最新会话记录

uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --latest
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --latest

Extract most recent session for a specific project

提取指定项目目录下的最新会话记录

uv run ~/.claude/skills/improve-skill/scripts/extract_session.py
--latest
--cwd /path/to/project
undefined
uv run ~/.claude/skills/improve-skill/scripts/extract_session.py
--latest
--cwd /path/to/project
undefined

Finding Session IDs

查找会话ID

Session IDs can be found:
  1. In the Claude Code UI (shown in session info)
  2. Using the
    /tasks
    command
  3. By listing sessions:
    uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --list
可通过以下方式获取会话ID:
  1. 在Claude Code界面中查看(会话信息区域显示)
  2. 使用
    /tasks
    命令
  3. 列出会话记录:
    uv run ~/.claude/skills/improve-skill/scripts/extract_session.py --list

Analysis Framework

分析框架

When analyzing a session transcript, look for:
PatternWhat to Look For
ConfusionWhere did the agent struggle or misunderstand?
Missing InfoWhat information was needed but not in the skill?
WorkaroundsWhat manual steps were needed that could be automated?
ErrorsWhat errors occurred and how were they resolved?
SuccessWhat approaches worked well and should be documented?
Wrong SkillWas a different skill more appropriate?
分析会话记录时,需关注以下方面:
模式关注要点
困惑点Agent在哪些地方遇到困难或产生误解?
缺失信息Skill中缺少哪些必要的信息?
临时解决方案哪些手动步骤可以被自动化?
错误出现了哪些错误,以及如何解决的?
成功案例哪些方法效果良好,需要记录到文档中?
错误的Skill选择是否有更合适的Skill可以使用?

Output Format

输出格式

The analysis produces structured recommendations:
markdown
undefined
分析结果将生成结构化的建议:
markdown
undefined

Session Analysis

会话分析

What Worked Well

有效操作

  • [List of successful approaches]
  • [成功方法列表]

Issues Identified

问题点

  • [List of problems encountered]
  • [遇到的问题列表]

Recommended Improvements

推荐改进方案

  • [Specific changes to make to the skill]
  • [针对Skill的具体修改建议]

Missing Documentation

缺失的文档内容

  • [Information that should be added]
undefined
  • [需要补充的信息]
undefined

Help Output Examples

帮助输出示例

extract_session.py

extract_session.py

usage: extract_session.py [-h] [--list] [--latest] [--session-id SESSION_ID]
                          [--cwd CWD] [--output OUTPUT]

Extract Claude Code session transcripts to markdown

options:
  -h, --help            show this help message and exit
  --list                List all available sessions
  --latest              Extract most recent session
  --session-id SESSION_ID, -s SESSION_ID
                        Extract specific session by ID
  --cwd CWD             Filter sessions by working directory
  --output OUTPUT, -o OUTPUT
                        Save transcript to file (default: stdout)

Examples:
  uv run extract_session.py --list
  uv run extract_session.py --latest --output /tmp/session.md
  uv run extract_session.py --session-id abc123 --output /tmp/session.md
usage: extract_session.py [-h] [--list] [--latest] [--session-id SESSION_ID]
                          [--cwd CWD] [--output OUTPUT]

Extract Claude Code session transcripts to markdown

options:
  -h, --help            show this help message and exit
  --list                List all available sessions
  --latest              Extract most recent session
  --session-id SESSION_ID, -s SESSION_ID
                        Extract specific session by ID
  --cwd CWD             Filter sessions by working directory
  --output OUTPUT, -o OUTPUT
                        Save transcript to file (default: stdout)

Examples:
  uv run extract_session.py --list
  uv run extract_session.py --latest --output /tmp/session.md
  uv run extract_session.py --session-id abc123 --output /tmp/session.md

analyze_session.py

analyze_session.py

usage: analyze_session.py [-h] --transcript TRANSCRIPT [--skill SKILL]
                          [--create-skill] [--quick] [--output OUTPUT]

Analyze Claude Code session transcripts for skill improvement

options:
  -h, --help            show this help message and exit
  --transcript TRANSCRIPT, -t TRANSCRIPT
                        Path to the session transcript markdown file (required)
  --skill SKILL, -s SKILL
                        Path to existing skill SKILL.md to improve
  --create-skill        Generate prompt for creating a new skill
  --quick               Quick analysis summary only (no full prompt)
  --output OUTPUT, -o OUTPUT
                        Output file path (default: stdout)

Examples:
  # Quick analysis
  uv run analyze_session.py --transcript /tmp/session.md

  # Improve existing skill
  uv run analyze_session.py --transcript /tmp/session.md \
      --skill ~/.claude/skills/web-automation/SKILL.md

  # Create new skill
  uv run analyze_session.py --transcript /tmp/session.md --create-skill

  # Save analysis to file
  uv run analyze_session.py --transcript /tmp/session.md --output /tmp/analysis.md
Output includes:
  • Automatically detected struggles (missing files, permission issues, import errors, etc.)
  • Missing information (implicit knowledge, missing examples, edge cases, etc.)
  • Success patterns (what worked well, effective approaches)
  • Session metrics (tool invocations, errors, retries, successes)
  • Assessment (overall session quality and recommendations)
usage: analyze_session.py [-h] --transcript TRANSCRIPT [--skill SKILL]
                          [--create-skill] [--quick] [--output OUTPUT]

Analyze Claude Code session transcripts for skill improvement

options:
  -h, --help            show this help message and exit
  --transcript TRANSCRIPT, -t TRANSCRIPT
                        Path to the session transcript markdown file (required)
  --skill SKILL, -s SKILL
                        Path to existing skill SKILL.md to improve
  --create-skill        Generate prompt for creating a new skill
  --quick               Quick analysis summary only (no full prompt)
  --output OUTPUT, -o OUTPUT
                        Output file path (default: stdout)

Examples:
  # Quick analysis
  uv run analyze_session.py --transcript /tmp/session.md

  # Improve existing skill
  uv run analyze_session.py --transcript /tmp/session.md \
      --skill ~/.claude/skills/web-automation/SKILL.md

  # Create new skill
  uv run analyze_session.py --transcript /tmp/session.md --create-skill

  # Save analysis to file
  uv run analyze_session.py --transcript /tmp/session.md --output /tmp/analysis.md
Output includes:
  • Automatically detected struggles (missing files, permission issues, import errors, etc.)
  • Missing information (implicit knowledge, missing examples, edge cases, etc.)
  • Success patterns (what worked well, effective approaches)
  • Session metrics (tool invocations, errors, retries, successes)
  • Assessment (overall session quality and recommendations)

Tips

提示

  • Use a fresh session for analysis to avoid context pollution
  • Focus on patterns, not individual instances
  • Keep skills concise - only add essential information
  • Include examples for complex workflows
  • Update trigger words if the skill wasn't invoked when expected
  • Start with quick analysis to get overview, then full analysis for details
  • 使用全新会话进行分析,避免上下文干扰
  • 关注模式而非单个案例
  • 保持Skill简洁 - 仅添加必要信息
  • 为复杂工作流提供示例
  • 如果Skill未被正确触发,更新触发词
  • 先进行快速分析获取概览,再进行完整分析获取细节