Skip to content

Commit 16cea2e

Browse files
committed
feat(skills): add codecontext setup skill
## Summary Add a repo-local skill for setting up or repairing codecontext adoption in other projects. ## Changes - add .agents/skills/codecontext-setup/SKILL.md - document install surface, AGENTS.md guidance, CLI workflow, and ref policy ## Why The repo needed a concrete setup skill for codecontext adoption rather than a vague product explainer, and the skill should live in this project instead of in the machine-level skills directory. ## Testing Validated by reviewing the repo-local skill path and ensuring only the new project-scoped skill file is present in the worktree.
1 parent 6ea301f commit 16cea2e

1 file changed

Lines changed: 198 additions & 0 deletions

File tree

  • .agents/skills/codecontext-setup
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
---
2+
name: codecontext-setup
3+
description: Set up or repair codecontext adoption in a project. Use this whenever the user wants to add @context annotations to a repo, install the codecontext toolchain, update AGENTS.md guidance, improve agent workflows around decision capture, or audit whether an existing codecontext setup is coherent. Prefer this skill over vague "document the tool" work: it is specifically for making a repo actually usable with codecontext.
4+
---
5+
6+
# Codecontext Setup
7+
8+
Set up `codecontext` so agents can use it without guessing.
9+
10+
The point of this skill is not just package installation. The real job is to
11+
make the repo's agent contract coherent:
12+
13+
- the toolchain is installed where it belongs
14+
- `AGENTS.md` tells agents when and how to use it
15+
- inline `@context` is treated as the required structured layer
16+
- supporting refs stay unconstrained and user-owned
17+
18+
Do not invent required sidecar document schemas. Do not require `.ctx.md`.
19+
Refs can point to Markdown, HTML, text, diagrams, exported docs, or any other
20+
resolvable file the repo uses.
21+
22+
## When to use
23+
24+
Use this skill when the user asks to:
25+
26+
- install or adopt `codecontext`
27+
- update a repo's `AGENTS.md` or agent guidance around `@context`
28+
- audit a project's current `codecontext` setup
29+
- reconcile a mismatch between codecontext tooling and repo instructions
30+
- improve how agents discover decisions, risks, assumptions, and history
31+
32+
## Outcome
33+
34+
By the end of this workflow, the repo should have:
35+
36+
- a clear `AGENTS.md` section for `codecontext`
37+
- a sane CLI workflow for agents
38+
- lint enforcement if the repo uses ESLint
39+
- no misleading guidance about structured sidecar docs
40+
41+
## Workflow
42+
43+
### 1. Audit the current state
44+
45+
Inspect:
46+
47+
- package manager and workspace layout
48+
- whether the repo already depends on `@recallnet/codecontext-cli`
49+
- whether the repo already depends on `@recallnet/codecontext-eslint-plugin`
50+
- whether ESLint is present and where its shared config lives
51+
- whether `AGENTS.md` exists at repo root and in subtrees/worktrees
52+
- whether existing agent docs already mention `@context`, `codecontext`, ADRs,
53+
`contexts/`, or decision logs
54+
55+
Look for the two common failure modes:
56+
57+
1. tool installed, but no agent workflow or guidance
58+
2. guidance exists, but it is stale, contradictory, or points to a policy that
59+
does not exist
60+
61+
### 2. Decide the installation surface
62+
63+
Install the minimum useful surface:
64+
65+
- `@recallnet/codecontext-cli` when agents should run `--scope`, `--diff`, or
66+
`--report`
67+
- `@recallnet/codecontext-eslint-plugin` when the repo uses ESLint and wants
68+
comment validation
69+
- `@recallnet/codecontext-parser` only if the repo has custom code that imports
70+
parser APIs directly
71+
72+
Do not add packages the repo is not going to use.
73+
74+
### 3. Fix `AGENTS.md` before or alongside package changes
75+
76+
`codecontext` setup is incomplete without agent instructions.
77+
78+
Every repo-level `AGENTS.md` section should cover:
79+
80+
- what `@context` is for
81+
- when annotations are required
82+
- a small preferred taxonomy
83+
- the pre-edit and post-edit workflow
84+
- what refs are and are not
85+
- anti-patterns
86+
87+
If subtree `AGENTS.md` files point to a repo-level policy, make sure that
88+
policy actually exists.
89+
90+
## Recommended `AGENTS.md` contract
91+
92+
Keep it short. A good section usually fits in 8-14 bullets.
93+
94+
Use something close to this:
95+
96+
```md
97+
- **codecontext**: Use inline `@context` annotations for non-obvious,
98+
high-value reasoning that future edits could easily erase.
99+
- Required for:
100+
- critical decision logic and invariants
101+
- security-sensitive behavior and hard-won lessons
102+
- external integration quirks and contract mismatches
103+
- regression guards explaining why a simpler change would be wrong
104+
- Preferred forms: `@context decision`, `@context risk`,
105+
`@context requirement`, `@context history`
106+
- Keep notes short and specific: what is true, why it matters, and what
107+
would break if changed
108+
- Use `#ref` for supporting material when helpful, but refs are just pointers
109+
to repo files or docs. Do not require any special doc schema.
110+
- Before editing critical files, run:
111+
`npx @recallnet/codecontext-cli --scope <file>`
112+
- After editing, run:
113+
`npx @recallnet/codecontext-cli --diff HEAD <file>`
114+
- For broader orientation in larger repos, run:
115+
`npx @recallnet/codecontext-cli --report`
116+
- Do not use `@context` for obvious narration, duplicated ADR prose, or
117+
generic comments.
118+
```
119+
120+
Adjust the taxonomy only if the repo clearly needs more than the baseline
121+
(`decision`, `risk`, `requirement`, `history`). Add extra categories sparingly.
122+
123+
## Guidance for repos with ADRs or large docs trees
124+
125+
If the repo already uses ADRs, plans, runbooks, or architecture docs:
126+
127+
- keep `@context` as the inline agent-facing layer
128+
- treat refs as optional expansion targets
129+
- do not tell agents to browse the entire docs tree by default
130+
- do not mirror whole ADRs inline
131+
132+
The correct model is:
133+
134+
- `@context` carries the structured local signal
135+
- refs point to arbitrary supporting material
136+
- agents expand refs only when needed
137+
138+
## Refs policy
139+
140+
Be explicit:
141+
142+
- refs are allowed to point to `.md`, `.html`, `.txt`, diagrams, exports, or
143+
other repo artifacts
144+
- refs are not required on every annotation
145+
- refs should not impose a schema on the target file
146+
147+
Do not write guidance that implies:
148+
149+
- `.ctx.md` is required
150+
- frontmatter is required
151+
- the linked file must be machine-parseable
152+
153+
## CLI workflow guidance
154+
155+
Recommend these commands in agent docs when the CLI is installed:
156+
157+
```bash
158+
npx @recallnet/codecontext-cli --scope path/to/file.ts
159+
npx @recallnet/codecontext-cli --diff HEAD path/to/file.ts
160+
npx @recallnet/codecontext-cli --report
161+
```
162+
163+
Use `--report` for repo orientation and decision review. Use `--scope` and
164+
`--diff` around concrete edits.
165+
166+
## ESLint setup guidance
167+
168+
If the repo already has a shared ESLint config, integrate the plugin there.
169+
Prefer enforcing syntax and stale/invalid ref checks centrally rather than
170+
telling agents to self-police.
171+
172+
If the repo does not use ESLint, do not force it just for `codecontext`.
173+
174+
## What to look for in a review
175+
176+
Flag these as setup defects:
177+
178+
- child `AGENTS.md` files pointing to a missing repo policy
179+
- instructions that mention `@context` but give no workflow
180+
- workflow guidance that ignores `--report` in large repos
181+
- guidance that treats linked docs as required structured sidecars
182+
- package installs without corresponding agent documentation
183+
- documentation that tells agents to read giant ADR/doc trees by default
184+
185+
## Delivery
186+
187+
When you finish setup or audit work:
188+
189+
1. state what was installed or changed
190+
2. call out any stale or contradictory `AGENTS.md` guidance you fixed
191+
3. mention any remaining gaps
192+
4. if you did not install the CLI or lint plugin, explain why
193+
194+
## Default recommendation
195+
196+
If the repo has no existing `codecontext` guidance, prefer creating a
197+
`codecontext-setup` section in the root `AGENTS.md` rather than scattering
198+
instructions across multiple child docs first.

0 commit comments

Comments
 (0)