一键导入
context-injection
How delivery leads use hero relevant output to equip specialist agents with relevant conventions, past work, decisions, and known risks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How delivery leads use hero relevant output to equip specialist agents with relevant conventions, past work, decisions, and known risks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | context-injection |
| description | How delivery leads use hero relevant output to equip specialist agents with relevant conventions, past work, decisions, and known risks. |
| compatibility | opencode |
| metadata | {"audience":"delivery-leads","purpose":"context-injection"} |
Teach delivery leads how to generate context blocks with the hero relevant command and incorporate them into engineer instructions before delegating work. Context injection is how agents avoid repeating past mistakes, violating conventions, and contradicting architectural decisions.
Load this skill before the delivery phase of any spec — after the spec is written and before delegating to an engineer or specialist agent. If hero.json has auto_context: true, the workflow handles this automatically, but delivery leads should still understand the output to intervene when needed.
Context injection bridges the gap between "here's what to build" (the spec) and "here's what you need to know about this codebase" (the context). Without it, an agent writes code in isolation — unaware of conventions, past decisions, and known failure modes in the areas it's touching.
The hero relevant command queries the spec corpus index and returns a structured block of relevant information. The delivery lead pastes this block into the engineer's instructions alongside the spec.
hero relevant .hero/planning/features/add-csv-export/spec.md
This parses the spec's Changes section, extracts file paths mentioned in it, and looks up context for those files. This is the most common usage — you have a spec and want context for the work it describes.
hero relevant --files src/api/users.ts src/db/queries/users.sql
Use this when you know the files that will be touched but don't have a spec, or when the spec's Changes section doesn't mention specific files yet.
The command returns a markdown block with up to four sections:
## Context for this work
### Conventions to follow
- **api-response-format** (scope: src/api/**/*.ts): All API error responses
use the ApiError class and return { error, code, details }.
- **sql-migration-naming** (scope: **/migrations/*.sql): Migration files
use the format YYYYMMDDHHMMSS_description.sql.
### API surface (when relevant)
If the spec touches API handler files, run `hero_code endpoints` to get the
endpoint-to-handler mapping. Include this when work involves routing,
middleware, or request/response changes so the engineer knows the full
API surface around the files being modified.
### Past work in this area
- **add-user-search** (completed): Added full-text search to the users
endpoint. Introduced the SearchQuery type in src/api/types.ts.
### Decisions that apply
- **use-postgres-fts** (accepted): Use PostgreSQL full-text search rather
than Elasticsearch for search features under 1M documents.
### Known risks
- **login-timeout-race** (bug, completed): Race condition in session
handling when concurrent requests hit src/api/auth.ts. Fixed by
adding mutex on session write.
Each entry is a summary — enough to inform the agent without overwhelming it. The agent can look up the full spec if it needs more detail.
These are active convention specs whose scope globs match the files being touched. The agent must follow these unless the spec explicitly says otherwise.
If a convention is listed, the agent should:
Completed specs that previously touched the same files. This tells the agent what was done before, why, and what patterns were established. It prevents the agent from undoing previous work or introducing inconsistencies.
Use past work to:
Accepted architectural decision records (ADRs). These are constraints the agent must respect. An accepted decision means the team deliberately chose this path — the agent should not revisit the decision unless the spec explicitly says to.
Bug specs whose root causes involved the same files. These are landmines — the agent needs to know about them to avoid triggering the same failures.
Use known risks to:
When delegating to an engineer agent, structure the handoff as:
The context block goes between the spec and any additional instructions. This lets the agent read the spec first, then calibrate its approach based on context.
Do not strip sections from the context block to save tokens. The block is already summarized — removing sections creates blind spots. If a section is genuinely irrelevant, you can add a note saying "the X section is not relevant to this task because Y" rather than removing it.
Context is guidance, not law. Override it when:
Never silently ignore context. If you're overriding something, say so and explain why. This creates a trail that future context lookups can surface.
When context sections contradict each other or the spec:
Before handing off to the engineer, verify:
Behavioral rules that make AI coding agents more reliable — verification, self-correction, and scope discipline.
Debugging guidance and structured report template for thorough bug investigation, evidence gathering, and root cause documentation.
Cold-audit a completed delivery — verify the spec was actually delivered, challenge performative claims, and produce a what-landed report.
Guidelines for generating self-contained HTML mockups that look professional and are easy to iterate on.
Shared implementation guidance for making minimal, correct, maintainable code changes that fit existing systems.
The doctrine for `/roadmap-review` — interactive triage of roadmap-shape drift, walked one item at a time, with paste-ready resolution phrasing for the active sizing lens.