g
GitHub Extract
@guoqiao
npx machina-cli add skill @guoqiao/gh-extract --openclawFiles (1)
SKILL.md
1.0 KB
GitHub Extract
Extract content from a GitHub url.
Use this skill when the user types /gh-extract or asks to extract/download/summarize a GitHub url.
What it does
- Accepts an GitHub url, could be repo/tree/blob.
- Convert the url to github raw url.
- Extract file content from the raw url or save to a temp path.
Requirements
uvwget
Usage
# print file content to stdout
uv run --script ${baseDir}/gh_extract.py <url>
# save file to a temp path, with a proper filename
uv run --script ${baseDir}/gh_extract.py <url> --save
Notes
- only works for public repo.
- url can be repo/tree/blob
- for repo/tree, will try to get
README.mdorSKILL.mdorREADME.txt
Overview
GitHub Extract fetches file contents from a GitHub URL (repo, tree, or blob) by converting it to a raw URL and downloading the content. It can either print to stdout or save to a temp path for later processing, and it works with public repositories using uv and wget.
How This Skill Works
Provide a GitHub URL to the gh_extract.py script via uv run. The tool converts the URL to a raw GitHub URL, downloads the file content, and outputs it or saves it to a temp path with a proper filename. If the URL points to a repo/tree, it will attempt to fetch README.md, SKILL.md, or README.txt as a fallback.
When to Use It
- Extract a single file's raw content from a public GitHub URL (repo/blob).
- Fetch content from a repo/tree URL and fall back to README.md, SKILL.md, or README.txt.
- Save the extracted content to a temporary path for downstream processing.
- Automate retrieval of docs or skill definitions from multiple GitHub repos without cloning.
- Quickly preview a file's contents in stdout during scripting or debugging.
Quick Start
- Step 1: Ensure uv and wget are installed on your system.
- Step 2: Print file content to stdout: uv run --script ${baseDir}/gh_extract.py <url>
- Step 3: Save to a temp path: uv run --script ${baseDir}/gh_extract.py <url> --save
Best Practices
- Only use with public GitHub repositories.
- Prefer explicit paths (repo/blob or repo/tree/path) when possible.
- Use --save to cache the file with a meaningful, temporary filename.
- Validate the downloaded content is non-empty before downstream use.
- Ensure uv and wget are installed and accessible on the system.
Example Use Cases
- Pull README.md from a public project to generate a quick project outline.
- Extract SKILL.md from a repo to populate an AI agent skills directory.
- Retrieve a config file from a repository to feed into an automation script.
- Preview a file's content in stdout to verify correctness before processing.
- Save a downloaded file to a temp path for subsequent parsing in a workflow.
Frequently Asked Questions
Add this skill to your agents