Skip to content

feat: add agent instruction files to all templates#22

Open
marc0olo wants to merge 3 commits intomainfrom
feat/agent-instructions
Open

feat: add agent instruction files to all templates#22
marc0olo wants to merge 3 commits intomainfrom
feat/agent-instructions

Conversation

@marc0olo
Copy link
Member

@marc0olo marc0olo commented Mar 20, 2026

Summary

Add agent instruction files (AGENTS.md and CLAUDE.md) to every project template so coding agents automatically discover ICP documentation and skills when developers scaffold a new project with icp new.

How it works

A single shared Rhai script (_shared/write-agent-files.rhai) generates both files via cargo-generate's post hook. Each template's cargo-generate.toml references this script, keeping a single source of truth for the content.

Generated AGENTS.md instructs any coding agent to:

  1. Read the icp-cli documentation via llms.txt
  2. Fetch the IC skills index and remember each skill's name and description
  3. Fetch skill content on-demand when a task matches
  4. Prefer skill guidance over general knowledge

Generated CLAUDE.md points to AGENTS.md for Claude Code auto-discovery.

Agent compatibility

Agent Auto-reads
Claude Code CLAUDE.mdAGENTS.md
GitHub Copilot Can be pointed to AGENTS.md
Cursor Can be pointed to AGENTS.md
Other agents Can be pointed to AGENTS.md

Previous approach (commit 1)

The first commit added duplicated AGENTS.md and CLAUDE.md files to each template directory. This was replaced in the second commit with the shared Rhai script to avoid maintaining identical content across 6+ templates.

Note: cargo-generate does not support symlinks (issue #776), but it does support referencing Rhai scripts from parent directories via relative paths.

Add AGENTS.md with ICP documentation and skills discovery instructions
to every project template. Coding agents that read this file will
automatically find the llms.txt docs and fetch relevant IC development
skills on-demand.

Add CLAUDE.md that points to AGENTS.md for Claude Code compatibility.
@marc0olo marc0olo requested a review from a team as a code owner March 20, 2026 08:29
@marc0olo
Copy link
Member Author

Symlinks are not supported by cargo-generate:

Otherwise we could just symlink to AGENTS.md.

Replace the duplicated AGENTS.md and CLAUDE.md in each template with a
single _shared/write-agent-files.rhai script that generates both files
via cargo-generate's post hook. This keeps a single source of truth
for the agent instructions content.
Instruct agents to check if a matching skill is already loaded in their
context before fetching from the remote registry. Avoids redundant web
requests for agents that already have IC skills available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant