fix: read skill files as UTF-8 in validator - #10
Merged
Conversation
The Ruby validator used File.read's locale-default encoding, so under a non-UTF-8 locale (LANG=C) the frontmatter regex threw 'invalid byte sequence in US-ASCII' and blocked commits via the pre-commit hook. Read SKILL.md files as UTF-8 explicitly so validation is locale-independent.
There was a problem hiding this comment.
Pull request overview
Fixes locale-dependent failures in the skill validator by forcing UTF-8 when reading SKILL.md, ensuring the pre-commit hook and CI behave consistently even when LANG/LC_ALL are unset.
Changes:
- Read skill files with
File.read(..., encoding: "UTF-8")inscripts/validate-skills. - Add a changelog entry documenting the validator behavior change and the resolved error mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/validate-skills | Forces UTF-8 reads for SKILL.md to avoid US-ASCII default-external encoding failures when locale env vars are unset. |
| CHANGELOG.md | Documents the validator UTF-8 read fix and its impact on pre-commit/validation reliability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
scripts/validate-skillsread everySKILL.mdwith Ruby's default external encoding, which follows the process locale. In any shell withoutLANGset — including the non-interactive shells agents run in, and therefore thehooks/pre-commitgate — Ruby defaults toUS-ASCIIand every skill containing a non-ASCII byte fails YAML parsing withinvalid byte sequence in US-ASCII.Nineteen of the current skills trip it, since the house style uses em dashes and
≫in descriptions. The failure looks like broken front matter but is purely environmental: the same files validate fine underLANG=en_US.UTF-8. Every commit in this repo today needed aLANGprefix to get past the hook.Upstream
steipete/agent-scriptsfixed this; the same one-line fix was already sitting unmerged on the localclaude/quirky-bartik-cdc137branch. This cherry-picks that commit onto currentmain, preserving authorship, and adds a changelog entry.Verification
Before, with the locale unset:
After:
Still
US-ASCIIas the process default — the fix is in the read, not the environment.Note on the count: 45 here versus 47 in the main checkout.
skills/gogandskills/wacrawlare relative symlinks (../../gogcli/...) that only resolve from the real checkout, so they dangle in a worktree and are skipped. Pre-existing behaviour, unrelated to this change.