Skip to content

feat: /tkm:language skill — 한국어 ↔ 영어 토글#2

Merged
ThunderConch merged 3 commits into
ThunderConch:masterfrom
eulneul:feat/language-skill
Apr 2, 2026
Merged

feat: /tkm:language skill — 한국어 ↔ 영어 토글#2
ThunderConch merged 3 commits into
ThunderConch:masterfrom
eulneul:feat/language-skill

Conversation

@eulneul
Copy link
Copy Markdown
Contributor

@eulneul eulneul commented Apr 1, 2026

Summary

  • skills/language/ 디렉토리에 새 스킬 추가
  • /tkm:language 실행 시 현재 언어를 감지하고 AskUserQuestion으로 토글
  • 기존 config set language en/ko CLI를 래핑한 인터랙티브 UX

How it works

  1. ~/.claude/tokenmon/config.json에서 현재 language 값 읽기
  2. 현재 언어를 보여주고 전환 여부 확인
  3. tokenmon config set language <en|ko> 실행
  4. tokenmon status로 변경 결과 확인

Test

/tkm:language

🤖 Generated with Claude Code

현재 언어를 확인하고 AskUserQuestion으로 한국어/영어를
인터랙티브하게 전환하는 스킬. config set language en/ko 커맨드 래핑.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@ThunderConch ThunderConch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: /tkm:language skill

전반적으로 스킬 구조와 흐름은 잘 짜여져 있습니다. 몇 가지 수정 부탁드립니다.


Critical — SKILL.md 언어 컨벤션 위반

기존 5개 스킬(tkm, doctor, setup, reset, uninstall) 모두 영어 기반으로 작성되어 있는데, 이 PR만 전체가 한국어입니다. 프로젝트 원칙상 SKILL.md는 영어 기반으로 작성하고, 한국어는 UX 메시지나 고유명사 등 필요한 곳에만 사용해야 합니다.

  • headings, 설명 prose, step 제목 → 영어로 전환
  • Step 2의 사용자 대면 프롬프트 문자열은 한국어 유지 OK

Important — config 파일 미존재 시 에러 처리

Step 1에서 readFileSync로 config를 직접 읽는데, ~/.claude/tokenmon/config.json이 없으면 크래시합니다. doctor 스킬처럼 파일 존재 여부 가드를 추가하거나, try/catch로 감싸서 기본값(ko)을 반환하도록 해주세요.

Important — "Keep" 선택 시 흐름 누락

Step 2에서 [Switch] [Keep] 선택지를 제공하지만, "Keep" 선택 시 어떻게 해야 하는지 명시가 없습니다. reset 스킬의 Cancel 처리처럼, 언어 유지 안내 후 종료하는 흐름을 추가해주세요.

Suggestion — frontmatter description 컨벤션

현재: "Tokenmon 언어 전환. 한국어 ↔ 영어 토글. Korean: ..."
권장: "Tokenmon language toggle. Switch between Korean and English. Korean: 언어, 영어, 한국어, 언어 변경, 언어 전환"

다른 스킬처럼 영어 설명 먼저, Korean: 키워드 섹션은 뒤에 배치해주세요.


수고하셨습니다 🙂

- 모든 heading/prose 영어로 전환 (다른 스킬 컨벤션 통일)
- frontmatter description: 영어 설명 먼저, Korean: 키워드 뒤에 배치
- Step 1: config 파일 없을 경우 try/catch로 기본값 ko 반환
- Step 3b: Keep 선택 시 명시적 종료 흐름 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread skills/language/SKILL.md
@@ -0,0 +1,52 @@
---
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

Found 4 issues:

  1. Step 1 hardcodes config path, ignoring CLAUDE_CONFIG_DIRsrc/core/paths.ts defines CLAUDE_DIR = process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude'), but Step 1 always reads ~/.claude/tokenmon/config.json. If a user has CLAUDE_CONFIG_DIR set, this reads the wrong file and shows incorrect current language before the toggle.

```bash
node -e "
try {
const cfg = JSON.parse(require('fs').readFileSync(require('os').homedir()+'/.claude/tokenmon/config.json','utf8'));
console.log(cfg.language ?? 'ko');
} catch { console.log('ko'); }
"
```

  1. Step 1 uses raw node -e instead of CLI — All other skills route config access through the CLI (tokenmon.ts), which runs readConfig()migrateConfig(). The inline node -e script bypasses migration logic that converts legacy Korean-named party/region data to IDs. Consider adding a config get subcommand or at minimum respecting CLAUDE_CONFIG_DIR.

```bash
node -e "
try {
const cfg = JSON.parse(require('fs').readFileSync(require('os').homedir()+'/.claude/tokenmon/config.json','utf8'));
console.log(cfg.language ?? 'ko');
} catch { console.log('ko'); }
"
```

  1. Step 3b "Keep" flow is underspecified — Step 2 provides explicit bilingual message templates for both ko and en, but Step 3b only says "inform them that the language remains unchanged and exit" with no concrete message. Other skills like reset/SKILL.md specify exact message templates for cancel paths. This will produce inconsistent behavior across invocations.

## Step 3b: Keep current language
If the user chose **Keep**, inform them that the language remains unchanged and exit.

  1. AskUserQuestion not used for Step 2 interactive promptreset/SKILL.md and setup/SKILL.md explicitly use AskUserQuestion when presenting choices to the user. Step 2 presents [Switch] [Keep] options without mentioning AskUserQuestion, deviating from the established skill pattern.

Show the current language and ask the user whether to switch.
- If current is `ko`: "현재 **한국어** 모드입니다. 영어로 전환할까요?"
- If current is `en`: "Currently in **English** mode. Switch to Korean?"
Options: [Switch] [Keep]
## Step 3a: Switch language

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

- Step 1: CLAUDE_CONFIG_DIR 환경변수 우선 사용하도록 node -e 수정
- Step 2: AskUserQuestion 도구 사용 명시
- Step 3b: Keep 선택 시 언어별 구체적 메시지 템플릿 지정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@ThunderConch ThunderConch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모든 피드백 반영 확인 완료. CLAUDE_CONFIG_DIR 존중, AskUserQuestion 명시, Keep 메시지 템플릿 추가. LGTM.

@ThunderConch ThunderConch merged commit 8812d54 into ThunderConch:master Apr 2, 2026
ThunderConch added a commit that referenced this pull request Apr 9, 2026
- Move readCodexTotalTokens() inside withLockRetry to fix TOCTOU (concurrency #3)
- Codex-only turns: award Codex XP even when Claude deltaTokens <= 0 (gen-addition #1)
- Advance checkpoint by consumed tokens only, retain sub-threshold remainder (gen-addition #2)
- Skip Claude XP (floor/rest bonus) on Codex-only turns to prevent false awards
- Log one-time warning when node:sqlite unavailable (stability #5)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ThunderConch added a commit that referenced this pull request Apr 9, 2026
- Move readCodexTotalTokens() inside withLockRetry to fix TOCTOU (concurrency #3)
- Codex-only turns: award Codex XP even when Claude deltaTokens <= 0 (gen-addition #1)
- Advance checkpoint by consumed tokens only, retain sub-threshold remainder (gen-addition #2)
- Skip Claude XP (floor/rest bonus) on Codex-only turns to prevent false awards
- Log one-time warning when node:sqlite unavailable (stability #5)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants