Skip to content

Instantly share code, notes, and snippets.

@markomitranic
Created January 31, 2026 15:44
Show Gist options
  • Select an option

  • Save markomitranic/f74932b7468c7726e7daf34f6d87039d to your computer and use it in GitHub Desktop.

Select an option

Save markomitranic/f74932b7468c7726e7daf34f6d87039d to your computer and use it in GitHub Desktop.
Copies the AGENTS.md file to proprietary platforms and formats (e.g. Cursor, Claude Code, GitHub Copilot)
#!/bin/bash
# Copies the AGENTS.md file to proprietary platforms and formats (e.g. Cursor, Claude Code, GitHub Copilot)
#
# Usage: ./scripts/sync-agents-md.sh
#
# Pro tip: add to your `.husky/pre-push`, `.husky/post-merge`, `.husky/post-checkout` hooks.
# > echo "πŸ”– (operation) Sync AGENTS.md for proprietary platforms. (Cursor, Claude, GitHub Copilot...)"
# > ./scripts/sync-agents-md.sh
#
# Pro tip 2: Make the harnesses ignore each-others files:
# > echo "AGENTS.md" >> .cursorignore
# > echo "CLAUDE.md" >> .cursorignore
# > echo ".github/copilot-instructions.md" >> .cursorignore
if [ ! -f ./AGENTS.md ]; then
echo "βœ— AGENTS.md not found" >&2
exit 1
fi
# Copy into CLAUDE.md
cp ./AGENTS.md ./CLAUDE.md
echo "βœ“ Regenerated CLAUDE.md from AGENTS.md"
# Copy into GitHub Copilot
mkdir -p .github
cp ./AGENTS.md .github/copilot-instructions.md
echo "βœ“ Regenerated copilot-instructions.md from AGENTS.md"
# Copy into Cursor
mkdir -p .cursor/rules
{
echo "---"
echo "alwaysApply: true"
echo "---"
echo ""
cat ./AGENTS.md
} > .cursor/rules/project.mdc
echo "βœ“ Regenerated .cursor/rules/project.mdc from AGENTS.md"
echo "[If you see a git diff at any of these files, you should commit them.]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment