doc-sync-tool

Original🇨🇳 Chinese
Translated
7 scripts

Automatically sync Agents.md, claude.md and gemini.md files in the project to maintain content consistency. Supports automatic monitoring and manual triggering.

21installs
Added on

NPX Install

npx skill4agent add littleben/awesomeagentskills doc-sync-tool

SKILL.md Content (Chinese)

View Translation Comparison →

Doc Sync Tool

Feature Description

This tool is used to automatically sync AI Agent configuration documents in the project, ensuring that the content of the three files
Agents.md
,
claude.md
and
gemini.md
remains consistent.

Core Features

  1. Auto Discovery: Recursively scan all folders in the current directory to find these three documents
  2. Intelligent Sync: When any one of the documents is found, automatically create/update the other two
  3. File Monitoring: Real-time monitoring of file changes, automatically sync the latest content
  4. Manual Trigger: Supports manual execution of sync via command line

Usage Scenarios

  • Share the same project configuration among multiple AI Agents
  • Automatically keep work instructions consistent across different AIs
  • Avoid the hassle of manually maintaining multiple identical documents

Usage Methods

Install Dependencies

bash
cd /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool
pnpm install

Manual Sync (One-time Execution)

bash
# Execute in the project root directory
node /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool/sync.js

# Or use npm script
pnpm run sync

Auto Monitoring (Continuous Run)

bash
# Start the file monitoring service
node /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool/watch.js

# Or use npm script
pnpm run watch

Run in Background (Recommended)

bash
# Run in background using PM2
pm2 start /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool/watch.js --name doc-sync

# Check status
pm2 status

# Stop service
pm2 stop doc-sync

Working Principle

  1. Scanning Phase: Recursively traverse the specified directory to find
    Agents.md
    ,
    claude.md
    ,
    gemini.md
    files
  2. Grouping Phase: Group these three files in the same folder into one group
  3. Sync Phase:
    • If a group has only one file, copy its content to create the other two
    • If a group has multiple files, select the most recently modified one as the source and sync to other files
  4. Monitoring Phase (watch mode): Continuously monitor file changes and trigger sync

Configuration Options

You can modify the following configurations in
sync.js
:
javascript
const CONFIG = {
  targetFiles: ['Agents.md', 'claude.md', 'gemini.md'],  // Target file list
  scanPath: process.cwd(),                                // Scan path (current directory by default)
  excludeDirs: ['node_modules', '.git', '.next', 'dist'] // Excluded directories
};

Notes

  • The tool will automatically skip directories such as
    node_modules
    ,
    .git
    ,
    .next
    ,
    dist
  • The original format and content of the files will be preserved during sync
  • It is recommended to use in a Git repository for easy tracking of file changes
  • The monitoring mode runs continuously, it is recommended to use PM2 to manage the process

Troubleshooting

Permission Issues

bash
chmod +x sync.js watch.js

Node.js Version Requirement

Node.js 14+ is required

Dependency Installation Failure

bash
rm -rf node_modules package-lock.json
pnpm install