What Do sync-agent-rules.sh and sync-skills.mjs Accomplish? AI Agent Configuration Sync Explained

Both scripts are generators that synchronize platform-specific AI assistant configuration files with canonical source-of-truth documents, ensuring single-source management for agent rules and skills across multiple IDEs and tools.

In the JCodesMore/ai-website-cloner-template repository, maintaining consistent AI agent behavior across multiple development tools requires careful orchestration of configuration files. The sync-agent-rules.sh and sync-skills.mjs scripts solve this by automatically generating platform-specific rule sets and skill definitions from centralized master documents. This approach eliminates configuration drift and ensures that updates to agent instructions propagate instantly to every supported AI coding assistant.

Overview of the Sync Scripts

Both scripts serve as generators that keep auxiliary configuration files in sync with a single source of truth. They target different aspects of AI assistant configuration: one handles general agent rules, while the other manages reusable skills.

Script Source of Truth Generated Output Target Locations
scripts/sync-agent-rules.sh AGENTS.md Plain-text configuration files for Copilot Chat, Cline, Continue, and Amazon Q .github/copilot-instructions.md, .clinerules, .continue/rules/project.md, .amazonq/rules/project.md
scripts/sync-skills.mjs .claude/skills/clone-website/SKILL.md Platform-specific command/skill files for nine AI coding tools .codex/skills/clone-website/SKILL.md, .github/skills/clone-website/SKILL.md, .cursor/commands/clone-website.md, .windsurf/workflows/clone-website.md, .gemini/commands/clone-website.toml, .opencode/commands/clone-website.md, .augment/commands/clone-website.md, .continue/commands/clone-website.md, .amazonq/cli-agents/clone-website.json

How sync-agent-rules.sh Generates Agent Rules

The sync-agent-rules.sh bash script processes the repository’s master AI-agent specification and distributes it to platforms that cannot read AGENTS.md directly.

The script executes the following workflow according to the source code at [scripts/sync-agent-rules.sh](https://github.com/JCodesMore/ai-website-cloner-template/blob/master/scripts/sync-agent-rules.sh):

  1. Load the master specification by setting SOURCE="$REPO_ROOT/AGENTS.md" [source lines 25‑27].

  2. Resolve @file imports by inlining referenced file contents (e.g., @docs/research/…) [source lines 33‑50].

  3. Create a header comment marking files as auto-generated to prevent manual editing [source lines 55‑56].

  4. Write resolved content to each target using the write_file helper [source lines 58‑66].

  5. Generate specific targets: Copilot instructions (.github/copilot-instructions.md), Cline rules (.clinerules), Continue project rules with extra front-matter (.continue/rules/project.md), and Amazon Q project rules (.amazonq/rules/project.md) [source lines 69‑84].

How sync-skills.mjs Generates Platform Skills

The sync-skills.mjs Node.js script converts the canonical "clone-website" skill definition into nine distinct platform formats, handling syntax variations and argument substitution automatically.

According to the implementation at scripts/sync-skills.mjs, the script performs these operations:

  1. Read the canonical skill from .claude/skills/clone-website/SKILL.md [source lines 14‑22].

  2. Parse front-matter to extract metadata, splitting content into body and description fields [source lines 27‑34].

  3. Write files safely using the write utility, which creates parent directories and prepends auto-generated headers [source lines 38‑44].

  4. Substitute argument placeholders (e.g., converting $ARGUMENTS to {{args}} for Gemini CLI) for platforms with incompatible syntax [source lines 49‑70].

  5. Generate platform-specific outputs: maintaining original Markdown for Codex and GitHub Copilot, while converting to required formats for Cursor (.cursor/commands/clone-website.md), Windsurf (.windsurf/workflows/clone-website.md), Gemini CLI (.gemini/commands/clone-website.toml), OpenCode, Augment, Continue, and Amazon Q [source lines 56‑99].

Running the Sync Scripts

Execute these commands from the repository root after modifying the respective source documents.

Regenerate agent rule files after editing AGENTS.md:

bash scripts/sync-agent-rules.sh

Regenerate the clone-website skill files after editing .claude/skills/clone-website/SKILL.md:

node scripts/sync-skills.mjs

Both commands output a confirmation list of generated files. The shell script produces:


  ✓ .github/copilot-instructions.md
  ✓ .clinerules
  ✓ .continue/rules/project.md
  ✓ .amazonq/rules/project.md

The Node.js script outputs:


  ✓ .codex/skills/clone-website/SKILL.md
  ✓ .github/skills/clone-website/SKILL.md
  ✓ .cursor/commands/clone-website.md
  ...
  ✓ .amazonq/cli-agents/clone-website.json

Summary

  • sync-agent-rules.sh generates plain-text agent configuration files from AGENTS.md for Copilot Chat, Cline, Continue, and Amazon Q.
  • sync-skills.mjs generates platform-specific skill commands from .claude/skills/clone-website/SKILL.md for nine AI coding assistants including Cursor, Windsurf, and Gemini CLI.
  • Both scripts resolve file imports, add auto-generated headers, and handle platform-specific syntax transformations.
  • Running these scripts ensures single-source truth for AI assistant configurations across the entire development toolchain.

Frequently Asked Questions

What is the source of truth for agent rules in this repository?

The source of truth for agent rules is AGENTS.md at the repository root. This master document contains the canonical AI-agent specifications, which sync-agent-rules.sh processes and distributes to platform-specific configuration files that agents like Copilot Chat, Cline, and Amazon Q can consume directly.

Which AI platforms are supported by these synchronization scripts?

The scripts support Copilot Chat, Cline, Continue, and Amazon Q for agent rules, plus Codex, GitHub Copilot, Cursor, Windsurf, Gemini CLI, OpenCode, Augment Code, and Amazon Q (again) for skills. This covers most major AI coding assistants currently available.

Why are there two separate scripts instead of one unified generator?

The repository separates concerns between agent rules (general behavior instructions for AI assistants) and skills (specific reusable commands like "clone-website"). Agent rules require bash-based file resolution and simple text generation, while skills require Node.js for front-matter parsing, argument substitution, and complex format conversions across nine different platforms. Separating them allows each script to use the most appropriate tooling for its specific domain.

How do I run these scripts after updating the master configuration files?

After editing AGENTS.md, run bash scripts/sync-agent-rules.sh from the repository root. After editing .claude/skills/clone-website/SKILL.md, run node scripts/sync-skills.mjs. Both commands will automatically create parent directories as needed and overwrite the generated files with updated content, printing a success message for each file created.

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 →