feat: add agent instruction files to all templates#22
Open
Conversation
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.
Member
Author
|
Symlinks are not supported by cargo-generate: Otherwise we could just symlink to |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add agent instruction files (
AGENTS.mdandCLAUDE.md) to every project template so coding agents automatically discover ICP documentation and skills when developers scaffold a new project withicp new.How it works
A single shared Rhai script (
_shared/write-agent-files.rhai) generates both files via cargo-generate'sposthook. Each template'scargo-generate.tomlreferences this script, keeping a single source of truth for the content.Generated
AGENTS.mdinstructs any coding agent to:llms.txtGenerated
CLAUDE.mdpoints toAGENTS.mdfor Claude Code auto-discovery.Agent compatibility
CLAUDE.md→AGENTS.mdAGENTS.mdAGENTS.mdAGENTS.mdPrevious approach (commit 1)
The first commit added duplicated
AGENTS.mdandCLAUDE.mdfiles 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.