What Are Sync Scripts and How They Regenerate AI Agent Configuration Files

Sync scripts are automation utilities that read a single canonical source of truth—such as AGENTS.md or a Claude skill file—and regenerate platform-specific configuration files for multiple AI coding agents, ensuring consistent project conventions across GitHub Copilot, Cline, Cursor, and others.

The JCodesMore/ai-website-cloner-template repository maintains complex configurations for over nine different AI agents. Rather than manually updating separate files for each platform, the repository uses two specialized sync scripts to propagate changes automatically from centralized definition files to every agent-specific configuration directory.

What Are Sync Scripts?

Sync scripts are executable files located in the scripts/ directory that synchronize AI agent configurations with a single source of truth. The repository contains two distinct scripts, each targeting different types of AI agent configurations:

  • scripts/sync-agent-rules.sh – A Bash script that synchronizes general agent behavior rules from AGENTS.md to platforms that cannot read the canonical file directly.
  • scripts/sync-skills.mjs – A Node.js script that converts a Claude-specific skill definition into platform-specific command files for nine different coding agents.

These scripts eliminate manual copy-pasting and prevent configuration drift by ensuring every AI agent operates with identical, up-to-date project conventions.

How Sync Scripts Regenerate Configuration Files

Both scripts follow a standardized regeneration pipeline: locate the repository root, read the canonical source file, optionally process content, prepend an auto-generated header, and write the final content to multiple destination paths.

The Agent Rules Sync (sync-agent-rules.sh)

Located at scripts/sync-agent-rules.sh, this script treats AGENTS.md as the source of truth for project conventions. The script performs the following operations:

  1. Repository Root Detection – Computes REPO_ROOT as the directory containing the script, then builds an absolute path to AGENTS.md.

  2. Content Resolution – Reads AGENTS.md into a variable named RESOLVED_CONTENT, resolving any @file import directives (such as @docs/research/INSPECTION_GUIDE.md) by inlining the referenced file's contents directly into the output.

  3. Header Injection – Prepends a comment marking the file as auto-generated and warning maintainers not to edit the target files directly.

  4. Multi-Platform Distribution – Writes the processed content to four specific locations:

The Skills Sync (sync-skills.mjs)

Located at scripts/sync-skills.mjs, this script converts the SKILL.md file from .claude/skills/clone-website/SKILL.md into platform-specific command definitions. The Node.js script executes the following workflow:

  1. Source Parsing – Reads the skill file and parses its front-matter metadata, extracting the command body into a raw string variable.

  2. Token Substitution – Performs platform-specific replacements for the $ARGUMENTS placeholder, converting it to appropriate syntax for each target (e.g., the target URL for natural language platforms, {{args}} for templated platforms).

  3. Directory Generation – Auto-creates nested directories under nine distinct platform folders: .codex, .github, .cursor, .windsurf, .gemini, .opencode, .augment, .continue, and .amazonq.

  4. File Writing – Generates a skill file or command definition in each platform's required format, such as .cursor/commands/clone-website.md or .codex/skills/clone-website/SKILL.md.

Running the Sync Scripts

Execute either script from the repository root after modifying the corresponding source file. Both scripts provide console output confirming each regenerated file.

Regenerating agent rules:

bash scripts/sync-agent-rules.sh

Expected output:


Syncing agent rules from AGENTS.md...
  ✓ .github/copilot-instructions.md
  ✓ .clinerules
  ✓ .continue/rules/project.md
  ✓ .amazonq/rules/project.md

Done. Generated files are committed to the repo but sourced from AGENTS.md.
Edit AGENTS.md, then re-run this script to update all agent configs.

Regenerating platform skills:

node scripts/sync-skills.mjs

Expected output:


Syncing clone-website skill to all platforms...
  ✓ .codex/skills/clone-website/SKILL.md
  ✓ .github/skills/clone-website/SKILL.md
  ✓ .cursor/commands/clone-website.md
  ✓ .windsurf/skills/clone-website.md
  …
Done! 9 platform command files generated from source skill.

NPM Integration:

Add these commands to your package.json for easier execution:

{
  "scripts": {
    "sync:agents": "bash scripts/sync-agent-rules.sh",
    "sync:skills": "node scripts/sync-skills.mjs"
  }
}

Generated File Headers and Version Control

Every regenerated file contains a comment header identifying it as auto-generated content. For example, .github/copilot-instructions.md begins with:

<!-- AUTO-GENERATED from AGENTS.md — do not edit directly.
     Run `bash scripts/sync-agent-rules.sh` to regenerate. -->

This header serves two purposes: it prevents developers from manually editing derived files, and it provides the exact command required to regenerate the configuration. Because the scripts write files directly into the working tree, running git add and git commit after script execution captures the synchronized state, making the configurations available to CI/CD pipelines and other developers.

Summary

  • Sync scripts (sync-agent-rules.sh and sync-skills.mjs) centralize AI agent configuration management in the JCodesMore/ai-website-cloner-template repository.
  • AGENTS.md serves as the canonical source for general agent rules, while .claude/skills/clone-website/SKILL.md serves as the source for platform-specific command skills.
  • The scripts resolve file imports, perform token substitutions, prepend auto-generated headers, and write to multiple target directories.
  • Execution requires only a single command (bash or node), after which standard git workflows commit the regenerated files.
  • This architecture supports nine distinct AI agent platforms including Copilot, Cursor, Windsurf, Gemini, Augment, and Amazon Q.

Frequently Asked Questions

What is the difference between sync-agent-rules.sh and sync-skills.mjs?

sync-agent-rules.sh handles general project conventions and behavioral rules stored in AGENTS.md, distributing them to agents that cannot parse the canonical file directly. sync-skills.mjs specifically converts the Claude skill definition into executable command formats for nine different agents, handling platform-specific syntax variations and argument placeholders.

How do I regenerate configuration files after updating AGENTS.md?

Run bash scripts/sync-agent-rules.sh from the repository root after saving changes to AGENTS.md. The script automatically resolves any @file references, updates all four target configuration files, and prints confirmation checks for each generated document. Commit the changes with git add . followed by git commit to preserve the synchronized state.

Why do generated files contain auto-generated headers?

The headers prevent accidental manual edits to derived configuration files and document the regeneration command required to update them. This ensures that developers always edit the canonical source (AGENTS.md or SKILL.md) rather than platform-specific copies, maintaining a single source of truth across the entire repository.

Which AI agents support these synchronized configurations?

The template supports GitHub Copilot Chat, Cline, Continue, Amazon Q, Cursor, Windsurf, Gemini, Codex, OpenCode, and Augment. The sync-agent-rules.sh script covers Copilot, Cline, Continue, and Amazon Q, while sync-skills.mjs extends coverage to include Cursor, Windsurf, Gemini, Codex, OpenCode, and Augment through platform-specific skill definitions.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →