Agent skill

Zhtw Rules

by sysprog21 in sysprog21/zhtw-mcp

What the gates cannot tell you about adding or changing a zh-TW rule - why assets/ruleset.json is the only place a vocabulary rule lives, the false-friend problem and the four gates that answer it…

MITAuto-check passed

Install Zhtw Rules

skills CLI
$ npx skills add sysprog21/zhtw-mcp --skill zhtw-rules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sysprog21/zhtw-mcp zhtw-rules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sysprog21/zhtw-mcp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/zhtw-rules .claude/skills/zhtw-rules && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
zhtw-rules
GitHub stars
488
Token cost
~1.7k tokens
SKILL.md length
782 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

What the gates cannot tell you about adding or changing a zh-TW rule - why assets/ruleset.json is the only place a vocabulary rule lives, the false-friend problem and the four gates that answer it…

  • Disabling a rule
  • SKILL.md covers The false friend is the whole…, The corpus is the argument,…, Positions are byte offsets,… and One rule, three consumers, plus 1 more section
  • Calls make
  • A rule fires on native zh-TW prose

What it does

Zhtw Rules is an agent skill from sysprog21/zhtw-mcp. What the gates cannot tell you about adding or changing a zh-TW rule - why assets/ruleset.json is the only place a vocabulary rule lives, the false-friend problem and the four gates that answer it, the corpus thresholds a rule has to clear, why positions are byte offsets through NFC, and how a rule reaches the scanner, the fixer and the browser build. Use when adding or disabling a rule, when a rule fires on native zh-TW prose, when a fix lands at the wrong offset, or when touching src/engine/scan.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: A linguistic linter for Traditional Chinese (zh-TW). The licence is MIT.

When your agent uses it

  • Disabling a rule
  • A rule fires on native zh-TW prose
  • A fix lands at the wrong offset
  • Touching src/engine/scan

Example prompts

  • “/zhtw-rules”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 5b385b3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • make

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Zhtw Rules loads about 1.7k tokens when it runs. Until then it costs about 129 tokens; SKILL.md has 782 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~129
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sysprog21/zhtw-mcp at commit 5b385b3, republished under its MIT licence (© sysprog21). 782 words, ~1,663 tokens.

Download SKILL.mdSave it as .claude/skills/zhtw-rules/SKILL.md (or your agent's skills folder).
name
zhtw-rules
description
What the gates cannot tell you about adding or changing a zh-TW rule - why assets/ruleset.json is the only place a vocabulary rule lives, the false-friend problem and the four gates that answer it, the corpus thresholds a rule has to clear, why positions are byte offsets through NFC, and how a rule reaches the scanner, the fixer and the browser build. Use when adding or disabling a rule, when a rule fires on native zh-TW prose, when a fix lands at the wrong offset, or when touching src/engine/scan.

Changing what zhtw-mcp flags

assets/ruleset.json is the source of truth. build.rs serializes it into the binary with postcard, scripts/check-ruleset.py owns its dedup, sort and field order, and src/rules/schema.rs is the type the two agree on through the generated scripts/schema-facts.json. Hand formatting is rewritten and the indent gate fails on it, so the loop is: edit, python3 scripts/check-ruleset.py --lint, make indent.

The false friend is the whole problem

A from term that is also valid zh-TW with a different meaning is the failure mode this project has to defend against, because it turns the linter into something people switch off. 文件 is "file" in zh-CN and "document" in zh-TW. 字體 is a typeface here and a font file there. An ungated rule for either fires on correct prose.

Four answers, in order of how much they cost the reader:

  • disabled: true when the term cannot be judged from the sentence at all.
  • context_clues and negative_context_clues when a nearby word settles it.
  • exceptions when a fixed phrase is the only safe carve-out.
  • editorial_confidence for the milder case, and context_suggestions when the correction itself differs by domain.

The two terms above took different answers, which is the point of having four. 文件 to 檔案 is disabled, because a sentence holding it reads correctly under either meaning. 字體 to 字型 ships enabled behind context_clues, because the typeface sense travels with words the rule can look for.

A rule that needs none of these is a rule where the zh-CN form has no zh-TW reading, which is most of the vocabulary list and none of the hard cases.

The corpus is the argument, not the opinion

The assertions in tests/corpus-evaluation.rs are what settles whether a rule pays for itself. make corpus prints their table, but it does not gate: cargo autodiscovers that target, so make check has already run every one of them. There are ten, not the three the printed table draws the eye to:

  • Aggregate precision at 90% or better.
  • Two native zh-TW false-positive rates, per fixture and repeat-weighted, each at 5% or less, because each is blind to what the other catches.
  • Three safe-fix rates: 85% on the AI-generated corpus, which is the figure CLAUDE.md records as the contract, and 99% on both the zh-CN conversion and the native corpora.
  • Four per-corpus floors, added after the other six because recall was printed on every run and asserted nowhere, which let two commits rework AI detection unnoticed: AI-generated recall 94% and precision 91%, zh-CN conversion recall 98% and precision 96%. Per corpus rather than aggregate, because zh-CN carries roughly twice the true positives and would mask an AI detector going quiet.

Three more assert each corpus is still big enough to mean anything. A rule that drops a false-positive gate is a rule that fires on native-zh-tw.json, which is exactly the prose it is supposed to leave alone.

expected_issues and expected_fixed in a corpus fixture are deliberately independent: the scanner reports confusable and clue-gated rules that the lexical_safe fixer will not touch, so an issue without a replacement is correct and not an omission.

Show full SKILL.md (271 more words)Show less

Positions are byte offsets, and not the obvious ones

Every offset a rule produces is a byte offset into the original text, mapped back through NFC normalization and, for markdown, through pulldown-cmark event ranges. Computing one on the normalized string alone gives a number that is right for ASCII, right for most CJK, and wrong the moment a composed character or a markdown construct appears before it. src/engine/normalize.rs holds the offset map and src/engine/lineindex.rs turns an offset into a line and column, in UTF-16 code units by default because that is what LSP clients read.

One rule, three consumers

A rule reaches the CLI, the MCP server and the browser extension. The last one is the one that gets forgotten: the extension builds the library with browser-wasm and no native, and anything touching std::fs, dirs or rayon has to be behind #[cfg(feature = "native")] or that build breaks. make check lints the two non-default feature shapes for exactly this reason.

The fixer is the second consumer worth naming. A scanner detection is not automatically a fix: src/fixer.rs applies only what is safe to apply without reading the sentence, and a rule whose correction depends on context belongs in context_suggestions rather than in the safe fixer.

Where the passes live

text
src/engine/scan/spelling.rs      Vocabulary rules out of the ruleset
src/engine/scan/case_rule.rs     Casing of Latin technical terms
src/engine/scan/punctuation.rs   Half-width to full-width, context sensitive;
                                 emits the quote issues quotes.rs decided on
src/engine/scan/quotes.rs        Which quotation marks convert at all, the
                                 depth-based pairing fix, hierarchy validation
src/engine/scan/spacing.rs       CJK to Latin and CJK to digit spacing
src/engine/scan/ellipsis.rs      Non-standard ellipsis to the MoE …… form
src/engine/scan/repetition.rs    Consecutive duplicates, an ASR and paste tell
src/engine/scan/acronym.rs       Rejoins a spaced acronym, C P U to CPU
src/engine/scan/grammar.rs       A-not-A, bare 是, nominalization, prepositions
src/engine/scan/rule_ir.rs       The matcher spelling.rs drives; the 臺/台 family
                                 is variant rules behind variant_normalization
src/engine/scan/overlap.rs       Resolves detections that cover the same span
src/engine/s2t.rs                Simplified to traditional, from the OpenCC tables

tests/unit/engine/scan/tests_generated.rs is misnamed and is not generated: it holds the hand-written scanner tests split out of scan/mod.rs. Add a scanner test there or in the pass's own test file under tests/unit/, never in the pass itself, and add the corpus fixture separately when the rule is meant to move a metric. zhtw-verify has the #[path] declaration a module uses to reach its tests.

© sysprog21, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/zhtw-rules of sysprog21/zhtw-mcp.

Open the folder on GitHubat commit 5b385b3

Compare with similar skills

Zhtw Rules next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Zhtw Rules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Zhtw Rules this skillsysprog21/zhtw-mcp488—~1.7kAutomated safety check: PassMIT
Gate Testsvercel/next.js143k—~2.7kAutomated safety check: PassMIT
Gateplugin87/ux-ui-agent-skills1.5k—~532Automated safety check: PassMIT
Brain Ingest Gategarrytan/gbrain31k—~3.9kAutomated safety check: PassMIT
Delivery Gateaffaan-m/ECC275k—~1.3kAutomated safety check: PassMIT
Skill Release Gaterohitg00/ai-engineering-from-scratch66k—~1kAutomated safety check: PassMIT

Similar skills

  • Gate Tests

    vercel/next.js

    Official

    How to use the @gate / @force-gate test directives instead of it.skip or fake-green skip patterns.

    143k GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Gate

    plugin87/ux-ui-agent-skills

    Run the one-command quality gate and report the real N/N result.

    1.5k GitHub stars~532 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Brain Ingest Gate

    garrytan/gbrain

    Pre-write quality gate for content entering the brain. An agent skill from garrytan/gbrain.

    31k GitHub stars~3.9k tokensUpdated today
    Testing & QAAuto-check passed
  • Delivery Gate

    affaan-m/ECC

    Stop hook that blocks Claude from finishing until quality checks pass.

    275k GitHub stars~1.3k tokensUpdated 3 days ago
    Auto-check passed
  • Skill Release Gate

    rohitg00/ai-engineering-from-scratch

    Evaluates an Agent Skill bundle before release for structure, trigger quality, artifact improvement, script correctness, safety, installed-tree integrity and host portability.

    66k GitHub stars~1k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • PR Feedback Quality Gate

    nexu-io/open-design

    Safely track pull request feedback, resolve review comments or merge conflicts, validate fixes, and use a read-only cross-review before committing or pushing follow-up changes.

    100k GitHub stars~572 tokensUpdated today
    DevelopmentAuto-check passed

More from sysprog21/zhtw-mcp

  • Zhtw Conventions

    sysprog21/zhtw-mcp

    The zhtw-mcp conventions no gate enforces - the register a comment, a commit message and a PR reply are written in, where Chinese belongs in the tree and where it does not, the untracked working…

    488 GitHub stars~2k tokensUpdated 3 days ago
    Auto-check passed
  • Zhtw Verify

    sysprog21/zhtw-mcp

    How a zhtw-mcp change is validated - make check as the gate, the generated tables and the ruleset normalization that have to be current before it passes, the formatter chain in scripts/indent.sh…

    488 GitHub stars~2.8k tokensUpdated 3 days ago
    Auto-check passed

Questions about Zhtw Rules

What does Zhtw Rules do?

What the gates cannot tell you about adding or changing a zh-TW rule - why assets/ruleset.json is the only place a vocabulary rule lives, the false-friend problem and the four gates that answer it…. Zhtw Rules is an agent skill from sysprog21/zhtw-mcp.json is the only place a vocabulary rule lives, the false-friend problem and the four gates that answer it, the corpus thresholds a rule has to clear, why positions are byte offsets through NFC, and how a rule reaches the scanner, the fixer and the browser build.

When should I use Zhtw Rules?

Zhtw Rules fits situations like: disabling a rule; A rule fires on native zh-TW prose; A fix lands at the wrong offset; touching src/engine/scan.

How do I install Zhtw Rules in Claude Code?

Run `npx skills add sysprog21/zhtw-mcp --skill zhtw-rules -a claude-code`. Or copy the skill folder (.claude/skills/zhtw-rules in sysprog21/zhtw-mcp) into .claude/skills/zhtw-rules in your project. Claude Code loads it when a task matches its description.

How do I install Zhtw Rules in Codex?

Run `npx skills add sysprog21/zhtw-mcp --skill zhtw-rules -a codex`. Or copy the skill folder (.claude/skills/zhtw-rules in sysprog21/zhtw-mcp) into .agents/skills/zhtw-rules in your project. Codex loads it when a task matches its description.

Can I use Zhtw Rules in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sysprog21/zhtw-mcp --skill zhtw-rules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/zhtw-rules, .gemini/skills/zhtw-rules, .github/skills/zhtw-rules and .opencode/skills/zhtw-rules in your project.

What does Zhtw Rules need to run?

Going by SKILL.md and its folder, Zhtw Rules needs the command-line tools its instructions call (make). Our summary lists: Python 3.

Does Zhtw Rules access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Zhtw Rules safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Zhtw Rules use?

Zhtw Rules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Zhtw Rules use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Zhtw Rules?

Skills that share tags, products or a category with Zhtw Rules: Gate Tests (vercel/next.js, 143k stars), Gate (plugin87/ux-ui-agent-skills, 1.5k stars), Brain Ingest Gate (garrytan/gbrain, 31k stars) and Delivery Gate (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Zhtw Rules?

sysprog21 (a GitHub organization) maintains it in sysprog21/zhtw-mcp, which has 488 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 5, 2026.

Source: sysprog21/zhtw-mcp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.