encoding-touched-guard

Detect UTF-8 BOM, U+FFFD, and mojibake in edited text files before commits.

3|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/eaglhuang/cocos_new --skill encoding-touched-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: encoding-touched-guard
Source: https://github.com/eaglhuang/cocos_new/tree/main/.agents/skills/encoding-touched-guard
Command: npx skills add https://github.com/eaglhuang/cocos_new --skill encoding-touched-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a fast self-check workflow to prevent encoding corruption in recently edited text files by detecting UTF-8 BOM, U+FFFD, and mojibake and re-checking before finishing work, ensuring Chinese characters are preserved.

Core Features & Use Cases

  • Fast pre-check after edits: Run encoding checks on the files you just changed to catch issues immediately.
  • File-type scope: Targets high-risk text files such as .md, .json, .ts, .js, and .ps1.
  • Final guard before commit: Re-check before finishing work to prevent broken encodings from being committed.

Quick Start

After editing, run npm run check:encoding:touched -- --files <files> to scan the touched files for BOM, U+FFFD, and mojibake.

Frequently Asked Questions about encoding-touched-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect UTF-8 BOM and mojibake in changed files before a commit?

To detect UTF-8 BOM and mojibake in changed files before a commit, you can run a pre-commit check that scans your touched text files for encoding corruption, U+FFFD, and invalid characters to ensure code quality before integration.

What causes mojibake and UTF-8 encoding issues in JSON and Markdown files?

Mojibake and UTF-8 encoding issues in JSON and Markdown files are caused by character set mismatches during editing, which introduce unwanted BOM markers or U+FFFD replacement characters that corrupt high-risk text files.

Can I use this encoding check for TypeScript and JavaScript files?

Yes, you can use this encoding check for TypeScript and JavaScript files, as it targets high-risk text file types including .ts, .js, .md, .json, and .ps1 to prevent encoding corruption across standard development workflows.

What is the best way to prevent encoding corruption in pre-commit hooks?

The best way to prevent encoding corruption in pre-commit hooks is to enforce deterministic style checks that scan recently edited files for UTF-8 BOM and mojibake, providing a fast guardrail before finishing your work.

Does this encoding guard work with PowerShell scripts?

Yes, this encoding guard works with PowerShell scripts, as .ps1 files are explicitly included in the high-risk text file scope alongside .md, .json, .ts, and .js files to catch encoding issues immediately after edits.