verify-source

GitHub

用于验证生产证明源链接的准确性。自动检查HTTP状态、SHA永久链接及行范围内容,将分支链接转换为SHA,并辅助手动复核警告项,确保文档链接有效且内容匹配。

.claude/skills/verify-source/SKILL.md Totoro-jam/battle-tested-patterns

触发场景

需要验证文档中的生产证明链接是否有效 发现或怀疑链接存在格式错误、断链或内容不匹配

安装

npx skills add Totoro-jam/battle-tested-patterns --skill verify-source -g -y
更多选项

非标准路径

npx skills add https://github.com/Totoro-jam/battle-tested-patterns/tree/main/.claude/skills/verify-source -g -y

不安装直接使用

npx skills use Totoro-jam/battle-tested-patterns@verify-source

指定 Agent (Claude Code)

npx skills add Totoro-jam/battle-tested-patterns --skill verify-source -a claude-code -g -y

安装 repo 全部 skill

npx skills add Totoro-jam/battle-tested-patterns --all -g -y

预览 repo 内 skill

npx skills add Totoro-jam/battle-tested-patterns --list

SKILL.md

Frontmatter
{
    "name": "verify-source",
    "description": "Verify all production proof source links in pattern documents. Run automated checks for HTTP status, format, SHA permanence, and line-range content accuracy."
}

Verify Source Links

You are verifying production proof links in this repository. This is the most critical quality check — every pattern's credibility depends on accurate, live source links.

Steps

1. Run automated link check

pnpm verify-links

This scans all docs/**/*.md and root README.md/README.zh-CN.md files, extracts GitHub URLs, and checks:

  • HTTP status (with automatic retry on 5xx)
  • Whether Production Proof links include line numbers (#L18-L22)
  • Whether links use SHA permalinks vs branch names
  • Whether any #L1 file-level links exist in Production Proof

Output categories:

  • ✅ [proof] — valid Production Proof link with line numbers
  • ✅ [other] — valid non-Production-Proof link
  • ⚠️ [proof] — Production Proof link missing line numbers
  • ℹ️ — branch-based link (not SHA permalink)
  • — broken link (HTTP error)

For CI mode (exit 1 on broken links): pnpm verify-links -- --ci

2. Convert branch links to SHA permalinks

If the report shows branch-based links, convert them:

tsx scripts/convert-to-sha-links.ts --dry-run    # preview changes
tsx scripts/convert-to-sha-links.ts               # execute conversion

Authentication: prefers gh auth token (system keyring), falls back to GITHUB_TOKEN env var.

3. Verify line-range content

For links that pass HTTP checks, verify that the referenced code lines actually match the pattern:

pnpm verify-lines                    # Check all Production Proof links
pnpm verify-lines --pattern <name>   # Check a single pattern
pnpm verify-lines --verbose          # Show all results including passes
pnpm verify-lines --section all      # Also check "More Production Uses" section
pnpm verify-lines --no-cache         # Re-fetch everything (ignore cache)

This script performs two layers of verification:

  • L1: Range validity — checks that line numbers are within file bounds
  • L2: Keyword presence — checks that pattern-related keywords appear in the referenced code

Output:

  • — line range valid and keywords found
  • ⚠️ — line range valid but no keywords found (review manually)
  • ❌ FAIL — line range exceeds file length (must fix)
  • ❌ ERROR — fetch failed (network issue, retry)

Results are cached in tmp/line-range-cache.json (SHA links are immutable, so cache is permanent).

4. Manual verification (for warnings)

For any ⚠️ warnings from verify-lines, manually confirm:

  • Open the GitHub link in a browser
  • Verify the code at the specified lines actually demonstrates the pattern
  • The usage description in the table is accurate

For ❌ FAIL results (line range out of bounds), the link must be fixed:

  1. Open the raw file at the SHA commit
  2. Find the correct line range for the relevant code
  3. Update the link in both EN and ZH pattern docs
  4. Also check README.md / README.zh-CN.md for the same link

5. Report

Output a summary:

  • ✅ Valid links (count)
  • ⚠️ Format issues or keyword warnings (list each)
  • ❌ Broken links (list each with file location)

For broken links, suggest the fix per .sop/06-broken-link-fix.md.

Rules

  • Never fabricate a replacement URL — if you can't find the new location, leave a <!-- TODO --> marker
  • Always verify with automated tools first (pnpm verify-links, pnpm verify-lines), then manually for warnings
  • When fixing line-range errors in pattern docs, also update README.md and README.zh-CN.md if they contain the same link
  • Check the actual code content, not just HTTP status

版本历史

  • 0307be9 当前 2026-07-05 14:53

同 Skill 集合

.claude/skills/diagnose/SKILL.md
.claude/skills/new-pattern/SKILL.md
plugins/pattern-skills/skills/adopt-pattern/SKILL.md
plugins/pattern-skills/skills/audit-pattern/SKILL.md

元信息

文件数
0
版本
0307be9
Hash
e85a5115
收录时间
2026-07-05 14:53

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-15 14:57
浙ICP备14020137号-1 $访客地图$