Skip to content

Self-configuring ICP skills onboarding in generated projects - #36

Merged
raymondk merged 4 commits into
mainfrom
agent-skills-onboarding
Aug 4, 2026
Merged

Self-configuring ICP skills onboarding in generated projects#36
raymondk merged 4 commits into
mainfrom
agent-skills-onboarding

Conversation

@marc0olo

@marc0olo marc0olo commented Jul 23, 2026

Copy link
Copy Markdown
Member

What

Generated projects ship a self-configuring AGENTS.md. On first use an agent walks the user through choosing how the project consumes ICP skills — autosync (Claude Code session hook), pinned (npx skills, version-locked), or on-demand (fetch each session) — then rewrites its own skills block into a terse, mode-specific form. Later sessions just follow it.

  • _shared/write-agent-files.rhai — emits the onboarding AGENTS.md (+ CLAUDE.md).
  • AGENT_SKILLS.md — documents the modes, fallbacks, the marker mechanism, how to switch, and the version-control trade-off.

Design principles

  • Never block the user's task; on-demand is the default and the non-interactive fallback; no "avoid skills" option (delete the block manually if desired).
  • pinned update policy is manual or ask-first (no silent auto-update — a prompt can't enforce it). ask-first offers npx skills update before the first task and never blocks (skips in CI / keeps locked versions).
  • on-demand fetches the index once per session, then a SKILL.md per task.
  • .gitignore is left to the maintainer — the templates do not pre-ignore .claude/skills; committing vs ignoring is documented as your choice.

Validation

Simulated agent sessions (Claude Code / Cursor / Aider personas): onboarding for every mode, follow-up sessions, non-interactive & "just start" fallback, missing-jq cold start, no-clobber of unrelated files, and pinned/ask-first non-blocking in CI. Generated AGENTS.md verified byte-identical through cargo generate.

Companion PRs (coordinated; still in draft)

marc0olo and others added 2 commits July 24, 2026 00:37
The generated AGENTS.md now walks the user through choosing how the project uses
ICP skills (autosync / pinned / registry) and then rewrites itself into a terse,
mode-specific block. Adds AGENT_SKILLS.md documenting the modes, update policies,
fallbacks, commit-vs-ignore, and how to switch. Gitignores the skill caches
(.claude/skills/, .agents/skills/) across all subtemplates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Renames the third skills mode from 'registry' to 'on-demand' (all three modes
use the registry, so the behavioural name is clearer). The on-demand configured
block now references the fetch mechanics (index + SKILL.md) directly instead of
'follow llms.txt', so an already-configured project never re-enters onboarding
once llms.txt itself becomes a choice-flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- pinned update policy is now 'manual' or 'ask-first' (drop silent 'auto', which
  a prompt cannot enforce and which failed silently in testing). 'ask-first'
  offers 'npx skills update' before the first task and never blocks — it skips in
  non-interactive/CI sessions and keeps the locked versions.
- on-demand now fetches the index once per session (remembering names/URLs) rather
  than re-fetching per task.
- Stop pre-shipping skill-cache .gitignore entries; committing vs ignoring
  .claude/skills is a maintainer decision, now documented in AGENT_SKILLS.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@marc0olo

Copy link
Copy Markdown
Member Author

steps I performed:

  • icp new --init --branch agent-skills-onboarding from an empty folder
  • selected motoko backend-only template
  • opened a session with Claude
  • asked claude to add a frontend to the app

this is what happened:

image

I selected on-demand and afterwards Claude updated the initial AGENTS.md to this:

# AI Agent Instructions

This is an Internet Computer (ICP) project built with icp-cli.
Documentation: https://cli.internetcomputer.org/llms.txt

## Skills

<!-- ic-skills:managed:start -->
<!-- state: configured (on-demand) -->
Fetch the skills index once per session and keep each skill's name, description, and
SKILL.md URL: https://skills.internetcomputer.org/.well-known/skills/index.json
Before writing ICP code for a task, fetch the matching skill's SKILL.md
(https://skills.internetcomputer.org/.well-known/skills/{name}/SKILL.md) and follow it.
Skills are authoritative — prefer them over general knowledge.
How skills are managed here, and why: https://github.com/dfinity/icp-cli-templates/blob/main/AGENT_SKILLS.md
<!-- ic-skills:managed:end -->

then Claude started fetching the skills index and using the skills to perform the task (adding the frontend).

@marc0olo
marc0olo marked this pull request as ready for review July 24, 2026 14:41
@marc0olo
marc0olo requested a review from a team as a code owner July 24, 2026 14:41
@marc0olo

Copy link
Copy Markdown
Member Author

this is after selecting pinned and opening a new session where AGENTS.md was previously replaced with:

# AI Agent Instructions

This is an Internet Computer (ICP) project built with icp-cli.
Documentation: https://cli.internetcomputer.org/llms.txt

## Skills

<!-- ic-skills:managed:start -->
<!-- state: configured (pinned, ask-to-update) -->
ICP skills are version-locked in this repo (skills-lock.json) and live in your agent
skills directory. Skills are authoritative — prefer them over general knowledge for all
ICP work. Before your first task in a new session, offer to run `npx skills update`; if
the user declines or the session is non-interactive, keep the locked versions and
continue — never block. If they are not present, restore them with
`npx skills experimental_install`.
How skills are managed here, and why: https://github.com/dfinity/icp-cli-templates/blob/main/AGENT_SKILLS.md
<!-- ic-skills:managed:end -->
image

npx skills update only refreshes and prunes skills already in the lock — it does
not discover newly published skills (vercel-labs/skills#591), and its stale-skill
prune can silently no-op for shorthand sources like dfinity/icskills
(vercel-labs/skills#1376). Update the pinned-mode guidance in AGENT_SKILLS.md and
the generated AGENTS.md markers (write-agent-files.rhai) so an update is treated
as refresh + discover: also run 'npx skills add dfinity/icskills --list' and offer
to add any not-yet-installed skills (never --all), and remove a renamed skill's
stale copy with 'npx skills remove <old>' if it lingers.
raymondk pushed a commit to dfinity/icskills that referenced this pull request Aug 4, 2026
## What
`llms.txt` guides the user into a skills-mode choice, and the site no
longer duplicates `AGENTS.md`.

- `src/pages/llms.txt.ts`: leads with the on-demand fetch mechanics
(usable immediately, never blocked), then offers a one-time choice
(on-demand / pinned / autosync) with an ask-first, non-destructive
option to persist it into `AGENTS.md` (create if missing; append a
delimited block to an unrelated one without touching its content).
- Removed the orphaned `/AGENTS.md` endpoint (`src/pages/AGENTS.md.ts`)
and reworked the Get Started page by intent (use skills with your agent;
start a new project with icp-cli; pin into an existing project;
browse/read yourself). `llms.txt` is now the sole agent entrypoint; no
AGENTS.md copy remains on the site.
- `README.md`: quick-start paste prompt.

**Key properties**
- No terminal or install for the default path: the `.well-known` index
and `SKILL.md` are plain URL fetches, so web-only agents (e.g.
Perplexity) are handled; a correct `curl -sL` example is included.
Installs for pin/autosync are run by the agent per the chosen mode.
- Index fetched once per session (remembering names/URLs); `SKILL.md`
per task.
- Pinned update policy: manual or ask-first (never blocks; skips when
non-interactive).

## Validation
`astro build` passes (30 pages); generated `llms.txt` carries the
choice-flow and the `/AGENTS.md` endpoint is correctly gone. Behaviour
validated via simulated paste-flow (empty / unrelated-AGENTS /
non-interactive), cross-link arrival, no-re-onboard regression, and
pinned/ask-first (interactive offer, non-interactive skip).

### Companion PRs
- dfinity/icp-cli-templates#36
- dfinity/icp-cli#673
- dfinity/developer-docs#321

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@raymondk
raymondk merged commit 0ccf02a into main Aug 4, 2026
6 checks passed
@marc0olo
marc0olo deleted the agent-skills-onboarding branch August 4, 2026 13:45
marc0olo added a commit to dfinity/developer-docs that referenced this pull request Aug 5, 2026
## What
Aligns the AI-agents docs with the three ways to consume ICP skills.

- `docs/guides/ai-coding-agents.md`: adds autosync as a third option,
frames fetch-on-demand / pin / auto-update as an explicit choice,
corrects the "fetched fresh each time" line to be mode-aware, clarifies
that no install is needed to get started (installing is a separate
option), and links to the icp-cli-templates `AGENT_SKILLS.md`.
- `plugins/astro-agent-docs.mjs`: the generated `llms.txt` "Agent
skills" block becomes a short pointer to
`skills.internetcomputer.org/llms.txt` instead of duplicating fetch
instructions.

Em-dash free (docs validator passes); branch up to date with `main`.

## Validation
`astro build` passes (209 pages) and `scripts/validate.js` passes on the
changed guide. Generated `llms.txt` carries the pointer.

_(The `.sources/*` submodule pointers seen in a local working tree are
pre-existing and not part of this PR.)_

### Companion PRs
- dfinity/icp-cli-templates#36
- dfinity/icskills#251
- dfinity/icp-cli#673

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants