Defect Lifecycle Agent Skill
Author: jovd83 | Version: 2.2.1
Use this skill to move a defect from intake through verified resolution without skipping the evidence that makes the fix trustworthy.
Responsibilities
- report newly discovered defects with repository-grounded evidence
- fix approved bugs with a failing confirmation test before the implementation when practical
- explain the requirement gap, test gap, and root cause in plain engineering language
- update affected documentation when product behavior, developer guidance, or operator guidance changed
- deliver a structured report that another engineer can audit quickly
Boundaries
- Do not use this skill for net-new feature work, broad refactors unrelated to a defect, or postmortem-only incident analysis.
- Do not assume the repository uses
docs/functional analysis/, docs/technical/, frontend-tests/, or any other fixed layout. Discover the actual conventions first.
- Do not start fixing tracker bugs unless the user explicitly asks for the fix or the issue is clearly marked approved.
- Do not patch code before you have either reproduced the failure or explained precisely why deterministic reproduction is currently blocked.
- Do not treat global line coverage alone as proof of adequate regression safety.
- Do not create persistent shared-memory behavior inside this skill. Shared memory belongs behind an external integration boundary such as a dedicated shared-memory skill.
Dispatcher Integration
Use skill-dispatcher as the primary integration layer whenever this skill needs help from another skill.
- Prefer dispatching by intent rather than naming a sibling skill directly.
- Prefer the repository's native test stack over an organization-wide default.
- Use shared memory only for stable cross-project routing policy, not for task-local routing.
- Treat direct skill paths as a fallback only when the dispatcher has no valid registry match.
Common downstream intents:
design_confirmation_tests
render_test_artifact
implement_ui_confirmation_test
generate_test_data
review_automation_quality
Inputs To Confirm Or Infer
Confirm or infer these inputs before heavy edits:
- execution mode:
report-only or approved-fix
- defect source: user description, tracker ticket, failing test, log, screenshot, or monitoring alert
- affected surface: UI flow, service, API, job, component, or integration point
- repository conventions for requirements, docs, diagrams, help content, and changelog updates
- existing test stack, coverage tooling, and whether JSON coverage summaries are available
- whether the task must produce only markdown or also machine-readable artifacts for automation
- whether the output should also be exported as a Jira-ready or Linear-ready tracker draft
Defaults:
- assume
report-only when the user says to log or document a bug
- assume
approved-fix when the user says to fix an identified bug directly
- reuse the repository's existing test and documentation stack when present
- keep runtime notes ephemeral unless the user asks you to persist local project artifacts
Workflow
1. Establish scope and approval state
- Classify the request as bug discovery, approved bug fix, or blocked triage.
- Identify the source-of-truth artifact if one exists: issue ID, failing test, support ticket, stack trace, or user report.
- If the work is fix-oriented but approval is ambiguous, pause and ask only when proceeding would be risky.
2. Discover repository conventions
Inspect the target repository before assuming paths or tools.
- Find manifests and tool configs such as
package.json, pyproject.toml, pom.xml, go.mod, Cargo.toml, playwright.config.*, cypress.config.*, jest.config.*, vitest.config.*, or CI workflows.
- Locate where the repository keeps product requirements, ADRs, diagrams, runbooks, help content, or changelog history.
- Identify the existing test layers and their ownership: unit, integration, API, component, browser, or end-to-end.
- Read references/repository-discovery.md when the layout is non-obvious or inconsistent.
3. Choose the execution path
Discovery-only path
Use this path when the user wants the defect reported, triaged, or written up but not fixed.
- Reproduce the issue when practical, or document why reproduction is blocked.
- Check the expected behavior against the best available source of truth.
- Read assets/bug-discovery-template.md.
- Produce the bug report using the required headings from the template.
- Stop after the report unless the user expands the scope.
Approved-fix path
Use this path when the bug is ready to be fixed.
- Reproduce or otherwise verify the failure with evidence.
- Identify the requirement gap, documentation gap, or assumption gap that allowed the defect.
- Create a focused confirmation test that fails for the current bug when practical.
If this requires specialist help, dispatch
design_confirmation_tests first and render_test_artifact only when a rendered artifact is actually required.
- Explain why the existing tests or monitoring failed to catch the problem.
- Implement the minimal credible fix.
- Re-run the confirmation test and a right-sized regression set.
When browser automation is needed, dispatch
implement_ui_confirmation_test and prefer the repository-native stack.
- Validate coverage with
node scripts/verify-coverage.js when a JSON summary is available.
- Update docs only where the bug changed user-visible behavior, developer contracts, or operator expectations.
- Read assets/bug-fix-report-template.md and references/response-contracts.md.
- Deliver the structured resolution report.
4. Coverage and regression discipline
Use the repository's native test commands. Do not invent a test stack.
- Prefer the narrowest verification that proves the bug, then broaden to nearby regression risks.
- When JSON coverage data exists, run
node scripts/verify-coverage.js --coverage <path>.
- When the change is scoped to specific files, prefer file-scoped validation with
--files or --manifest.
- Read references/coverage-policy.md before lowering or changing thresholds.
5. Documentation and artifact updates
Only update the artifacts that truly changed.
- requirements or acceptance criteria when the defect exposed a missing or ambiguous rule
- technical docs when implementation behavior or operational guidance changed
- diagrams when data flow, state flow, or architecture changed materially
- help content when user guidance was wrong or incomplete
- changelog when the repository already maintains one
- README only when setup, usage, or development workflow changed
Response Contract
For discovery-only work, use the headings from assets/bug-discovery-template.md.
For approved-fix work, use the headings from assets/bug-fix-report-template.md. The report must make these points clear:
- what failed and who was affected
- how the expected behavior was validated
- why the bug slipped through
- how the confirmation test proved the defect before the fix
- what changed in code, tests, and docs
- what was validated after the fix
- what residual risks or out-of-scope follow-up items remain
Read references/response-contracts.md when you need the exact required fields and optional machine-readable appendix guidance.
When the caller wants machine-readable or tracker-ready output:
- emit canonical JSON that matches schemas/bug-discovery-report.schema.json or schemas/bug-fix-report.schema.json
- use
node scripts/export-tracker-artifact.js --tracker jira|linear --input <report.json> to generate a tracker draft artifact
- read references/tracker-exports.md before claiming a tracker export is ready
Memory Model
- Runtime memory: live notes, reproduction data, stack traces, diffs, and the active verification plan for the current task only.
- Project-local memory: issue writeups, markdown reports, local docs, or other repository artifacts deliberately saved in the target project.
- Shared memory: out of scope for this skill. If cross-project reuse is needed, integrate a separate shared-memory skill rather than embedding that responsibility here.
Do not automatically promote runtime findings into persistent storage. Persist only what improves traceability for the current project.
Failure Handling
- If the bug cannot be reproduced, state what evidence exists, what was attempted, and what blocks confirmation.
- If no requirements source exists, state the limitation and use the strongest available signal such as observed UX, API contract, or nearby code comments.
- If no automated tests exist, document the gap explicitly and add the smallest useful regression protection when the user asked for a fix.
- If coverage JSON is unavailable, say so plainly instead of pretending the validator ran.
- If docs or diagrams do not exist in the repository, do not invent a documentation architecture unless the user asks for one.
- If the bug implies a broader product decision rather than a straightforward defect, surface the ambiguity instead of forcing a narrow technical fix.
Gotchas
- Deterministic Reproduction: Not every defect is reproducible in a limited environment (e.g., race conditions, external API dependencies). Always document the blocking reason if a confirmation test cannot be created.
- Script Dependencies: This skill relies on
scripts/verify-coverage.js and scripts/export-tracker-artifact.js. If these are missing or return a non-zero exit code, automated validation and export steps will fail.
- Approval Ambiguity: The
approved-fix path should only be taken when there is clear intent from the user. Automating fixes for unconfirmed tracker issues can result in unintended side effects.
- Test Layer Gaps: This skill prefers the repository's native test stack. If the repository has no tests, the agent will attempt to add minimal safety but may miss broader regression risks.
Resource Map
assets/bug-discovery-template.md: required markdown template for discovery-only reports
assets/bug-fix-report-template.md: required markdown template for resolution reports
scripts/verify-coverage.js: deterministic coverage validator for total or file-scoped checks
scripts/validate-skill.js: smoke validator for skill packaging and required artifacts
references/repository-discovery.md: repository inspection and convention-mapping guide
references/response-contracts.md: exact reporting requirements and extension guidance
references/coverage-policy.md: threshold policy and coverage-validation usage
references/evaluation.md: maintenance and evaluation strategy for this skill
examples/example-prompts.md: representative trigger prompts and expected routing
examples/coverage-manifest.example.json: sample manifest for scoped coverage validation
examples/sample-bug-discovery.json: canonical machine-readable discovery report example
examples/sample-bug-fix-report.json: canonical machine-readable fix report example
schemas/bug-discovery-report.schema.json: schema for machine-readable discovery reports
schemas/bug-fix-report.schema.json: schema for machine-readable fix reports
scripts/export-tracker-artifact.js: export canonical reports into Jira-ready or Linear-ready draft artifacts
references/tracker-exports.md: tracker artifact mapping and usage guidance
When To Read Extra References
- Read
references/repository-discovery.md when the repository's documentation or test layout is unclear.
- Read
references/response-contracts.md before composing a substantial bug report or fix report.
- Read
references/coverage-policy.md when the default threshold, metrics, or scoping rules are in question.
- Read
references/tracker-exports.md when the user wants Jira or Linear-ready artifacts.
- Read
references/evaluation.md when extending, validating, or regression-testing this skill itself.
1---2name: defect-lifecycle-agent-skill3description: Use when Codex must report a newly discovered defect, implement an approved bug fix, or harden regression coverage and documentation around a known bug. This skill enforces repository-aware bug intake, failing confirmation tests before fixes, scoped verification, documentation updates when warranted, and a structured resolution report.4---56# Defect Lifecycle Agent Skill78> **Author:** jovd83 | **Version:** 2.2.191011Use this skill to move a defect from intake through verified resolution without skipping the evidence that makes the fix trustworthy.1213## Responsibilities1415- report newly discovered defects with repository-grounded evidence16- fix approved bugs with a failing confirmation test before the implementation when practical17- explain the requirement gap, test gap, and root cause in plain engineering language18- update affected documentation when product behavior, developer guidance, or operator guidance changed19- deliver a structured report that another engineer can audit quickly2021## Boundaries2223- Do not use this skill for net-new feature work, broad refactors unrelated to a defect, or postmortem-only incident analysis.24- Do not assume the repository uses `docs/functional analysis/`, `docs/technical/`, `frontend-tests/`, or any other fixed layout. Discover the actual conventions first.25- Do not start fixing tracker bugs unless the user explicitly asks for the fix or the issue is clearly marked approved.26- Do not patch code before you have either reproduced the failure or explained precisely why deterministic reproduction is currently blocked.27- Do not treat global line coverage alone as proof of adequate regression safety.28- Do not create persistent shared-memory behavior inside this skill. Shared memory belongs behind an external integration boundary such as a dedicated shared-memory skill.2930## Dispatcher Integration3132Use `skill-dispatcher` as the primary integration layer whenever this skill needs help from another skill.3334- Prefer dispatching by intent rather than naming a sibling skill directly.35- Prefer the repository's native test stack over an organization-wide default.36- Use shared memory only for stable cross-project routing policy, not for task-local routing.37- Treat direct skill paths as a fallback only when the dispatcher has no valid registry match.3839Common downstream intents:4041- `design_confirmation_tests`42- `render_test_artifact`43- `implement_ui_confirmation_test`44- `generate_test_data`45- `review_automation_quality`4647## Inputs To Confirm Or Infer4849Confirm or infer these inputs before heavy edits:5051- execution mode: `report-only` or `approved-fix`52- defect source: user description, tracker ticket, failing test, log, screenshot, or monitoring alert53- affected surface: UI flow, service, API, job, component, or integration point54- repository conventions for requirements, docs, diagrams, help content, and changelog updates55- existing test stack, coverage tooling, and whether JSON coverage summaries are available56- whether the task must produce only markdown or also machine-readable artifacts for automation57- whether the output should also be exported as a Jira-ready or Linear-ready tracker draft5859Defaults:6061- assume `report-only` when the user says to log or document a bug62- assume `approved-fix` when the user says to fix an identified bug directly63- reuse the repository's existing test and documentation stack when present64- keep runtime notes ephemeral unless the user asks you to persist local project artifacts6566## Workflow6768### 1. Establish scope and approval state69701. Classify the request as bug discovery, approved bug fix, or blocked triage.712. Identify the source-of-truth artifact if one exists: issue ID, failing test, support ticket, stack trace, or user report.723. If the work is fix-oriented but approval is ambiguous, pause and ask only when proceeding would be risky.7374### 2. Discover repository conventions7576Inspect the target repository before assuming paths or tools.7778- Find manifests and tool configs such as `package.json`, `pyproject.toml`, `pom.xml`, `go.mod`, `Cargo.toml`, `playwright.config.*`, `cypress.config.*`, `jest.config.*`, `vitest.config.*`, or CI workflows.79- Locate where the repository keeps product requirements, ADRs, diagrams, runbooks, help content, or changelog history.80- Identify the existing test layers and their ownership: unit, integration, API, component, browser, or end-to-end.81- Read [references/repository-discovery.md](references/repository-discovery.md) when the layout is non-obvious or inconsistent.8283### 3. Choose the execution path8485#### Discovery-only path8687Use this path when the user wants the defect reported, triaged, or written up but not fixed.88891. Reproduce the issue when practical, or document why reproduction is blocked.902. Check the expected behavior against the best available source of truth.913. Read [assets/bug-discovery-template.md](assets/bug-discovery-template.md).924. Produce the bug report using the required headings from the template.935. Stop after the report unless the user expands the scope.9495#### Approved-fix path9697Use this path when the bug is ready to be fixed.98991. Reproduce or otherwise verify the failure with evidence.1002. Identify the requirement gap, documentation gap, or assumption gap that allowed the defect.1013. Create a focused confirmation test that fails for the current bug when practical.102 If this requires specialist help, dispatch `design_confirmation_tests` first and `render_test_artifact` only when a rendered artifact is actually required.1034. Explain why the existing tests or monitoring failed to catch the problem.1045. Implement the minimal credible fix.1056. Re-run the confirmation test and a right-sized regression set.106 When browser automation is needed, dispatch `implement_ui_confirmation_test` and prefer the repository-native stack.1077. Validate coverage with `node scripts/verify-coverage.js` when a JSON summary is available.1088. Update docs only where the bug changed user-visible behavior, developer contracts, or operator expectations.1099. Read [assets/bug-fix-report-template.md](assets/bug-fix-report-template.md) and [references/response-contracts.md](references/response-contracts.md).11010. Deliver the structured resolution report.111112### 4. Coverage and regression discipline113114Use the repository's native test commands. Do not invent a test stack.115116- Prefer the narrowest verification that proves the bug, then broaden to nearby regression risks.117- When JSON coverage data exists, run `node scripts/verify-coverage.js --coverage <path>`.118- When the change is scoped to specific files, prefer file-scoped validation with `--files` or `--manifest`.119- Read [references/coverage-policy.md](references/coverage-policy.md) before lowering or changing thresholds.120121### 5. Documentation and artifact updates122123Only update the artifacts that truly changed.124125- requirements or acceptance criteria when the defect exposed a missing or ambiguous rule126- technical docs when implementation behavior or operational guidance changed127- diagrams when data flow, state flow, or architecture changed materially128- help content when user guidance was wrong or incomplete129- changelog when the repository already maintains one130- README only when setup, usage, or development workflow changed131132## Response Contract133134For discovery-only work, use the headings from [assets/bug-discovery-template.md](assets/bug-discovery-template.md).135136For approved-fix work, use the headings from [assets/bug-fix-report-template.md](assets/bug-fix-report-template.md). The report must make these points clear:137138- what failed and who was affected139- how the expected behavior was validated140- why the bug slipped through141- how the confirmation test proved the defect before the fix142- what changed in code, tests, and docs143- what was validated after the fix144- what residual risks or out-of-scope follow-up items remain145146Read [references/response-contracts.md](references/response-contracts.md) when you need the exact required fields and optional machine-readable appendix guidance.147148When the caller wants machine-readable or tracker-ready output:149150- emit canonical JSON that matches [schemas/bug-discovery-report.schema.json](schemas/bug-discovery-report.schema.json) or [schemas/bug-fix-report.schema.json](schemas/bug-fix-report.schema.json)151- use `node scripts/export-tracker-artifact.js --tracker jira|linear --input <report.json>` to generate a tracker draft artifact152- read [references/tracker-exports.md](references/tracker-exports.md) before claiming a tracker export is ready153154## Memory Model155156- Runtime memory: live notes, reproduction data, stack traces, diffs, and the active verification plan for the current task only.157- Project-local memory: issue writeups, markdown reports, local docs, or other repository artifacts deliberately saved in the target project.158- Shared memory: out of scope for this skill. If cross-project reuse is needed, integrate a separate shared-memory skill rather than embedding that responsibility here.159160Do not automatically promote runtime findings into persistent storage. Persist only what improves traceability for the current project.161162## Failure Handling163164- If the bug cannot be reproduced, state what evidence exists, what was attempted, and what blocks confirmation.165- If no requirements source exists, state the limitation and use the strongest available signal such as observed UX, API contract, or nearby code comments.166- If no automated tests exist, document the gap explicitly and add the smallest useful regression protection when the user asked for a fix.167- If coverage JSON is unavailable, say so plainly instead of pretending the validator ran.168- If docs or diagrams do not exist in the repository, do not invent a documentation architecture unless the user asks for one.169- If the bug implies a broader product decision rather than a straightforward defect, surface the ambiguity instead of forcing a narrow technical fix.170171## Gotchas172173- **Deterministic Reproduction**: Not every defect is reproducible in a limited environment (e.g., race conditions, external API dependencies). Always document the blocking reason if a confirmation test cannot be created.174- **Script Dependencies**: This skill relies on `scripts/verify-coverage.js` and `scripts/export-tracker-artifact.js`. If these are missing or return a non-zero exit code, automated validation and export steps will fail.175- **Approval Ambiguity**: The `approved-fix` path should only be taken when there is clear intent from the user. Automating fixes for unconfirmed tracker issues can result in unintended side effects.176- **Test Layer Gaps**: This skill prefers the repository's native test stack. If the repository has no tests, the agent will attempt to add minimal safety but may miss broader regression risks.177178## Resource Map179180- `assets/bug-discovery-template.md`: required markdown template for discovery-only reports181- `assets/bug-fix-report-template.md`: required markdown template for resolution reports182- `scripts/verify-coverage.js`: deterministic coverage validator for total or file-scoped checks183- `scripts/validate-skill.js`: smoke validator for skill packaging and required artifacts184- `references/repository-discovery.md`: repository inspection and convention-mapping guide185- `references/response-contracts.md`: exact reporting requirements and extension guidance186- `references/coverage-policy.md`: threshold policy and coverage-validation usage187- `references/evaluation.md`: maintenance and evaluation strategy for this skill188- `examples/example-prompts.md`: representative trigger prompts and expected routing189- `examples/coverage-manifest.example.json`: sample manifest for scoped coverage validation190- `examples/sample-bug-discovery.json`: canonical machine-readable discovery report example191- `examples/sample-bug-fix-report.json`: canonical machine-readable fix report example192- `schemas/bug-discovery-report.schema.json`: schema for machine-readable discovery reports193- `schemas/bug-fix-report.schema.json`: schema for machine-readable fix reports194- `scripts/export-tracker-artifact.js`: export canonical reports into Jira-ready or Linear-ready draft artifacts195- `references/tracker-exports.md`: tracker artifact mapping and usage guidance196197## When To Read Extra References198199- Read `references/repository-discovery.md` when the repository's documentation or test layout is unclear.200- Read `references/response-contracts.md` before composing a substantial bug report or fix report.201- Read `references/coverage-policy.md` when the default threshold, metrics, or scoping rules are in question.202- Read `references/tracker-exports.md` when the user wants Jira or Linear-ready artifacts.203- Read `references/evaluation.md` when extending, validating, or regression-testing this skill itself.