用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tools-only/X-Skills --skill sync-agent-context命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Index of Build Systems Skills
Coordination patterns for distributed dataflow systems including barriers, epochs, and distributed snapshots
Windowing, sessionization, time-series aggregation, and late data handling for streaming systems
基于 SOC 职业分类
正在显示 SKILL.md
| name | sync-agent-context |
| description | Merge all AGENTS.md files into CLAUDE.md for unified agent context |
Command: /sync-agent-context
Purpose: Permanently merge all AGENTS.md files in the project into CLAUDE.md under a dedicated section, ensuring agent-specific instructions are always loaded alongside project context.
Search the current project for all files named AGENTS.md:
find . -name "AGENTS.md" -type f
Expected output:
./AGENTS.md
./subproject/AGENTS.md
For each found file, read its full content using the Read tool:
File: ./AGENTS.md
Content: [full content of AGENTS.md]
File: ./subproject/AGENTS.md
Content: [full content of subproject AGENTS.md]
if [ -f "./CLAUDE.md" ]; then
echo "CLAUDE.md found - will update"
else
echo "CLAUDE.md not found - will create new file"
fi
cp CLAUDE.md CLAUDE.md.backup.$(date +%Y%m%d-%H%M%S)
Example: CLAUDE.md.backup.20251023-143022
Add or update the following section in CLAUDE.md:
---
## Agent-Specific Instructions
<!-- AUTO-SYNCED from AGENTS.md files - Last updated: 2025-10-23 14:30:22 -->
<!-- Source files: ./AGENTS.md, ./subproject/AGENTS.md -->
### Root Directory Agent Rules (./AGENTS.md)
[Content from ./AGENTS.md]
### Subproject Agent Rules (./subproject/AGENTS.md)
[Content from ./subproject/AGENTS.md]
---
✅ Agent Context Sync Complete!
📋 Summary:
- Found 2 AGENTS.md files
- Created backup: CLAUDE.md.backup.20251023-143022
- Updated CLAUDE.md with agent-specific instructions
📂 Synced files:
1. ./AGENTS.md → CLAUDE.md (Section: Root Directory Agent Rules)
2. ./subproject/AGENTS.md → CLAUDE.md (Section: Subproject Agent Rules)
⚠️ Note: Original AGENTS.md files remain unchanged (source of truth)
💡 Next time you start Claude Code, both CLAUDE.md and AGENTS.md will be loaded automatically.
Use /sync-agent-context when:
Don't use this command if:
Replace the existing section with updated content from all AGENTS.md files.
## Agent-Specific Instructions
<!-- OLD CONTENT - WILL BE REPLACED -->
↓↓↓ BECOMES ↓↓↓
## Agent-Specific Instructions
<!-- NEW CONTENT FROM AGENTS.MD FILES -->
Append new section to the end of CLAUDE.md.
[Existing CLAUDE.md content]
---
## Agent-Specific Instructions
<!-- NEW SECTION ADDED -->
[Content from AGENTS.md files]
If both CLAUDE.md and AGENTS.md have conflicting rules:
The sync command will:
Example merged output:
# CLAUDE.md
## General Project Instructions
- Use TypeScript for all code (from original CLAUDE.md)
---
## Agent-Specific Instructions
<!-- In case of conflicts, these rules take precedence for agent workflows -->
- Use JavaScript for agent-generated code (from AGENTS.md)
Result: Agent workflows use JavaScript; manual work uses TypeScript
Not currently implemented, but could be added:
// plugin.json future enhancement
{
"hooks": {
"onFileChange": {
"pattern": "**/AGENTS.md",
"action": "run /sync-agent-context automatically"
}
}
}
This would auto-sync whenever AGENTS.md is modified.
Before:
project/
├── CLAUDE.md (200 lines)
└── AGENTS.md (50 lines)
Run: /sync-agent-context
After:
project/
├── CLAUDE.md (250 lines - merged)
├── CLAUDE.md.backup.20251023-143022 (original)
└── AGENTS.md (50 lines - unchanged)
Before:
project/
├── CLAUDE.md
├── AGENTS.md
└── packages/
└── plugin-a/
└── AGENTS.md
Run: /sync-agent-context
After:
CLAUDE.md now contains:
## Agent-Specific Instructions
### Root Directory Agent Rules
[Content from ./AGENTS.md]
### Package Plugin-A Agent Rules
[Content from ./packages/plugin-a/AGENTS.md]
CLAUDE.md.backup.* files if neededProblem: Sync command not found
Solution: Ensure plugin is installed:
/plugin install agent-context-manager@claude-code-plugins-plus
Problem: CLAUDE.md section duplicated
Solution: Sync command should replace, not duplicate. Check for:
Problem: Backup files accumulating
Solution: Clean old backups periodically:
find . -name "CLAUDE.md.backup.*" -mtime +30 -delete
agent-context-loader - Automatically loads AGENTS.mdcheck-agents-md.sh - Detects AGENTS.md on directory changeStatus: Manual Command
Requires User Action: Yes (type /sync-agent-context)
Permanent: Yes (persists in CLAUDE.md)