Implement a fix for a reviewed security issue. Takes an issue number or scans for issues labeled "topic:security" and "state:agent-ready". Reads the security review from the issue comments and implements the remediation plan. Trigger keywords - fix security issue, remediate security, implement security fix, patch vulnerability.
72
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Implement a code fix for a security issue that has already been reviewed by the review-security-issue skill.
gh CLI must be authenticated (gh auth status)topic:security and state:agent-ready labels. If either is missing, do not proceed.review-security-issue) with a Legitimate concern determination and a remediation planAll PR descriptions and comments posted by this skill must begin with the following marker line:
> **🔧 security-fix-agent**This distinguishes fix-agent content from review-agent comments (🔒 security-review-agent) and human comments.
The user may provide an issue number directly, or ask the agent to find issues to fix.
Strip any leading # and proceed to Step 2 with that issue ID.
Scan for open issues labeled topic:security and state:agent-ready:
gh issue list --label "topic:security" --label "state:agent-ready" --state open --json number,title,labels,updatedAtFetch the issue details:
gh issue view <id> --json number,title,body,state,labels,authortopic:security and state:agent-ready labelsThis is a hard gate. Check the issue's labels array from the response above. Both of the following labels must be present:
topic:securitystate:agent-readyIf either label is missing, do not proceed. Report to the user which label(s) are missing and stop. For example:
state:agent-ready: "Issue #42 has the topic:security label but is not marked state:agent-ready. It may still need review or human triage before a fix can be implemented."topic:security: "Issue #42 is marked state:agent-ready but does not have the topic:security label. This skill only handles security issues."topic:security and state:agent-ready labels. Cannot proceed."Do not offer to add the labels or bypass this check. The labels are a deliberate human-controlled gate.
Once labels are confirmed, fetch the comments to find the security review:
gh issue view <id> --json comments --jq '[.comments[] | select(.body | contains("security-review-agent"))]'security-review-agent comment is found, report to the user that this issue has not been reviewed yet. Suggest running the review-security-issue skill first. Stop.Before writing code, analyze the remediation plan from the review comment:
If the remediation plan references files or components that no longer exist or have changed significantly, adapt the plan accordingly and note the deviations.
Create a working branch for the fix:
git checkout -b fix/security-<issue-id>-<short-description>Follow the project's branch naming conventions. The branch name should reference the issue ID.
Implement the changes described in the remediation plan. Follow these principles:
After implementing, run the project's pre-commit checks:
mise run pre-commitFix any issues that arise before proceeding.
Every security fix must include tests that verify the vulnerability is resolved. Choose the appropriate test level(s) based on the nature of the fix:
Add unit tests when the fix changes a specific function, method, or module in isolation. Place them alongside the existing tests for that module (e.g., same tests/ directory or #[cfg(test)] block for Rust, test_*.py for Python).
Unit tests should cover:
Add integration or end-to-end tests when the vulnerability spans multiple components or is triggered via an API endpoint, CLI command, or network boundary. Place them in the project's existing integration or e2e test directories.
Integration tests should cover:
Name tests descriptively to document the security concern:
test_rejects_sql_injection_in_search_querytest_blocks_path_traversal_in_file_uploadtest_enforces_auth_on_admin_endpointRun the full relevant test suite to confirm both the new tests pass and no existing tests regress:
# Run tests relevant to the changed components
# The specific command depends on the project area affectedIf the review identified a specific exploit scenario, verify that it is no longer possible with the fix in place.
Review the documentation requirements in AGENTS.md and update any affected
docs as part of the security fix. If the fix is purely internal, such as
switching to parameterized queries with no external behavior change,
documentation updates may not be needed.
Commit all changes (implementation, tests, and documentation) using conventional commit format:
git add <files>
git commit -m "$(cat <<'EOF'
fix(security): <short description of the fix>
Closes #<issue-id>
<brief explanation of what was vulnerable and how it's fixed>
EOF
)"git push -u origin HEADCreate a PR that closes the security issue. Put the full fix summary in the PR description rather than commenting on the issue -- the Closes #<id> directive will auto-close the issue when merged.
gh pr create \
--title "fix(security): <short description>" \
--label "topic:security" \
--body "$(cat <<'EOF'
> **🔧 security-fix-agent**
Closes #<issue-id>
## Security Fix
### Summary
<1-3 sentences describing the security issue and how it was fixed>
### Severity Assessment
- **Impact:** <high / medium / low>
- **Exploitability:** <description of attack vector and prerequisites>
- **Affected components:** <list of affected code paths or services>
### Changes Made
- `<file1>`: <what changed and why>
- `<file2>`: <what changed and why>
### Tests Added
- **Unit:** <test file and what it covers>
- **Integration/E2E:** <test file and what it covers, or "N/A" if not applicable>
### Documentation Updated
- `<doc path>`: <what was updated, or "None needed">
### Verification
<how the fix was verified -- tests passed, exploit scenario tested, etc.>
EOF
)"Display the PR URL so it's easily clickable:
Created PR [#<number>](https://github.com/OWNER/REPO/pull/<number>)Summarize what was done:
| Command | Description |
|---|---|
gh issue list --label "topic:security" --label "state:agent-ready" --state open | Find open security issues ready for fixing |
gh issue view <id> --json number,title,body,state,labels,author | Fetch full issue metadata |
gh issue view <id> --json comments | Fetch all comments on an issue |
gh pr create --title "..." --body "..." | Create a pull request |
gh api user --jq '.login' | Get current GitHub username |
gh issue view <id> | View issue details |
mise run pre-commit | Run pre-commit checks |
User says: "Fix security issue #42"
security-review-agent review with determination "Legitimate concern"fix/security-42-input-sanitizationAGENTS.md, if neededCloses #42User says: "Fix any ready security issues"
topic:security + state:agent-readytest_rejects_sql_injection_in_search_query unit test and e2e test for the search endpointAGENTS.md, if neededCloses #78, report to userUser says: "Fix security issue #99"
security-review-agent review with determination "Not actionable"state:agent-ready labelUser says: "Fix security issue #55"
["topic:security"] -- missing state:agent-readytopic:security label but is not marked state:agent-ready. It may still need review or human triage before a fix can be implemented."User says: "Fix security issue #60"
topic:security and state:agent-readysecurity-review-agent comment founddeced87
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.