Write Feature Context
Use when asked to create, update, or register feature context docs under .agents/references/features from PRDs, Figma, code diffs, touched files, QA findings, or repeated product-domain knowledge.
Source: .agents/skills/write-feature-context/SKILL.md
Metadata
- name: write-feature-context
Content
Write Feature Context
Use this skill to turn feature knowledge into durable repo context that future agents can load without the user repeating the same PRD, Figma, QA, or code history.
Feature context files are prompt context, not product specs. They should orient future agents and still require live code inspection before edits.
Workflow
-
Load the baseline context:
- Read
AGENTS.md,.agents/skills/feature-context/SKILL.md, and.agents/references/features/_template.md. - Read relevant
.agents/rules/*.mdcand coding standards for the feature area. - If the user provides PRD, Lark, Figma, browser, QA doc, or issue links, inspect those sources with the appropriate skill/tool before writing.
- Read
-
Inspect live code:
- Follow
.agents/references/coding-standard/codebase-memory-guidance.mdand resolve/index the exact current worktree before discovery. - Use
get_architecture,search_graph, andtrace_pathto identify durable entrypoints, consumers, data flow, and tests. Resolve exact symbols before usingget_code_snippet. - Use
search_codefor source literals/test patterns andrg/findfor non-code or insufficient graph results; record fallback searches in the reference only when they remain useful. - Read every route, component, hook, service, and utility the user mentions or that the search shows as central to the feature.
- Check
git diffwhen the request is based on recent work, but do not rely on diff alone; inspect surrounding source.
- Follow
-
Choose where the context belongs:
- Update an existing
.agents/references/features/*.mdwhen the domain already exists. - Create a new focused file from
_template.mdwhen the feature has durable routes, services, workflows, or recurring gotchas that do not fit an existing pack. - Keep broad domains broad and focused domains focused. Do not bury a large workflow in an unrelated reference just because it touches that area.
- Update an existing
-
Write the feature reference:
- Cover purpose, user-facing workflows, key entrypoints, data flow/service boundaries, conventions/gotchas, related standards, useful graph queries/searches, and update triggers.
- Be detailed but concise. Prefer concrete file paths, query params, service names, state contracts, and redirect rules over general product prose.
- Include PRD/Figma-derived behavior only after checking it against live code or clearly marking it as a product requirement.
- Capture durable gotchas from the work: loading states, redirects, modal handoffs, upload failure behavior, stale state risks, service error handling, permissions, and checkout/payment return flows.
- Do not include temporary branch notes, one-off debugging transcripts, credentials, screenshots, or long copied PRD/Figma text.
-
Register discovery:
- If a new feature file is created, add it to the Domain Selection table in
.agents/skills/feature-context/SKILL.md. - Use trigger terms future agents will actually see: route names, component names, product names, service names, query params, and common user wording.
- If a new feature file is created, add it to the Domain Selection table in
-
Sync and clean:
- Run
bun run sync-agentsafter editing.agents/. - Remove temporary notes, exports, screenshots, or scratch files created only for writing the feature context unless the user explicitly asked to keep them.
- Do not commit or push unless the user explicitly asks.
- Run
Quality Bar
- The context must be useful to an agent that has never seen the original thread.
- The doc must point future agents to the right files and searches quickly.
- The doc must avoid pretending to be the source of truth when live code, PRD, Figma, Apifox, or backend contracts can differ.
- The doc should make recurring mistakes harder: mention exact state contracts, route/query behavior, service response patterns, and UX invariants.
Verification
Run:
rtk git diff --check -- .agents/skills .agents/references/features
rtk rg -n "[[:blank:]]$" .agents/skills .agents/references/features
Also verify:
- New feature references exist in
.agents/references/features/. - Mirrored files exist under
.agent/,.codex/,.cursor/, and.claude/afterbun run sync-agents. feature-context/SKILL.mdincludes the new reference when one was created.