diff --git a/yarn-project/.claude/skills/read-gist/SKILL.md b/yarn-project/.claude/skills/read-gist/SKILL.md new file mode 100644 index 000000000000..4320e71a44c2 --- /dev/null +++ b/yarn-project/.claude/skills/read-gist/SKILL.md @@ -0,0 +1,40 @@ +--- +name: read-gist +description: Fetch and display a GitHub gist. Triggers when the user asks to read, fetch, or view a URL from gist.github.com. +argument-hint: "" +allowed-tools: Bash(gh gist *), WebFetch +--- + +# Read Gist + +Fetch and display the contents of a GitHub gist. + +## Trigger + +Activate this skill when the user provides a URL matching `gist.github.com` or asks to fetch/read a gist by ID. + +## Parameters + +The argument is a gist URL or gist ID: $ARGUMENTS + +## Steps + +1. **Extract the gist ID** from the input. It can be: + - A full URL like `https://gist.github.com//` -> extract `` + - A full URL like `https://gist.github.com/` -> extract `` + - A raw URL like `https://gist.githubusercontent.com/...` -> extract the gist ID segment + - A bare gist ID (hex string) + +2. **Try `gh gist view`** first (preferred): + + ```bash + gh gist view --raw + ``` + + If the gist has multiple files, list them first with `gh gist view ` (without `--raw`) to show filenames, then fetch with `--raw` or specify a filename with `-f ` if the user asked for a specific file. + +3. **Fallback to WebFetch** only if `gh` is not available or the command fails with an auth/install error: + - Fetch `https://gist.githubusercontent.com///raw` for single-file gists + - Or fetch the gist API endpoint `https://api.github.com/gists/` and extract file contents from the JSON response + +4. **Return the contents** to the caller. If there are multiple files, show each file with its filename as a header.