Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Validate and fix GFM links in PR descriptions. TRIGGERS - PR links, gh pr create, GFM validation, broken PR links.
allowed-tools
Bash, Read, Grep
PR GFM Link Validator
Validate and auto-convert GFM links in pull request descriptions to prevent 404 errors.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
When to Use This Skill
This skill triggers when:
Creating a pull request from a feature branch
Discussing PR descriptions or body content
Mentioning GFM links, PR links, or link validation
Using gh pr create or gh pr edit
The Problem
Repository-relative links in PR descriptions resolve to the base branch (main), not the feature branch:
Link in PR Body
GitHub Resolves To
Result
[ADR](/docs/adr/file.md)
/blob/main/docs/adr/file.md
404 (file only on feature branch)
The Solution
Convert repo-relative links to absolute blob URLs with the correct branch:
Before any PR operation, gather repository context:
/usr/bin/env bash << 'PREFLIGHT_EOF'# Get repo owner and name
gh repo view --json nameWithOwner --jq '.nameWithOwner'# Get current branch
git rev-parse --abbrev-ref HEAD
# Check if on feature branch (not main/master)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" == "main" || "$BRANCH" == "master" ]]; thenecho"On default branch - no conversion needed"exit 0
fi
PREFLIGHT_EOF
Step 2: Identify Links to Convert
Scan PR body for GFM links matching these patterns:
# Before
[Plugin Design](/docs/adr/2025-12-01-slug.md)
# After
[Plugin Design](https://github.com/Eon-Labs/alpha-forge/blob/feat/branch/docs/adr/2025-12-01-slug.md)
Step 5: Validate Result
After conversion, verify:
All repo-relative links are now absolute blob URLs
External links remain unchanged
Anchor links remain unchanged
Integration with gh pr create
When creating a PR, apply this workflow automatically:
/usr/bin/env bash << 'GIT_EOF'# 1. Get context
REPO_INFO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
OWNER=$(echo"$REPO_INFO" | cut -d'/' -f1)
REPO=$(echo"$REPO_INFO" | cut -d'/' -f2)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
# 2. Process PR body (convert links)# ... link conversion logic ...# 3. Create PR with converted body
gh pr create --title "..." --body "$CONVERTED_BODY"
GIT_EOF
Link Detection Regex
Use this regex pattern to find GFM links:
\[([^\]]+)\]\((/[^)]+|\.\.?/[^)]+)\)
Breakdown:
\[([^\]]+)\] - Capture link text
\( - Opening parenthesis
(/[^)]+|\.\.?/[^)]+) - Capture path starting with /, ./, or ../
\) - Closing parenthesis
Examples
Example 1: Simple Repo-Relative Link
Input:
See the [ADR](/docs/adr/2025-12-01-eth-block-metrics.md) for details.
See the [ADR](https://github.com/Eon-Labs/alpha-forge/blob/feat/2025-12-01-eth-block-metrics-data-plugin/docs/adr/2025-12-01-eth-block-metrics.md) for details.