Skip to content

ref(agents): compact AGENTS.md files and defer deep guides to skills - #121469

Merged
natemoo-re merged 11 commits into
masterfrom
nm/agents/context-opt
Aug 7, 2026
Merged

ref(agents): compact AGENTS.md files and defer deep guides to skills#121469
natemoo-re merged 11 commits into
masterfrom
nm/agents/context-opt

Conversation

@natemoo-re

@natemoo-re natemoo-re commented Aug 6, 2026

Copy link
Copy Markdown
Member

Recommend reviewing commit-by-commit to see exact path of content shifting from system prompt -> skills, see #121311 for another recent trim

Summary

Audit and refactor of the repo's AGENTS.md / CLAUDE.md setup to reduce always-loaded agent context and defer task-specific procedures to on-demand skills, following current prompt-engineering guidance (progressive disclosure; "AGENTS.md = README for agents, reference don't copy"; keep always-on files short).

Our own agents-md skill targets ≤100 lines per file and Claude's memory docs target <200 lines; the files had drifted well past both. Deep, task-specific how-to (RTL testing guide, TanStack Query essays, logging/tracing/metrics walkthroughs) was paying full context cost on every unrelated task. This moves that content into skills that load only when relevant.

Result

Always-loaded AGENTS.md context reduced ~64% (1381 → 495 lines); every file now under the 200-line target:

File Before After
AGENTS.md (root) 234 140
src/AGENTS.md 449 170
static/AGENTS.md 592 77
tests/AGENTS.md 106 108

No information lost — deep content moved into skills (progressive disclosure) with one-line pointers left behind.

New skills

  • react-testing — full RTL guide (extracted from static/)
  • backend-conventions — logging (LOG005/LOG011), tracing/spans, metrics tag cardinality, options system (from src/)
  • frontend-data-fetching — TanStack Query / apiOptions, type-inference rules, response headers (from static/)
  • feature-flags — FlagPole register/check/test/rollout (from root)

Deferred to existing skills (pointers, no new skills)

  • IDOR/scoping → django-access-review, sentry-security
  • Serializer N+1, composite indexes → django-perf-review
  • Silo/RPC/outbox → hybrid-cloud-*, cell-architecture
  • Migrations, DB reset, per-worktree env → generate-migration, setup-dev
  • Design-system worked examples (avatars/disclosure/icons/images) → design-system
  • API docs → document-api-endpoint

@natemoo-re
natemoo-re requested a review from a team August 6, 2026 18:16
@natemoo-re
natemoo-re marked this pull request as ready for review August 6, 2026 18:16
@natemoo-re
natemoo-re requested review from a team as code owners August 6, 2026 18:16
Move the ~300-line React Testing Guidelines section out of the
always-loaded static/AGENTS.md and into an on-demand react-testing
skill. static/AGENTS.md now carries a short pointer.

Frees always-on frontend context (static/AGENTS.md 592 -> 287 lines)
while preserving the full guide via progressive disclosure.
…ventions skill

Move the Options System, Logging, Tracing/Spans, and Metrics Tags
sections (~110 lines of task-specific code walkthroughs) out of the
always-loaded src/AGENTS.md into an on-demand backend-conventions skill.

src/AGENTS.md 449 -> 338 lines.
…ing skill

Move the ~110-line Frontend API Calls / TanStack Query type-inference /
response-headers guidance out of the always-loaded static/AGENTS.md into
an on-demand frontend-data-fetching skill.

static/AGENTS.md 287 -> 178 lines.
Tighten always-on backend guidance: reduce IDOR, serializer N+1,
composite-index, silo, and integration sections to short rules with
pointers to existing skills (django-access-review, sentry-security,
django-perf-review, hybrid-cloud-*, cell-architecture, generate-migration,
document-api-endpoint). Drop redundant prose (e.g. 'Why detail?').

src/AGENTS.md 338 -> 170 lines.
Move the Avatars/Disclosure/Icons/Images worked examples out of
static/AGENTS.md into the design-system skill; keep terse always-on
bullets plus a pointer.

static/AGENTS.md 178 -> 77 lines (now under the 100-line ceiling).
…o skills

Move git-worktree setup and 'make reset-db' into the setup-dev skill and
point DB/migration commands at the setup-dev and generate-migration
skills. Compress the venv and devserver-log prose. Preserve all
cross-agent guidance (Context-Aware Loading, Agent Skills conventions)
since this repo supports many agents, not just Claude.

Root AGENTS.md 203 -> 140 lines (now under the 200-line adherence target).
… description

The skill now covers 'make reset-db' and the per-worktree devenv/.venv
step; add matching triggers so they're discoverable. Scoped to
environment setup — generic worktree management stays with the worktree skill.
@natemoo-re
natemoo-re force-pushed the nm/agents/context-opt branch from df36003 to 31bcb34 Compare August 6, 2026 18:23
@natemoo-re
natemoo-re requested review from billyvg and joshuarli August 6, 2026 18:24

@joshuarli joshuarli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice

@natemoo-re
natemoo-re enabled auto-merge (squash) August 6, 2026 18:57
Comment thread .agents/skills/design-system/SKILL.md Outdated
Comment thread .agents/skills/design-system/SKILL.md Outdated
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 6, 2026
@natemoo-re
natemoo-re merged commit 774aeab into master Aug 7, 2026
67 checks passed
@natemoo-re
natemoo-re deleted the nm/agents/context-opt branch August 7, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants