-
-
Notifications
You must be signed in to change notification settings - Fork 224
add agents settings #1199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add agents settings #1199
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7bd8ffa
Add agent guidelines and translation skills
ken71301 61ca22e
Add quick term map to terminology reference
ken71301 7467f1c
Simplify terminology reference to map table
ken71301 8a3eb14
Format terminology map as markdown table
ken71301 fb7c608
feat: add Claude settings, skills, and agent guidelines
josix 01edb89
fix: update skill after poc (#1206)
ken71301 5041d3c
feat: unify and enhance skills md
josix 119c10e
chore: add more references to terminology
josix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/claude-code-settings.json", | ||
| "hooks": { | ||
| "PreToolUse": [ | ||
| { | ||
| "matcher": "Edit", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -q '\\.po\"'; then echo '[Translation Context] Remember: Use skills translate-po, terminology-check, validate-translation. Check doc-translate/references/terminology.md for terms.'; fi" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "PostToolUse": [ | ||
| { | ||
| "matcher": "Edit", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -q '\\.po\"'; then echo '[Post-Edit Reminder] Run: make lint to verify reST syntax. Check terminology with terminology-check skill.'; fi" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "matcher": "Write", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -q '\\.po\"'; then echo '[Post-Write Reminder] PO file modified. Verify: 1) Line length <= 79 chars, 2) Terminology consistency, 3) reST syntax with make lint'; fi" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(make lint)", | ||
| "Bash(make build *)", | ||
| "Bash(make fuzzy)", | ||
| "Bash(make todo)", | ||
| "Bash(make progress)", | ||
| "Bash(powrap *)" | ||
| ] | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| name: check-terminology | ||
| description: Checks terminology consistency against project glossary and identifies zh_CN terms that need conversion to zh_TW. Use to verify term usage. | ||
| argument-hint: <term-or-po-file> | ||
| --- | ||
|
|
||
| # check-terminology | ||
|
|
||
| Check terminology against project glossary and zh_CN/zh_TW mappings. | ||
|
|
||
| ## Terminology Sources | ||
|
|
||
| 1. **Primary:** `glossary.po` - Official Python glossary translations | ||
| 2. **Secondary:** `focused_terminology_dictionary.csv` - 118 key terms | ||
| 3. **Tertiary:** `.scripts/google_translate/utils.py` - zh_CN to zh_TW mappings | ||
|
|
||
| ## Check Process | ||
|
|
||
| ### For a Single Term | ||
| 1. Search in `../translate-po/references/terminology.md` | ||
| 2. Check if it's in `references/keep-in-english.md` | ||
| 3. If found, use the standard translation | ||
| 4. If not found, check `glossary.po` in project root | ||
|
|
||
| ### For a PO File | ||
| 1. Extract all translated terms from msgstr | ||
| 2. Cross-reference against glossary | ||
| 3. Identify forbidden zh_CN terms | ||
| 4. Report inconsistencies | ||
|
|
||
| ## Error Categories | ||
|
|
||
| ### Category 1: Forbidden Terms (Must Fix) | ||
| zh_CN terms that must be converted to zh_TW. | ||
|
|
||
| Example violations: | ||
| - `函數` -> should be `函式` | ||
| - `返回` -> should be `回傳` | ||
| - `對象` -> should be `物件` | ||
|
|
||
| ### Category 2: Inconsistent Terms (Should Review) | ||
| Same English term translated differently across files. | ||
|
|
||
| ### Category 3: Missing from Glossary (Informational) | ||
| New terms not yet in the glossary. | ||
|
|
||
| ## Context Decision Log | ||
|
|
||
| When a reviewer decides a translation depends on nearby context (above/below), | ||
| record the decision here for future reference. Keep entries short and specific. | ||
|
|
||
| Format: | ||
| - **Term/pattern:** ... | ||
| - **Decision:** ... | ||
| - **Context cue:** ... | ||
| - **Example:** `source` -> `translation` | ||
|
|
||
| Example: | ||
| - **Term/pattern:** 類型 / 型別 | ||
| - **Decision:** 用語依上下文;Python 型別物件用「型別」,一般分類用「類型」 | ||
| - **Context cue:** 出現 `int/str/dict/type` 或 "type object" | ||
| - **Example:** "two types of packages" -> "兩種類型的套件" | ||
|
|
||
| Decision Log: | ||
| - **Term/pattern:** 類型 / 型別 | ||
| - **Decision:** 用語依上下文;Python 型別物件用「型別」,一般分類用「類型」 | ||
| - **Context cue:** 出現 `int/str/dict/type` 或 "type object" | ||
| - **Example:** "two types of packages" -> "兩種類型的套件" | ||
|
|
||
| ## Quick Lookup | ||
|
|
||
| 1. Check `../translate-po/references/terminology.md` first (authoritative, 186 terms) | ||
| 2. If term should stay in English, see `references/keep-in-english.md` | ||
|
|
||
| ## References | ||
|
|
||
| - `../translate-po/references/terminology.md` - Complete term translations (186 terms) | ||
| - `references/keep-in-english.md` - Terms that stay in English | ||
| - [術語列表 Wiki](https://github.com/python/python-docs-zh-tw/wiki/%E8%A1%93%E8%AA%9E%E5%88%97%E8%A1%A8) - Project terminology wiki | ||
| - [l10n-tw Glossaries](https://hackmd.io/@l10n-tw/glossaries) - Taiwan localization glossaries | ||
| - [兩岸術語對照表](https://zh.wikibooks.org/zh/%E5%A4%A7%E9%99%86%E5%8F%B0%E6%B9%BE%E8%AE%A1%E7%AE%97%E6%9C%BA%E6%9C%AF%E8%AF%AD%E5%AF%B9%E7%85%A7%E8%A1%A8) - Cross-strait terminology comparison |
73 changes: 73 additions & 0 deletions
73
.claude/skills/check-terminology/references/keep-in-english.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Terms to Keep in English | ||
|
|
||
| These terms should NOT be translated. They remain in English in all translations. | ||
|
|
||
| ## Python Keywords | ||
|
|
||
| All Python keywords stay in English: | ||
| ``` | ||
| def, class, if, else, elif, for, while, try, except, finally, | ||
| with, as, pass, break, continue, raise, assert, yield, from, | ||
| global, nonlocal, del, in, is, not, and, or, return, import, | ||
| async, await, lambda, True, False, None | ||
| ``` | ||
|
|
||
| ## Built-in Type Names (in code context) | ||
|
|
||
| When referring to actual Python types in code: | ||
| ``` | ||
| int, float, str, bytes, bool, complex | ||
| list, tuple, dict, set, frozenset | ||
| iterator, generator, iterable | ||
| range, slice, type, object | ||
| ``` | ||
|
|
||
| Note: In prose, these may be translated (e.g., "a list" -> "一個串列") | ||
|
|
||
| ## Standard Library Modules | ||
|
|
||
| Module names stay in English: | ||
| ``` | ||
| os, sys, re, json, pickle, collections, itertools, functools, | ||
| datetime, logging, unittest, typing, asyncio, pathlib, etc. | ||
| ``` | ||
|
|
||
| ## Exception Class Names | ||
|
|
||
| All exception names stay in English: | ||
| ``` | ||
| Exception, ValueError, TypeError, AttributeError, KeyError, | ||
| IndexError, ImportError, RuntimeError, NameError, StopIteration, | ||
| FileNotFoundError, PermissionError, ConnectionError, TimeoutError, | ||
| NotImplementedError, MemoryError, RecursionError, ZeroDivisionError, | ||
| OverflowError, UnboundLocalError, AssertionError, SyntaxError, | ||
| IndentationError, TabError, UnicodeError, UnicodeDecodeError, | ||
| UnicodeEncodeError, UnicodeTranslateError | ||
| ``` | ||
|
|
||
| ## Special Method Names | ||
|
|
||
| All dunder methods stay in English: | ||
| ``` | ||
| __init__, __str__, __repr__, __len__, __getitem__, __setitem__, | ||
| __delitem__, __contains__, __iter__, __next__, __enter__, __exit__, | ||
| __call__, __new__, __del__, __eq__, __hash__, __bool__, etc. | ||
| ``` | ||
|
|
||
| ## Technical Terms (Context Dependent) | ||
|
|
||
| These may stay in English in technical contexts: | ||
| - `runtime` (執行時期 in prose) | ||
| - `mock`, `patch` (testing terms) | ||
| - `pickle` (serialization) | ||
| - `GIL` (Global Interpreter Lock) | ||
| - `API` (Application Programming Interface) | ||
| - `URL`, `HTTP`, `HTML`, `JSON`, `XML` | ||
| - `CPU`, `RAM`, `I/O` | ||
|
|
||
| ## Brand/Project Names | ||
|
|
||
| - Python, CPython, PyPy, Jython | ||
| - Sphinx, reStructuredText (reST) | ||
| - GitHub, GitLab | ||
| - NumPy, pandas, Django, Flask |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| --- | ||
| name: translate-po | ||
| description: Translates PO file entries from English to Traditional Chinese (zh_TW) following project conventions. Use when translating new PO files or untranslated entries. | ||
| argument-hint: <path-to-po-file> | ||
| --- | ||
|
|
||
| # translate-po | ||
|
|
||
| Translate English PO msgid entries to Traditional Chinese msgstr following all project rules. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. Read the full msgid before translating | ||
| 2. Check msgctxt and translator comments for context | ||
| 3. Look up terminology in `references/terminology.md` | ||
| 4. Check `references/forbidden-terms.md` for zh_CN terms to avoid | ||
|
|
||
| ## Translation Process | ||
|
|
||
| ### Step 1: Content Analysis | ||
| Identify content type: | ||
| - **Pure prose:** Translate normally | ||
| - **Code-only:** Preserve exactly (no translation) | ||
| - **Mixed:** Translate prose, preserve code/roles | ||
| - **reST structural:** Preserve directives, translate display text | ||
|
|
||
| ### Step 2: Apply Rules | ||
|
|
||
| **Punctuation:** | ||
| - Chinese text: Full-width `「」()、,。:;!?` | ||
| - English text: Half-width `(),.;:!?` | ||
|
|
||
| **CJK-Latin Spacing:** | ||
| - Add space between Chinese and Latin: "使用 CPU 運算" (correct) | ||
| - No space with symbols: "使用「CPU」運算" (correct) | ||
|
|
||
| **Line Width:** Max 79 characters (use multi-line format for longer text) | ||
|
|
||
| ### Step 3: reST Handling | ||
|
|
||
| See `references/rst-cheatsheet.md` for complete rules. | ||
|
|
||
| **Key patterns:** | ||
| - `:mod:`os`` -> Keep unchanged | ||
| - `:term:`iterator`` -> `:term:`疊代器 <iterator>`` | ||
| - Chinese before role: "參閱\\ :mod:`os`" | ||
| - After `::` markers: "範例: ::" | ||
|
|
||
| ### Step 4: Terminology Workflow | ||
|
|
||
| 1. Check term in `references/terminology.md` | ||
| 2. If not found, check `glossary.po` in project root | ||
| 3. If uncertain, add `#, fuzzy` flag | ||
| 4. Never use zh_CN terms from `references/forbidden-terms.md` | ||
|
|
||
| ## Output Format | ||
|
|
||
| ``` | ||
| msgid "Original English text" | ||
| msgstr "翻譯後的中文內容" | ||
| ``` | ||
|
|
||
| For uncertain translations, add `#, fuzzy` flag before the entry. | ||
|
|
||
| ## Quality Checklist | ||
|
|
||
| Before outputting, verify: | ||
| - [ ] Line length <= 79 characters | ||
| - [ ] Full-width punctuation in Chinese text | ||
| - [ ] CJK-Latin spacing correct | ||
| - [ ] reST syntax preserved | ||
| - [ ] Terminology matches glossary | ||
| - [ ] No forbidden zh_CN terms | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Simple Prose | ||
| ``` | ||
| msgid "Python is a programming language." | ||
| msgstr "Python 是一種程式語言。" | ||
| ``` | ||
|
|
||
| ### With Terminology | ||
| ``` | ||
| msgid "This function returns an iterator." | ||
| msgstr "此函式回傳一個疊代器。" | ||
| ``` | ||
|
|
||
| ### With reST Role | ||
| ``` | ||
| msgid "See :func:`len` for details." | ||
| msgstr "詳情請參閱\\ :func:`len`。" | ||
| ``` | ||
|
|
||
| ### With Link | ||
| ``` | ||
| msgid "Visit the `Python website <https://python.org>`_." | ||
| msgstr "請造訪 `Python 網站 <https://python.org>`_。" | ||
| ``` | ||
|
|
||
| ### With Term Reference | ||
| ``` | ||
| msgid "Returns a :term:`context manager`." | ||
| msgstr "回傳一個\\ :term:`情境管理器 <context manager>`。" | ||
| ``` | ||
|
|
||
| ### Mixed Content | ||
| ``` | ||
| msgid "The :class:`list` type is a :term:`mutable` sequence." | ||
| msgstr ":class:`list` 型別是一個\\ :term:`可變物件 <mutable>` 序列。" | ||
| ``` | ||
|
|
||
| ### Multi-line Format | ||
| ``` | ||
| msgstr "" | ||
| "第一行翻譯內容" | ||
| "第二行繼續翻譯。" | ||
| ``` | ||
|
|
||
| ### Fuzzy Flag | ||
| Add `#, fuzzy` when translation is uncertain or needs human review: | ||
| ``` | ||
| #, fuzzy | ||
| msgid "Original text" | ||
| msgstr "可能需要審核的翻譯" | ||
| ``` | ||
|
|
||
| ## References | ||
|
|
||
| - `references/terminology.md` - Key term translations (186 terms) | ||
| - `references/forbidden-terms.md` - zh_CN to zh_TW mappings | ||
| - `references/rst-cheatsheet.md` - reST syntax rules |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.