fix(skill-creator, mcp-builder): specify utf-8 file encoding and pin mcp<2 - #1690
fix(skill-creator, mcp-builder): specify utf-8 file encoding and pin mcp<2#1690AbhiPra24 wants to merge 1 commit into
Conversation
…and pin mcp<2 - Add explicit encoding="utf-8" across skill-creator scripts, eval-viewer, and mcp-builder evaluation harness to prevent Windows cp1252 decode errors (anthropics#1686, anthropics#1669) - Pin mcp<2 in mcp-builder/scripts/requirements.txt to prevent breaking changes with streamablehttp_client (anthropics#1668)
Hahaknight
left a comment
There was a problem hiding this comment.
Tested the encoding choice on real Windows 11 against a production Chinese-language SKILL.md — one substantive gap plus a scope note:
1. Plain utf-8 misses the BOM case documented in #1686 (reporter found a real BOM'd SKILL.md in the wild). Prepending a UTF-8 BOM (EF BB BF) to a valid skill:
read_text(encoding="utf-8")(this PR) → content starts with, sostartswith('---')/lines[0].strip() != '---'checks return False → a valid skill is silently rejected as "no frontmatter". No crash, so it fails quietly — arguably worse than the current loud crash.read_text(encoding="utf-8-sig")→ passes, and is byte-identical toutf-8on non-BOM files (no downside).
Suggest using utf-8-sig for the SKILL.md read sites (quick_validate.py, utils.py:parse_skill_md) to match #1687's approach and the reporter's recommendation. For JSON/HTML artifact reads/writes in eval-viewer/mcp-builder, plain utf-8 is fine.
2. Scope: the mcp>=1.1.0,<2 pin in mcp-builder/requirements.txt looks unrelated to the Windows encoding fix — might be worth splitting into its own PR so the maintainers can evaluate each independently.
The eval-viewer and mcp-builder read/write sites this PR fixes are not covered by #1687, so the coverage between the two PRs is complementary — merging both (with utf-8-sig at the SKILL.md sites) would close #1686 fully.
Summary
encoding="utf-8"to file read/write operations acrossskills/skill-creator/scripts/,skills/skill-creator/eval-viewer/, andskills/mcp-builder/scripts/so Windows environments do not fail withUnicodeDecodeError/UnicodeEncodeError(cp1252) when encountering emojis or non-ASCII characters.mcp<2inskills/mcp-builder/scripts/requirements.txtto avoid breaking changes withstreamablehttp_client.Changes
skills/skill-creator/scripts/aggregate_benchmark.py: specifyencoding="utf-8"inopen()calls.skills/skill-creator/scripts/generate_report.py: specifyencoding="utf-8"inread_text()andwrite_text()calls.skills/skill-creator/scripts/improve_description.py: specifyencoding="utf-8"inread_text()andwrite_text()calls.skills/skill-creator/scripts/quick_validate.py: specifyencoding="utf-8"inread_text().skills/skill-creator/scripts/run_eval.py: specifyencoding="utf-8"inread_text()andwrite_text()calls.skills/skill-creator/scripts/run_loop.py: specifyencoding="utf-8"inread_text()andwrite_text()calls.skills/skill-creator/scripts/utils.py: specifyencoding="utf-8"inread_text().skills/skill-creator/eval-viewer/generate_review.py: specifyencoding="utf-8"across allread_text()andwrite_text()calls.skills/mcp-builder/scripts/evaluation.py: specifyencoding="utf-8"inwrite_text().skills/mcp-builder/scripts/requirements.txt: pinmcp>=1.1.0,<2.Testing
python3 skills/skill-creator/scripts/quick_validate.py skills/mcp-builderpython3 skills/skill-creator/scripts/quick_validate.py skills/skill-creatorcc @98zc5g5jyw-arch for review