AgentSkillsCN

cross-platform-sync

验证并维护跨平台的智能体指令文件(AGENTS.md、CLAUDE.md、copilot-instructions.md)。确保符号链接正确、内容同步,使所有AI编码智能体都能接收到一致的指令。在新建仓库、审核智能体配置,或调试不同智能体行为差异时使用。

SKILL.md
--- frontmatter
name: cross-platform-sync
description: Validate and maintain cross-platform agent instruction files (AGENTS.md, CLAUDE.md, copilot-instructions.md). Ensure symlinks are correct, content is synchronized, and all AI coding agents receive consistent instructions. Use when setting up a new repo, auditing agent configs, or debugging why different agents behave differently.

Cross-Platform Sync

Ensures agent instruction files are synchronized across GitHub Copilot, OpenAI Codex, Windsurf, Claude Code, and Manus.

When to Use This Skill

  • Setting up a new repository for multi-agent development
  • Auditing existing agent configuration files
  • Debugging inconsistent agent behavior across platforms
  • After modifying AGENTS.md or any agent instruction file

Canonical Structure

code
repo-root/
├── AGENTS.md                      # Canonical source (all platforms)
├── CLAUDE.md                      # Symlink → AGENTS.md
├── .github/
│   ├── copilot-instructions.md    # Symlink → ../AGENTS.md
│   └── instructions/              # Path-specific Copilot rules
│       └── *.instructions.md
├── .claude/
│   └── CLAUDE.md                  # Symlink → ../AGENTS.md
├── .codex/
│   ├── AGENTS.md                  # Symlink → ../AGENTS.md
│   └── skills/                    # Symlink → ../skills/
└── skills/                        # Canonical skills location
    └── <skill-name>/
        └── SKILL.md

Validation Steps

Step 1: Check Symlinks Exist

bash
ls -la AGENTS.md CLAUDE.md .github/copilot-instructions.md .codex/AGENTS.md .claude/CLAUDE.md 2>/dev/null

Expected output shows symlinks pointing to AGENTS.md:

code
lrwxrwxrwx CLAUDE.md -> AGENTS.md
lrwxrwxrwx .github/copilot-instructions.md -> ../AGENTS.md
lrwxrwxrwx .codex/AGENTS.md -> ../AGENTS.md
lrwxrwxrwx .claude/CLAUDE.md -> ../AGENTS.md

Step 2: Verify Symlinks Resolve

bash
# All should show identical content
head -5 AGENTS.md
head -5 CLAUDE.md
head -5 .github/copilot-instructions.md

Step 3: Check Skills Symlink

bash
ls -la .codex/skills
# Should show: .codex/skills -> ../skills

Step 4: Validate No Duplicate Content

bash
# These should fail (files should be symlinks, not copies)
diff AGENTS.md CLAUDE.md 2>/dev/null && echo "WARNING: CLAUDE.md is a copy, not symlink"

Setup Commands

Create Symlinks (New Repo)

bash
# Create AGENTS.md as canonical source first
# Then create symlinks

ln -sf AGENTS.md CLAUDE.md
mkdir -p .github .claude .codex
ln -sf ../AGENTS.md .github/copilot-instructions.md
ln -sf ../AGENTS.md .claude/CLAUDE.md
ln -sf ../AGENTS.md .codex/AGENTS.md
ln -sf ../skills .codex/skills

Fix Broken Symlinks

bash
# Remove existing files and recreate symlinks
rm -f CLAUDE.md .github/copilot-instructions.md .codex/AGENTS.md .claude/CLAUDE.md
ln -s AGENTS.md CLAUDE.md
ln -s ../AGENTS.md .github/copilot-instructions.md
ln -s ../AGENTS.md .codex/AGENTS.md
ln -s ../AGENTS.md .claude/CLAUDE.md

Platform-Specific Notes

PlatformFileNotes
GitHub Copilot.github/copilot-instructions.mdAlso reads AGENTS.md at root
OpenAI Codex.codex/AGENTS.mdHierarchical discovery
WindsurfAGENTS.mdCase-insensitive
Claude CodeCLAUDE.md or .claude/CLAUDE.mdSupports @import syntax
Manusskills/*/SKILL.mdSkills directory

Troubleshooting

Symlink Not Working on Windows

Windows requires admin privileges for symlinks. Use junction points or copy files instead:

bash
# sync-instructions.bat
copy AGENTS.md CLAUDE.md
copy AGENTS.md .github\copilot-instructions.md

Agent Not Reading Instructions

  1. Check file exists and is readable
  2. Verify symlink resolves correctly
  3. Check for syntax errors in YAML frontmatter
  4. Ensure file is committed to git (not gitignored)

Different Agents Behave Differently

  1. Run validation steps above
  2. Check if any file is a copy instead of symlink
  3. Verify all symlinks point to same canonical source
  4. Check for platform-specific overrides in subdirectories