1. Skill objective
When the user asks to read source code, configuration, README, Markdown, or docs content on GitHub, execute in the following order:
- First identify the repository,
ref, target file, or target topic - If the target belongs to the repository's documentation system, first read the
agent_router.md - Based on the routing, directory, aliases, and entry descriptions in
agent_router.mdassemble the real path - Convert the final path into a raw link
- Use
curlto fetch the file content
2. Scope of application
- The user provides a GitHub file page link, for example:
https://github.com/<owner>/<repo>/blob/<ref>/<path-to-file>
- The user provides a raw link, for example:
https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<path-to-file>
- What the user wants to read is a plain text file such as README, source code, configuration, script, JSON, YAML, Markdown, etc.
- What the user wants to read is a repository's docs, documentation entry, FAQ, guide, design document, or API documentation
- The user only gives the repository and the documentation topic they want to see, but the real docs path may be controlled by
agent_router.mdcontrol
The following scenarios are not within the direct scope of this skill:
- The repository home page, directory page, Pull Request, Issue, or Commit page itself
- Need to recursively traverse the entire repository or batch-fetch a large number of files
- Obvious binary files, such as images, archives, or model weights
3. Core rules
3.1 Convert a standard GitHub file page to a raw link
If the input link satisfies:
https://github.com/<owner>/<repo>/blob/<ref>/<path-to-file>
Then convert it to:
https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<path-to-file>
The following rules must be followed during conversion:
- Replace the domain
github.comwithraw.githubusercontent.com - Delete the
/blob/ - Keep the rest of the path unchanged
- Branch, tag, commit SHA, etc.
<ref>must be preserved as is
3.2 It is already a raw link
If what the user provides is itself a raw.githubusercontent.com link, do not convert it again; use that link directly.
3.3 Before reading docs, you must first read agent_router.md
As long as the requirement satisfies any of the following conditions, you must first read the agent_router.md:
- The content the user wants to see belongs to the docs, documentation, FAQ, or guide Markdown documentation system
- The path given by the user is located in
docs/、doc/、wiki/、manual/and other documentation directories - The user has not given an exact file path and only says "look at the documentation about X in a certain repository"
agent_router.md locating rules:
https://github.com/<owner>/<repo>/blob/<ref>/agent_router.md
Its raw form is:
https://raw.githubusercontent.com/<owner>/<repo>/<ref>/agent_router.md
Requirements:
agent_router.mdmust use the same repository and the sameref- Do not skip this step and directly guess based on experience
docs/directory structure - If the target file itself is
agent_router.md, then read it directly, with no additional prerequisite step - After reading
agent_router.md, prioritize using the entry documents, directory mappings, aliases, language directories, and redirect rules defined in it to assemble the final path
Example:
https://github.com/kali20gakki/msprof/blob/master/agent_router.md
When reading kali20gakki/msprof docs in the repository, you should first read the above router file, then determine the real documentation path.
3.4 curl is the default fetching method
When obtaining raw content, prioritize using curl, and do not rely on the GitHub HTML page rendering result.
Recommended command:
curl -L "https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<path-to-file>"
If the runtime environment is PowerShell, and you need to avoid curl alias differences, prioritize using:
curl.exe -L "https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<path-to-file>"
3.5 docs path concatenation rules
After reading agent_router.md , the agent should focus on identifying this information:
- Where the actual docs root directory is
- Whether multilingual directories exist
- Whether a mapping from logical names to real file paths exists
- Is the documentation entry point
README.md、index.mdor another file - Whether certain topic documents need to be redirected from an alias to the real path
Final principle:
- Look at the router first, then decide the path
- Paths should be based on the router, not on the repository's default
docs/convention - If the router has already clearly given the entry point or mapping, concatenate the path directly according to its rules
4. Standard operating procedure
- Identify whether the user has given a GitHub file page link, a raw link, or the intent to "read the docs of a certain repository"
- Extract from the link or context
<owner>、<repo>、<ref>, the target path, or the target topic - If the target belongs to the docs system, first construct and read the raw link for
agent_router.mdraw link - Derive the real documentation path based on
agent_router.mdderive the real document path - Convert the real path into a raw link
- Use
curlto obtain the content - Return the result to the user:
- When the user wants to quickly understand the content, prioritize giving a summary and key excerpts
- When the user explicitly requests the original text, then return the full text or display it as completely as possible
- If necessary, attach the final raw URL for easy reuse
5. Recommended command templates
5.1 First read the router
curl.exe -L "https://raw.githubusercontent.com/<owner>/<repo>/<ref>/agent_router.md"
5.2 Then read the real documentation
curl.exe -L "https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<actual-doc-path>"
5.3 Directly read an ordinary file
curl.exe -L "https://raw.githubusercontent.com/<owner>/<repo>/<ref>/<path-to-file>"
6. Examples
Example 1: Standard GitHub file page
Input:
https://github.com/actioncloud/github-raw-url/blob/master/index.js
After conversion:
https://raw.githubusercontent.com/actioncloud/github-raw-url/master/index.js
Then use:
curl.exe -L "https://raw.githubusercontent.com/actioncloud/github-raw-url/master/index.js"
Example 2: Read the router before reading docs
Input:
请读取 https://github.com/kali20gakki/msprof/blob/master/docs/xxx.md
Correct procedure:
- First read:
https://raw.githubusercontent.com/kali20gakki/msprof/master/agent_router.md
- Determine based on the router
xxx.md's real location - Then execute on the real path:
curl.exe -L "https://raw.githubusercontent.com/kali20gakki/msprof/master/<actual-doc-path>"
Example 3: The user only says "help me look at a certain document in a certain repository"
If the user only gives the repository and topic, without giving the final file path, first read the repository's agent_router.md, then derive the actual document location based on the entry points and mapping rules in it, rather than directly guessing docs/<topic>.md。
7. Error handling and constraints
- If the link is not a GitHub file page or raw file link, clearly inform that the URL does not conform to this skill's processing mode
- If
agent_router.mdreturns 404:- First confirm whether the repository,
refare correct - If it is confirmed that there is no router, you may fall back to directly converting the raw link according to the original path
- When falling back, explain "No
agent_router.mdwas found, so reading is attempted via the direct path"
- First confirm whether the repository,
- If the router exists, but the target document path cannot be derived from it:
- Clearly explain what type of mapping information is missing
- Do not pretend that the real path has already been confirmed
- If the fetch result returns 404, prioritize considering:
- Incorrect path
refdoes not exist- The path pointed to by the router has changed
- The repository or file is a private resource
- If what is returned is HTML instead of text, it means the fetch method is wrong; first check whether a GitHub page link was mistakenly used instead of a raw link
- If the target content is clearly binary or too large, do not force it to be expanded as plain text; you should tell the user the file type and prioritize returning a link or a brief explanation
8. Output suggestions
- If the user wants to read or analyze the file, prioritize extracting the key content rather than mechanically pasting the full text
- If the user explicitly requests raw content or the original text, then return the complete text as needed
- If, when reading docs, it went through
agent_router.md, you can also explain how the final path was derived from the router - When analyzing code or configuration, you can also explain the key functions, entry points, configuration items, or purposes