Files
skillfactor-pipeline/pipeline/fix_skill_links.py
skillfactor-pipeline af05383bb1 chore: v1 baseline - full 3,039-package catalog with AI-skill enrichment and O*NET backfill
Snapshot before the quality program (relevance gates, tiered mapping,
QA linter). v1 is the immutable before/after reference; evidence crawl
was at ~175/3039 occupations when tagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PDKeXvpT6tENSvyQGLV1Uq
2026-07-09 05:32:49 +02:00

25 lines
888 B
Python

"""One-shot: replace backtick file references with Markdown links in SKILL.md files."""
import os, re
SKILLS_DIR = os.path.join(os.path.dirname(__file__), "..", "skills")
# Pattern: `references/some.md` or `evals/` → [references/some.md](references/some.md)
BACKTICK_REF = re.compile(r'`((?:references/[\w.-]+\.md|evals/))`')
fixed = skipped = 0
for slug in os.listdir(SKILLS_DIR):
skill_md = os.path.join(SKILLS_DIR, slug, "SKILL.md")
if not os.path.isfile(skill_md):
continue
with open(skill_md, encoding="utf-8") as f:
text = f.read()
new_text = BACKTICK_REF.sub(lambda m: f"[{m.group(1)}]({m.group(1)})", text)
if new_text != text:
with open(skill_md, "w", encoding="utf-8", newline="\n") as f:
f.write(new_text)
fixed += 1
else:
skipped += 1
print(f"Fixed: {fixed} Already OK / no match: {skipped}")