Skip to content

Commit 9eeb17d

Browse files
committed
fix: strengthen agent rules to prevent broken links and wrong URLs
Adds three new verification rules to the content authoring workflow: - Internal link verification: agents must confirm target files exist - External URL verification: agents must not guess/generalize crate URLs - Self-consistency check: frontmatter and body must not contradict Also expands linking rules table with ic-stable-structures and candid crate URLs, and adds a "never" rule against linking to non-existent pages. Motivated by review of PRs #2-#5 where agents linked to plausible but non-existent paths (reference/certified-variables.md, guides/backends/ stable-memory.md) and used wrong crate URLs (docs.rs/ic-cdk for ic-stable-structures).
1 parent ac5f6d1 commit 9eeb17d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎AGENTS.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ Add enough context in the notes so the next agent (or human) understands the blo
209209
- Modify the rationale or context of existing decisions in `.docs-plan/decisions.md` — you may remove entries that are fully reflected in the current codebase (renames, file moves, cleanup) but never alter the reasoning behind active decisions
210210
- Add `Co-Authored-By` or any AI attribution to commits or PR descriptions
211211
- Link to `internetcomputer.org/docs/` or `docs.internetcomputer.org` — the old docs site is being replaced by this project and those URLs will break. Link to pages in this site (relative paths, even stubs), Learn Hub, or explain inline. If a needed topic has no page, create a page proposal issue.
212+
- Link to internal pages that don't exist — every `[text](path.md)` must resolve to an actual file. Agents have repeatedly linked to plausible-sounding paths (e.g., `reference/certified-variables.md`, `guides/backends/stable-memory.md`) that don't exist. Always `ls` the target before linking. If the page doesn't exist, find the correct existing page or file a page proposal issue.
212213

213214
## Key directories
214215

@@ -309,6 +310,9 @@ When drafting a new docs page:
309310
- Follow the content brief in the stub
310311
- Use icp-cli commands (never dfx)
311312
- **Verify all CLI commands and flags** against `.sources/icp-cli/docs/reference/cli.md` — never guess command syntax
313+
- **Verify all internal links** — every `[text](path.md)` must point to a file that exists. Run `ls <target-path>` before submitting. If the target page doesn't exist, either link to an existing page that covers the topic, or file a page proposal issue and note the missing link in your PR description. Never link to a path that doesn't exist.
314+
- **Verify all external URLs** — use the linking rules table below for known resources. For any URL not in the table (crate docs, npm packages, GitHub repos), verify it is correct. Do not guess or generalize from similar URLs (e.g., `docs.rs/ic-cdk` is NOT the same as `docs.rs/ic-stable-structures`).
315+
- **Self-consistency check** — before submitting, re-read your frontmatter description and body opening paragraph. They must not contradict each other (e.g., different time estimates, different scope claims).
312316
- Use plain markdown (never JSX/MDX)
313317
- Ensure complete frontmatter (see CONTRIBUTING.md)
314318
- Code examples: <30 lines inline, >30 lines link to `dfinity/examples`
@@ -348,11 +352,15 @@ When drafting a new docs page:
348352
|-------------|---------|
349353
| CLI commands | https://dfinity.github.io/icp-cli/ |
350354
| Motoko standard library | https://mops.one/core/docs (core supersedes base) |
351-
| Rust CDK API | https://docs.rs/ic-cdk/latest/ic_cdk/ |
355+
| Rust CDK API (`ic-cdk`) | https://docs.rs/ic-cdk/latest/ic_cdk/ |
356+
| Rust stable structures (`ic-stable-structures`) | https://docs.rs/ic-stable-structures/latest/ic_stable_structures/ |
357+
| Rust Candid (`candid`) | https://docs.rs/candid/latest/candid/ |
352358
| JS SDK | https://js.icp.build |
353359
| Protocol internals | https://learn.internetcomputer.org |
354360
| Agent skill files | https://skills.internetcomputer.org |
355361

362+
> **Important:** Each Rust crate has its own `docs.rs` URL. Do NOT substitute one crate URL for another — `docs.rs/ic-cdk` is NOT the same as `docs.rs/ic-stable-structures`. If you need to link a crate not in this table, construct the URL as `https://docs.rs/<crate-name>/latest/<crate_name>/` (note: hyphens in crate name become underscores in the path).
363+
356364
## External docs (don't duplicate these)
357365

358366
| Resource | URL |
@@ -362,7 +370,8 @@ When drafting a new docs page:
362370
| icskills | https://skills.internetcomputer.org |
363371
| Learn Hub | https://learn.internetcomputer.org |
364372
| Motoko core library | https://mops.one/core/docs (supersedes base; migration guide is synced from Motoko repo) |
365-
| Rust CDK API | https://docs.rs/ic-cdk/latest/ic_cdk/ |
373+
| Rust CDK API (`ic-cdk`) | https://docs.rs/ic-cdk/latest/ic_cdk/ |
374+
| Rust stable structures (`ic-stable-structures`) | https://docs.rs/ic-stable-structures/latest/ic_stable_structures/ |
366375

367376
## Skills
368377

0 commit comments

Comments
 (0)