Agents tools quoted json
Skill bokuwalily/claude-code-skills/skills/agents-tools-quoted-json
75 battle-tested Claude Code skills from shipping 20+ apps solo — macOS, Next.js, Vercel, iOS/Expo, Cloudflare, Phaser, local AI media & more
npx -y skills add bokuwalily/claude-code-skills --skill agents-tools-quoted-jsonAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
~/.claude/agents/ の各 agent frontmatter `tools:` フィールドが bare-bracket (`[Read, Edit]`) や `allowed-tools:` 旧式で不統一なとき、quoted JSON 配列形式に一括正規化したいとき。
SKILL.md
2.3 KB, as published. Nobody here has run it
Procedure
- 現状調査:
grep -E '^(tools|allowed-tools):' ~/.claude/agents/*.mdで形式不統一の agent を列挙。bare-bracket / quoted / 旧allowed-tools:の 3 種に分類。 - 正規形を決定:
tools: ["Read", "Edit", "Bash"]を採用 (YAML 内 JSON、quote 必須)。 - 権限最小化を併走: reviewer 系 (
code-reviewer,security-reviewer,database-reviewer等) は原則 read-only (["Read", "Grep", "Glob"])。Write/Edit/Bash 不要な箇所は剥がす。 - 一括変換 script: python で frontmatter YAML を
ruamel.yamlで読み、toolsを list 化 + 全要素 str() 化して書き戻す。allowed-tools:キーはtools:にリネーム。 - diff レビュー: 変換後
git diffで 1 ファイルずつ妥当性チェック (特に reviewer 系の権限剥がし)。
Pitfalls
- YAML 内 JSON は single-line で書く。複数行配列は YAML として解釈されて quote が外れる場合あり。
Agentツールは「agent から agent を呼ぶ」権限。reviewer 系には不要 (循環呼出しのリスク)。- 既存 agent が
allowed-tools:(古い key) で動作している場合、リネーム後に Claude Code 再起動するまで反映されない。 - bash の
sedで YAML 編集すると quote escape を間違えやすい → 必ず YAML parser 経由で書き換え。 - frontmatter の delimiter (
---) を python 側で誤って消すと agent 自体が壊れる。書き戻し前にhead -1で確認。
Verification
- 全 agent で
grep '^tools:' *.md | grep -c '\["'が agent 総数と一致。 ~/.claude/scripts/agents-index.shで 61 agents (or 実数) の frontmatter validate が全 PASS。- 変換後 1 agent を実際に呼んで挙動が変わらないこと (権限剥がしで本来必要なツールを落としていないか)。
grep -L '^tools:' ~/.claude/agents/*.mdでtools:欠落 agent が 0。