Dotfiles-nix github-raw-fetch
Fetch and display raw content from GitHub file URLs by automatically converting standard GitHub URLs to raw.githubusercontent.com format and retrieving the file content.
install
source · Clone the upstream repo
git clone https://github.com/not-matthias/dotfiles-nix
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/not-matthias/dotfiles-nix "$T" && mkdir -p ~/.claude/skills && cp -r "$T/modules/home/programs/cli-agents/shared/skills/github-raw-fetch" ~/.claude/skills/not-matthias-dotfiles-nix-github-raw-fetch && rm -rf "$T"
manifest:
modules/home/programs/cli-agents/shared/skills/github-raw-fetch/SKILL.mdsource content
<!-- Source: Created based on user request, combining information from multiple sources -->
GitHub Raw Fetch Skill
This skill enables fetching raw content from GitHub file URLs by automatically converting standard GitHub URLs to their raw form and retrieving the content.
Key Purpose
"Fetch and display raw content from GitHub file URLs" by converting standard GitHub URLs to raw.githubusercontent.com format and retrieving the file content.
Core Workflow Steps
- Detect GitHub URL pattern — Identify if the provided URL is a GitHub file URL (contains
)github.com/.../blob/... - Convert to raw URL — Transform the URL using one of these methods:
- Replace
withgithub.comraw.githubusercontent.com - Remove
from the path/blob/ - Result:
https://raw.githubusercontent.com/USER/REPO/BRANCH/path/to/file.ext
- Replace
- Fetch content — Use WebFetch tool with the converted raw URL
- Present content — Display the fetched content to the user
URL Conversion Examples
Standard to Raw:
- From:
https://github.com/actioncloud/github-raw-url/blob/master/index.js - To:
https://raw.githubusercontent.com/actioncloud/github-raw-url/master/index.js
Pattern transformation:
github.com/USER/REPO/blob/BRANCH/path/file.ext- →
raw.githubusercontent.com/USER/REPO/BRANCH/path/file.ext
Alternative Methods
- Raw button: If browsing GitHub UI, click the "Raw" button and copy the URL
- Query parameter: Append
to the standard URL for automatic redirect?raw=truehttps://github.com/USER/REPO/blob/BRANCH/path/file.ext?raw=true
Safety Guidelines
- Validate that the URL is a GitHub file URL before conversion
- Handle edge cases like URLs that are already in raw format
- Preserve the correct branch/tag/commit reference during conversion
- Inform user if the URL pattern is not recognized
This skill streamlines fetching GitHub file content without manual URL manipulation.