# How the sync-skills.mjs Script Propagates the clone-website Skill Across AI Coding Platforms

> Learn how the sync-skills.mjs script automatically propagates the clone-website skill to Codex CLI, Copilot, Cursor, Gemini CLI, and more, generating platform-specific command files for seamless AI coding.

- Repository: [JCodesMore/ai-website-cloner-template](https://github.com/JCodesMore/ai-website-cloner-template)
- Tags: how-to-guide
- Published: 2026-07-07

---

**The `sync-skills.mjs` script reads the canonical skill definition from [`.claude/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.claude/skills/clone-website/SKILL.md) and automatically generates nine platform-specific command files for the *clone-website* skill across Codex CLI, GitHub Copilot, Cursor, Windsurf, Gemini CLI, OpenCode, Augment Code, Continue, and Amazon Q.**

The JCodesMore/ai-website-cloner-template repository centralizes AI skill management to eliminate duplication across tooling ecosystems. When you modify the *clone-website* capability, the `sync-skills.mjs` script propagates those changes to every supported platform using the correct syntax and file structure for each environment. This Node.js utility ensures that a single edit to the source definition updates all nine target platforms instantly.

## Parsing the Canonical Skill Definition

The script loads the master skill file from [`.claude/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.claude/skills/clone-website/SKILL.md) using standard file system methods. At lines 27-33 of `scripts/sync-skills.mjs`, it splits the content into front-matter metadata and body text using the regular expression `/^---\n([\s\S]*?)\n---\n([\s\S]*)$/`. This pattern captures the YAML front-matter between triple-dash delimiters and treats the remaining content as the skill body, enabling structured data extraction while preserving markdown formatting.

## Core Utilities and Generation Helpers

### The write() Helper Function

Lines 38-44 define a `write()` utility that handles directory creation and file output. The function uses `fs.mkdir(..., { recursive: true })` to ensure parent directories exist before writing, then logs a success message with a green checkmark emoji for each file generated.

### Header Injection and Argument Handling

The script prepends an auto-generated `HEADER` constant to every output file, warning users that the files are machine-generated and should not be edited directly. For platforms lacking dynamic argument substitution, the `noArgs()` function (lines 45-50) replaces the `$ARGUMENTS` placeholder with descriptive text explaining what values the user should provide.

## Cross-Platform Generation Strategy

The script processes the parsed skill definition and generates nine distinct output files, each formatted for the target platform's specific requirements:

**Codex CLI** (lines 56-58)
- Output path: [`.codex/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.codex/skills/clone-website/SKILL.md)
- Format: Raw markdown preserving the `$ARGUMENTS` placeholder

**GitHub Copilot** (lines 59-60)
- Output path: [`.github/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.github/skills/clone-website/SKILL.md)
- Format: Raw markdown identical to the source

**Cursor** (lines 62-64)
- Output path: [`.cursor/commands/clone-website.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.cursor/commands/clone-website.md)
- Format: Markdown with auto-generated header and `$ARGUMENTS` replaced by descriptive text via the `noArgs()` function

**Windsurf** (lines 65-66)
- Output path: [`.windsurf/workflows/clone-website.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.windsurf/workflows/clone-website.md)
- Format: Same as Cursor—markdown with header and processed arguments

**Gemini CLI** (lines 68-77)
- Output path: [`.gemini/commands/clone-website.toml`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.gemini/commands/clone-website.toml)
- Format: TOML configuration using `{{args}}` placeholder syntax

**OpenCode** (lines 79-84)
- Output path: [`.opencode/commands/clone-website.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.opencode/commands/clone-website.md)
- Format: Markdown with YAML front-matter keeping native `$ARGUMENTS` support

**Augment Code** (lines 85-89)
- Output path: [`.augment/commands/clone-website.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.augment/commands/clone-website.md)
- Format: Markdown with YAML front-matter including explicit `argument-hint` metadata

**Continue** (lines 91-95)
- Output path: [`.continue/commands/clone-website.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.continue/commands/clone-website.md)
- Format: Markdown with YAML front-matter and `invokable: true` flag

**Amazon Q** (lines 97-100)
- Output path: [`.amazonq/cli-agents/clone-website.json`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.amazonq/cli-agents/clone-website.json)
- Format: JSON definition with `$ARGUMENTS` stripped from the prompt content

## Executing the Sync Script

To propagate changes after editing the source skill, run the Node.js script from the repository root:

```bash
node scripts/sync-skills.mjs

```

The script logs its progress to the console, showing each platform file as it gets written. Upon completion, it outputs a confirmation message indicating that nine platform command files have been generated from the source skill.

Example output:

```

  ✓ .codex/skills/clone-website/SKILL.md
  ✓ .github/skills/clone-website/SKILL.md
  ✓ .cursor/commands/clone-website.md
  ...
Done! 9 platform command files generated from source skill.

```

You can verify the generated content for any specific platform, such as inspecting the TOML structure for Gemini CLI:

```bash
cat .gemini/commands/clone-website.toml

```

## Summary

- The `sync-skills.mjs` script maintains a single source of truth in [`.claude/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.claude/skills/clone-website/SKILL.md)
- It parses front-matter and body content using a specific regex pattern at lines 27-33
- Nine platform-specific files are generated with formats ranging from Markdown to TOML to JSON
- The `write()` helper ensures directories exist before writing files
- Argument handling adapts to each platform's capability for dynamic substitution

## Frequently Asked Questions

### What is the source of truth for the clone-website skill?

The canonical definition lives in [`.claude/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.claude/skills/clone-website/SKILL.md) at the repository root. This file contains the YAML front-matter and markdown body that serve as the master template for all platform-specific generations according to the JCodesMore/ai-website-cloner-template source code.

### How does the script handle arguments for platforms without substitution support?

The `noArgs()` function defined at lines 45-50 of `scripts/sync-skills.mjs` replaces the `$ARGUMENTS` placeholder with descriptive text. This ensures platforms like Cursor and Windsurf display clear instructions rather than raw placeholder syntax when the skill is invoked.

### Why does the Gemini CLI output use TOML format while others use Markdown?

Gemini CLI expects command definitions in TOML format with specific fields for the command structure. The script generates [`.gemini/commands/clone-website.toml`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.gemini/commands/clone-website.toml) with `{{args}}` placeholders to match this requirement, while platforms like Codex and GitHub Copilot consume native Markdown files.

### How many platforms does the script currently support?

The script generates files for nine distinct AI coding platforms: Codex CLI, GitHub Copilot, Cursor, Windsurf, Gemini CLI, OpenCode, Augment Code, Continue, and Amazon Q.