Skip to content

fix: unify skill sync across all AI agents - #757

Merged
keito4 merged 1 commit into
mainfrom
fix/unified-agent-skills-sync
May 20, 2026
Merged

fix: unify skill sync across all AI agents#757
keito4 merged 1 commit into
mainfrom
fix/unified-agent-skills-sync

Conversation

@keito4

@keito4 keito4 commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • install-skills.sh を全エージェント(Claude Code / Codex / Cursor / Gemini CLI)対応に拡張
  • Claude Code のスキル・コマンド・ルールを .agents/skills/ に SKILL.md 形式で同期し、各エージェントのスキルディレクトリへシンボリックリンク
  • .codex/config.toml を実際の設定に同期(モデル・MCP サーバー・プラグイン更新)

主な変更点

  • install-skills.sh: npx skills add -a '*' で全エージェント対応、@tag 付きエントリの冪等性修正、カスタムスキル/コマンド/ルール同期、Codex prompts リンク作成
  • .codex/config.toml: gpt-5.5 モデル、o3/context7/linear/doppler MCP 追加、bearer_token_env_var 形式に統一、curated plugins 追加
  • .gitignore: .codex/prompts/ 追加
  • Dockerfile: コメント更新

Test plan

  • bash script/install-skills.sh を複数回実行して冪等性を確認
  • codex debug prompt-input でスキルの認識を確認
  • Codex セッションで自然言語指示によるスキル実行を確認
  • DevContainer ビルドでスクリプトが正常動作することを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Project-local skills installation for improved agent environment isolation
    • Multi-agent skills synchronization across Codex, Cursor, and Gemini
  • Chores

    • Updated development environment documentation for skills setup
    • Enhanced AI configuration and plugin enablement
    • Improved build and installation infrastructure

Review Change Stack

install-skills.sh を全エージェント対応に拡張し、Claude Code のスキル・
コマンド・ルールを Codex/Cursor/Gemini CLI でも利用可能にする。

- skills.txt のインストールに -a '*' を追加して全エージェント対応
- @tag 付きエントリの存在チェック修正(毎回再インストール防止)
- カスタムスキル・コマンド・ルールを .agents/skills/ に SKILL.md 形式で同期
- 各エージェントディレクトリへの相対パスシンボリックリンク作成
- .codex/prompts/ へのコマンドリンク作成
- .codex/config.toml を実際の設定に同期(モデル・MCP・プラグイン)
- プロジェクト/グローバル両方の冪等性チェック

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR migrates the agent skills installation system from home-directory to project-local directories, refactors the installation script with new helper functions and a multi-agent synchronization pipeline, updates Codex AI to model gpt-5.5 with xhigh reasoning, configures MCP servers with refreshed authentication, and enables multiple Codex plugins.

Changes

Multi-agent Skills Installation and Codex Configuration Migration

Layer / File(s) Summary
Skills installation refactoring
script/install-skills.sh, .devcontainer/Dockerfile
Script header and initialization reflect multi-agent context. Project skills root directory becomes ./.agents/skills (relative to PWD). New skill_exists helper checks both global and project-local directories. Repository-to-skill mapping supports owner/repo@skill-style tags. npx skills add includes -a '*' to target all agents. New sync_claude_to_agents function converts .claude markdown files into .agents/skills/SKILL.md, creates .codex/prompts symlinks, and aggregates per-agent skill links (.codex/skills, .cursor/skills, .gemini/skills) with project-local priority and global fallback. Dockerfile documentation updates to describe .agents/skills installation and .claude/skills/*.md sync behavior.
Codex AI model and MCP server configuration
\.codex/config.toml
Model upgrades to gpt-5.5 with xhigh reasoning effort; web_search = "live" replaces prior request flag. Workspace-write sandbox and RMCP client are retained. MCP servers are reworked: o3 server added with API key and search/reasoning env block; Supabase and Vercel authentication switch from HTTP headers to bearer_token_env_var; additional servers (context7, doppler with npm cache env) are adjusted.
Codex plugins and prompt management
\.codex/config.toml, .gitignore
Multiple Codex plugins are enabled (Google Calendar, Gmail, Vercel, GitHub, Google Drive, browser, documents, spreadsheets, presentations). notice.model_migrations target updates from gpt-5.1-codex-max to gpt-5.2-codex. New .gitignore rule excludes .codex/prompts/ directory (generated by sync pipeline) from version control.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • keito4/config#447: Modifies script/install-skills.sh skill discovery and "already installed" handling logic, overlapping directly with the main PR's skill detection and verification refactoring.
  • keito4/config#386: Updates script/install-skills.sh skill installation target location and sync/link pipeline, sharing the same implementation scope as the main PR's multi-agent skills refactoring.
  • keito4/config#127: Modifies .codex/config.toml MCP server setup (especially mcp_servers.o3 environment and Supabase/Vercel configuration), directly overlapping with the main PR's MCP server configuration rework.

Suggested labels

released

Poem

🐰 From Claude's nest to agents' sprawl,
Skills now sync and link for all!
Codex rises, reasoning stays high,
MCP servers stand nearby.
Multi-agent harmony—a config tale!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: unifying skill sync across all AI agents, which is the primary focus of the changeset.
Description check ✅ Passed The description covers most required sections: Summary, key changes, and test plan are comprehensive. However, the 'Why' section is missing, and 'How to test' lacks structured steps despite a test plan being present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/unified-agent-skills-sync

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 1m 47s —— View job


コードレビュー

  • コンテキストの収集
  • 変更ファイルの確認
  • レビューフィードバックの作成

総評

スキル同期の統一化という意図は明確で、実装の方向性は良いです。冪等性の考慮や @tag 形式への対応など、細部の改善も見られます。ただし、いくつかのバグ・リスクがあります。


🔴 Major

1. model_reasoning_effort = "xhigh" — 非標準値の可能性

.codex/config.toml:3

model_reasoning_effort = "xhigh"

標準的な推論努力レベルは "low" / "medium" / "high" です。"xhigh" が受け入れられない場合、API エラーで Codex が起動しなくなる可能性があります。有効な値であることを公式ドキュメントで確認してください。

Fix this →


2. [mcp_servers.linear] — 認証設定なし

.codex/config.toml:50-51

[mcp_servers.linear]
url = "https://mcp.linear.app/mcp"

bearer_token_env_var が未設定です。Linear の MCP サーバーは認証が必要なため、接続に失敗するか未認証でアクセスされる恐れがあります。他のリモート MCP 同様に設定が必要です:

[mcp_servers.linear]
url = "https://mcp.linear.app/mcp"
bearer_token_env_var = "LINEAR_API_KEY"

Fix this →


🟡 Minor

3. macOS 固有のパスが DevContainer 環境で動作しない可能性

.codex/config.toml:58

[mcp_servers.doppler.env]
npm_config_cache = "/private/tmp/codex-npm-cache"

/private/tmp は macOS 固有のパスです。Linux (DevContainer/Codespaces) では /tmp を使うべきです。クロスプラットフォーム対応として ${TMPDIR:-/tmp}/codex-npm-cache もしくは /tmp/codex-npm-cache の使用を推奨します。


4. シンボリックリンクの相対パスが2階層固定

script/install-skills.sh:269-270

if [[ -d "${PROJECT_AGENTS_DIR}/${skill_name}" ]]; then
    ln -s "../../.agents/skills/${skill_name}" "$link_path"

../../ という相対パスは .codex/skills/.cursor/skills/.gemini/skills/ (2階層深い) という前提に依存しています。将来的に異なる深さのエージェントディレクトリが追加された場合、リンクが壊れます。コメントに明記されていますが、AGENT_SKILL_DIRS の定義を拡張する際には注意が必要です。


5. github MCP サーバーが削除されている

旧設定の [mcp_servers.github] (GitHub Copilot MCP) が削除されました。[plugins."github@openai-curated"] がそれを代替する意図であれば PR の説明に記載するとレビュアーが混乱しません。GitHub への接続が必要なワークフロー(コードレビュー、Issue 参照など)に影響がないか確認してください。


💡 Recommendation

6. model_migrations の stale なエントリ

.codex/config.toml:64-65

[notice.model_migrations]
"gpt-5.1-codex-max" = "gpt-5.2-codex"

modelgpt-5.5 に更新されたにもかかわらず、移行マッピングは gpt-5.2-codex を指したままです。これは実害はありませんが、設定の意図を分かりにくくします。


7. sync_claude_to_agentsPROJECT_AGENTS_DIR を暗黙グローバルとして使用

script/install-skills.sh:130-184

関数内で PROJECT_AGENTS_DIR をグローバル変数として直接参照しています。ローカル変数として渡すか、local target_base_dir としてパラメータ化するとテスト・再利用性が上がります(現状は動作上問題なし)。


✅ 良い点

  • @tag 付きエントリの冪等性修正 (${skill##*@}) は正確で実用的
  • skill_exists() でグローバル・プロジェクト両方を確認する設計は堅牢
  • [[ -f "$src_file" ]] || continue による glob 展開の安全な処理
  • grep -c '^---$' || trueset -e との相互作用を適切に回避
  • -L で壊れたシンボリックリンクも検出してスキップする処理

| Branch: fix/unified-agent-skills-sync

@keito4 keito4 self-assigned this May 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.codex/config.toml:
- Around line 53-59: The Docker/DevContainer config sets npm_config_cache to a
macOS-specific path "/private/tmp/codex-npm-cache" under the
[mcp_servers.doppler.env] block which will break on Linux; update the
npm_config_cache value to a cross-platform temp location (e.g., use
"/tmp/codex-npm-cache" or resolve from TMPDIR/TEMP environment variables) so the
doppler MCP server launched by the "command"/"args" (npx `@dopplerhq/mcp-server`)
works in DevContainer/Linux environments; change only the npm_config_cache env
value to use a portable path or an environment-derived fallback.

In `@script/install-skills.sh`:
- Around line 171-178: The frontmatter writes description unquoted which breaks
YAML when description contains special characters; update the printf that emits
"description: ${description}" so the description value is safely quoted/escaped
(e.g., wrap the value in double quotes and escape any inner quotes) before
writing to "$target_file" — adjust the printf invocation that uses variables
name, description, target_file (and keep the subsequent printf "$body" append)
to emit a properly quoted/escaped description string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ace1c822-83e6-475e-a19f-b13972f73361

📥 Commits

Reviewing files that changed from the base of the PR and between 58a6e83 and 5d6b3cf.

📒 Files selected for processing (4)
  • .codex/config.toml
  • .devcontainer/Dockerfile
  • .gitignore
  • script/install-skills.sh

Comment thread .codex/config.toml
Comment on lines +53 to 59
[mcp_servers.doppler]
command = "npx"
args = ["-y", "@dopplerhq/mcp-server", "--read-only"]

[mcp_servers.github.http_headers]
Authorization = "Bearer ${GITHUB_COPILOT_MCP_TOKEN}"
[mcp_servers.doppler.env]
npm_config_cache = "/private/tmp/codex-npm-cache"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

macOS-specific path will fail in DevContainer/Linux environments.

/private/tmp/ is a macOS-specific path (where /tmp is a symlink to /private/tmp). On Linux systems, including the DevContainer which runs Ubuntu, this path doesn't exist and will cause the doppler MCP server to fail or behave unexpectedly.

Proposed fix
 [mcp_servers.doppler.env]
-npm_config_cache = "/private/tmp/codex-npm-cache"
+npm_config_cache = "/tmp/codex-npm-cache"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[mcp_servers.doppler]
command = "npx"
args = ["-y", "@dopplerhq/mcp-server", "--read-only"]
[mcp_servers.github.http_headers]
Authorization = "Bearer ${GITHUB_COPILOT_MCP_TOKEN}"
[mcp_servers.doppler.env]
npm_config_cache = "/private/tmp/codex-npm-cache"
[mcp_servers.doppler]
command = "npx"
args = ["-y", "`@dopplerhq/mcp-server`", "--read-only"]
[mcp_servers.doppler.env]
npm_config_cache = "/tmp/codex-npm-cache"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.codex/config.toml around lines 53 - 59, The Docker/DevContainer config sets
npm_config_cache to a macOS-specific path "/private/tmp/codex-npm-cache" under
the [mcp_servers.doppler.env] block which will break on Linux; update the
npm_config_cache value to a cross-platform temp location (e.g., use
"/tmp/codex-npm-cache" or resolve from TMPDIR/TEMP environment variables) so the
doppler MCP server launched by the "command"/"args" (npx `@dopplerhq/mcp-server`)
works in DevContainer/Linux environments; change only the npm_config_cache env
value to use a portable path or an environment-derived fallback.

Comment thread script/install-skills.sh
Comment on lines +171 to +178
printf '%s\n' "---" \
"name: ${name}" \
"description: ${description}" \
"metadata:" \
" author: keito4" \
" version: \"1.0.0\"" \
"---" > "$target_file"
printf '%s\n' "$body" >> "$target_file"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

YAML description field should be quoted to handle special characters.

If the extracted description contains YAML special characters (:, #, ", etc.), the generated SKILL.md will have malformed frontmatter. For example, a heading like "Fix: improve performance" would produce description: Fix: improve performance, which is ambiguous YAML.

Proposed fix
         mkdir -p "$target_dir"
+        # Escape double quotes and wrap in quotes for YAML safety
+        local safe_description="${description//\"/\\\"}"
         printf '%s\n' "---" \
             "name: ${name}" \
-            "description: ${description}" \
+            "description: \"${safe_description}\"" \
             "metadata:" \
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@script/install-skills.sh` around lines 171 - 178, The frontmatter writes
description unquoted which breaks YAML when description contains special
characters; update the printf that emits "description: ${description}" so the
description value is safely quoted/escaped (e.g., wrap the value in double
quotes and escape any inner quotes) before writing to "$target_file" — adjust
the printf invocation that uses variables name, description, target_file (and
keep the subsequent printf "$body" append) to emit a properly quoted/escaped
description string.

@keito4

keito4 commented May 20, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

  • Major script/install-skills.sh 行21-22, 215-270 / .devcontainer/Dockerfile 行175-178
    Docker build では /tmp/install-skills.sh /home/vscode/.claude/skills/skills.txt を実行していますが、同期先を $PWD ベースで作っているため、/home/vscode/.codex/skills など本来のユーザー設定配下に作られません。作業ディレクトリ次第では権限エラーになり、Dockerfile 側の || で失敗も警告に潰れます。

  • Major script/install-skills.sh 行43-46, 101-104, 238-255
    既に ~/.agents/skills にあるスキルはインストール処理をスキップしますが、その後のリンク対象収集はプロジェクト .agents/skills とローカル Claude ファイルだけです。既存のグローバルスキル利用者は .codex/skills / .cursor/skills / .gemini/skills へのリンクが作られず、「全エージェント向け同期」がアップグレード時に機能しません。

  • Minor .gitignore 行69-76 / script/install-skills.sh 行235-260
    スクリプトは .gemini/skills を生成しますが、.gitignore に追加されていません。実際に現在の作業ツリーでも ?? .gemini/skills/ が出ており、実行するたびに未追跡ファイルで汚れます。

全体判定: patch is incorrect。主要な同期経路が Docker build と既存グローバルインストール環境で壊れます。信頼度: 0.88


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@keito4

keito4 commented May 20, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

発見事項

  • [major] script/install-skills.sh:21-22, .devcontainer/Dockerfile:174-178
    PROJECT_AGENTS_DIR${PWD} 基準になっていますが、Dockerfile は /tmp/install-skills.sh /home/vscode/.claude/skills/skills.txt を実行する前に cd /home/vscodeWORKDIR を設定していません。結果としてビルド時のカレントディレクトリ配下に .agents/.codex/.gemini を作ろうとし、vscode ユーザーでは失敗するか、少なくとも /home/vscode 配下に同期されません。HOME または SKILLS_FILE から同期先を決める必要があります。

  • [minor] .gitignore:69-76, script/install-skills.sh:235
    新スクリプトは .gemini/skills/ を生成しますが、.gitignore に追加されていません。実際に現在の作業ツリーでも ?? .gemini/skills/ が出ており、インストール実行後に大量の生成 symlink が未追跡として残ります。.codex/skills/.cursor/skills/ と同様に ignore してください。

全体判定

patch is incorrect。DevContainer ビルド時の同期先が不安定で、新機能の all-agent skill 同期が期待通りに配置されない可能性が高いです。信頼度: 0.87

確認: bash -n script/install-skills.sh.codex/config.toml の TOML parse は成功しました。shellcheck はこの環境にありませんでした。


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@keito4
keito4 merged commit 3becb7f into main May 20, 2026
24 checks passed
@keito4
keito4 deleted the fix/unified-agent-skills-sync branch May 20, 2026 05:34
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.112.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant