Use when the user encountered a problem, bug, edge case, or frustration with an existing skill and wants to save that knowledge into the skill's file. Trigger phrases include "add a gotcha", "document this pitfall", "capture lessons learned", "record edge cases", "pull out what went wrong", but also trigger when the user simply describes something that went wrong or was painful with a named skill (like readme, commit-msg, seo-meta, branch-report, gh-pr) and asks to update it, save it, or make sure it doesn't happen again. This skill mines conversation history for failure knowledge and writes it into the skill's Gotchas section. Do NOT use for creating new skills, adding features to skills, or changing how skills behave — only for documenting what went wrong.
Ships in skill-optimize. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Capture gotcha learnings from the current conversation and write them into a target skill's ## Gotchas section. This skill mines the conversation for failures, workarounds, edge cases, and non-obvious constraints encountered while using a specific skill, then proposes updates to that skill's SKILL.md.
The user provides a skill name as an argument (e.g., /gotcha-capture readme). Resolve it to a SKILL.md file path.
Use the Glob tool to search for the skill:
plugins/*/skills/{argument}/SKILL.md
If no match is found, list all available skills by globbing plugins/*/skills/*/SKILL.md and present the skill names to the user. Use AskUserQuestion to let them pick one.
If the argument matches a plugin name containing multiple skills (e.g., gh contains gh-issue, gh-dev, gh-pr), list all skills inside that plugin and ask the user to specify which one.
If the argument is a file path, use it directly after confirming the file exists.
Store the resolved path as TARGET_SKILL_PATH.
Read the full content of the target SKILL.md using the Read tool.
Parse the file to identify:
## Gotchas section already exists- **Bold title** -- Explanation text. (used by readme, gh-pr, gh-issue)Store the existing gotchas and the detected format style for later use. If no ## Gotchas section exists, default to bullet style.
Review the full conversation context for learnings related to the target skill. The conversation is already in your context window — no tools or agents needed for this step.
Look for these patterns:
Errors and failures
Workarounds
Unexpected behaviors
Non-obvious prerequisites
Performance issues
Edge cases
For each gotcha found, draft an entry with:
If no gotchas are found, inform the user: "I didn't find any gotcha-worthy learnings in this conversation related to {skill-name}. If you have something specific in mind, describe it and I can help draft the entry." Then stop.
Compare each new candidate against the existing gotcha entries:
[NEW].[REFINE] and prepare a merged version incorporating both the existing text and the new information.If all candidates are duplicates, inform the user: "All the gotchas I found are already documented in {skill-name}'s Gotchas section. No changes needed." Then stop.
Show the user a clear summary. For each proposed change:
For [NEW] entries:
1. [NEW] **Title** -- Explanation text here.
For [REFINE] entries (show before and after):
2. [REFINE] **Title**
Before: **Title** -- Original explanation.
After: **Title** -- Updated explanation with new detail.
After listing all proposed changes, use AskUserQuestion to confirm. Offer these options:
If the user asks to edit, present the revised version and confirm again before writing.
After user approval, apply the changes using the Edit tool:
If a ## Gotchas section already exists:
[NEW] entries: append at the end of the existing Gotchas section, before the next ## heading or end of file.[REFINE] entries: replace the existing entry text with the merged version in its original position.If no ## Gotchas section exists:
## Gotchas section. Place it after ## Hard rules if that section exists, otherwise at the end of the file.Match the formatting style detected in Step 2. If using bullet style (default), format each entry as:
- **Title** -- Explanation text. `code snippet` if applicable.
After writing, confirm to the user: "Updated {TARGET_SKILL_PATH} with N new gotcha(s) and M refinement(s)."
## Gotchas section.## Hard rules if present, otherwise at the end of the file. Never insert it in the middle of instructional steps.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
2 skills in this plugin
/skill-optimize:gotcha-capturefrom skill-optimize
npx claudepluginhub chienchuanw/chuan-skills --plugin skill-optimize