diff --git a/_shared/write-agent-files.rhai b/_shared/write-agent-files.rhai new file mode 100644 index 0000000..69c947f --- /dev/null +++ b/_shared/write-agent-files.rhai @@ -0,0 +1,22 @@ +let agents_md = `# AI Agent Instructions + +This is an Internet Computer (ICP) project built with icp-cli. + +Documentation: https://cli.internetcomputer.org/llms.txt + +## Skills + +Tested implementation patterns for ICP development are available as agent skills. +Fetch the skills index and remember each skill's name and description: +https://skills.internetcomputer.org/.well-known/skills/index.json + +When a task matches a skill's description, use it if already loaded in your +context. Otherwise, fetch its content on-demand from the registry: +https://skills.internetcomputer.org/.well-known/skills/{name}/{file} + +Skills contain correct dependency versions, configuration formats, and common pitfalls that prevent build failures. +Always prefer skill guidance over general documentation when both cover the same topic. +`; + +file::write("AGENTS.md", agents_md); +file::write("CLAUDE.md", "Read and follow the instructions in [AGENTS.md](AGENTS.md).\n"); diff --git a/bitcoin-starter/cargo-generate.toml b/bitcoin-starter/cargo-generate.toml index 6a21161..6cb9665 100644 --- a/bitcoin-starter/cargo-generate.toml +++ b/bitcoin-starter/cargo-generate.toml @@ -13,3 +13,4 @@ ignore = [ "rust-backend" ] [hooks] pre = ["rename-backend-dir.rhai"] +post = ["../_shared/write-agent-files.rhai"] diff --git a/hello-world/cargo-generate.toml b/hello-world/cargo-generate.toml index a871937..00d1294 100644 --- a/hello-world/cargo-generate.toml +++ b/hello-world/cargo-generate.toml @@ -12,3 +12,4 @@ ignore = [ "rust-backend" ] [hooks] pre = ["rename-backend-dir.rhai"] +post = ["../_shared/write-agent-files.rhai"] diff --git a/motoko/cargo-generate.toml b/motoko/cargo-generate.toml index 3e2f06f..49397f7 100644 --- a/motoko/cargo-generate.toml +++ b/motoko/cargo-generate.toml @@ -1,3 +1,6 @@ [placeholders] network_type = { type = "string", prompt = "Use the default network or a dockerized one?", choices = ["Default", "Docker"], default = "Default" } + +[hooks] +post = ["../_shared/write-agent-files.rhai"] diff --git a/proxy/cargo-generate.toml b/proxy/cargo-generate.toml new file mode 100644 index 0000000..4312d61 --- /dev/null +++ b/proxy/cargo-generate.toml @@ -0,0 +1,2 @@ +[hooks] +post = ["../_shared/write-agent-files.rhai"] diff --git a/rust/cargo-generate.toml b/rust/cargo-generate.toml index 3e2f06f..49397f7 100644 --- a/rust/cargo-generate.toml +++ b/rust/cargo-generate.toml @@ -1,3 +1,6 @@ [placeholders] network_type = { type = "string", prompt = "Use the default network or a dockerized one?", choices = ["Default", "Docker"], default = "Default" } + +[hooks] +post = ["../_shared/write-agent-files.rhai"] diff --git a/static-website/cargo-generate.toml b/static-website/cargo-generate.toml index bbc7d9a..cbdf350 100644 --- a/static-website/cargo-generate.toml +++ b/static-website/cargo-generate.toml @@ -1,2 +1,5 @@ [template] exclude = ["public/logo.png"] + +[hooks] +post = ["../_shared/write-agent-files.rhai"]