Skip to content

feat: スラッシュコマンドセレクターで .claude/skills も表示する (#343)#346

Merged
Kewton merged 3 commits intodevelopfrom
feature/343-worktree
Feb 22, 2026
Merged

feat: スラッシュコマンドセレクターで .claude/skills も表示する (#343)#346
Kewton merged 3 commits intodevelopfrom
feature/343-worktree

Conversation

@Kewton
Copy link
Owner

@Kewton Kewton commented Feb 22, 2026

Summary

  • .claude/skills/*/SKILL.md の frontmatter(name, description)を読み込み、スラッシュコマンドセレクターに「Skills」カテゴリとして統合表示
  • safeParseFrontmatter() で gray-matter の JavaScript エンジン(eval RCE)を無効化
  • deduplicateByName() で同名の command が skill を優先する明示的な重複排除
  • skillsCachecommandsCache とは独立管理(片方失敗時の耐障害性確保)
  • セキュリティ多層防御: シンボリックリンク不追跡、.. 拒否、パス検証、ファイルサイズ上限(64KB)、走査上限(100件)、フィールド長制限
  • API レスポンス sourcesskill カウントを追加

Changes

ファイル 変更内容
src/types/slash-commands.ts SlashCommandCategory / SlashCommandSource'skill' 追加、CATEGORY_LABELSskill: 'Skills' 追加
src/lib/slash-commands.ts loadSkills(), safeParseFrontmatter(), deduplicateByName(), skillsCache, getSlashCommandGroups() 拡張
src/lib/command-merger.ts CATEGORY_ORDER'skill' を workflow と standard-session の間に追加
src/app/api/worktrees/[id]/slash-commands/route.ts sources.skill カウント追加、flatMap DRY化
tests/unit/slash-commands.test.ts loadSkills / safeParseFrontmatter / deduplicateByName / clearCache / getSlashCommandGroups の新規テスト追加
tests/unit/lib/command-merger.test.ts CATEGORY_ORDER の skill 配置テスト追加
tests/integration/api-worktree-slash-commands.test.ts sources.skill プロパティ検証追加

Test plan

  • npx tsc --noEmit — エラー0件
  • npm run lint — 警告・エラー0件
  • npm run test:unit — 3743/3743 テストパス(184ファイル)
  • カバレッジ 82.35%(目標80%超)
  • 受入条件 14/14 全検証済み

Closes #343

🤖 Generated with Claude Code

Kewton and others added 3 commits February 22, 2026 16:17
- Add 'skill' to SlashCommandCategory and SlashCommandSource types
- Implement loadSkills() to read SKILL.md frontmatter (name, description)
- Add safeParseFrontmatter() to disable gray-matter JS engine (S001)
- Implement deduplicateByName() with command priority over skills
- Add skillsCache independent from commandsCache, cleared together
- Add 'skill' to CATEGORY_ORDER between workflow and standard-session
- Update API route to include skill count in sources response
- Add comprehensive tests (31 unit + 19 command-merger + 3 integration)
- Coverage: slash-commands.ts 93%, command-merger.ts 93%, route.ts 84%

Resolves #343

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add documentation comments to improve code maintainability for Issue #343:

- filterCommands(): note that it only searches commandsCache, not skills
- loadSlashCommands(): document dual commandsCache assignment pattern
- loadSkills(): explain async declaration rationale (consistency)
- parseSkillFile(): [D009] clarify cliTools vs allowed-tools distinction
- route.ts: TODO for SlashCommandsResponse type unification with api-client.ts

No logic changes. All tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…orts

- Add slash-commands module entries to CLAUDE.md
- Add Issue #343 to implementation-history.md
- Add design policy, issue review, design review, and pm-auto-dev reports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Kewton Kewton merged commit 839b441 into develop Feb 22, 2026
5 checks passed
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.

1 participant