From codeant
Find the pull request for the current branch, locate the CodeAnt CI/CD Quality Gate comment, parse the failures (SAST, Secrets, Duplicate Code, SCA, IAC), and apply safe, minimal fixes for each one
How this skill is triggered — by the user, by Claude, or both
Slash command
/codeant:codeant-resolve-quality-gatesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Find the pull request for the current branch, locate the CodeAnt CI/CD Quality Gate comment, parse the listed failures, validate each finding against the current code, and apply safe, minimal fixes that do not break existing logic.
Find the pull request for the current branch, locate the CodeAnt CI/CD Quality Gate comment, parse the listed failures, validate each finding against the current code, and apply safe, minimal fixes that do not break existing logic.
The goal is to identify the correct PR. Use the following logic in order:
If the user provides a PR number (e.g., /codeant:resolve-quality-gates 42):
Use it directly. Skip to Step 2.
If no PR number is given, detect it from the current branch:
git rev-parse --abbrev-ref HEAD
If the branch is main, master, or develop, stop and tell the user: "You are on the default branch. Please switch to a feature branch or provide a PR number."
List open PRs filtered by the current branch:
codeant pr list --source-branch "<current-branch>" --state open --limit 5
The output is a JSON array of PR objects, each with these fields:
number — PR numbertitle — PR titlestate — open/closedauthor — who created itsourceBranch — the source branch nametargetBranch — the target branch nameurl — link to the PRMatch the correct PR:
sourceBranch exactly matches the current branch name, use it.<branch>. Please provide a PR number." and stop.Report that this skill was invoked:
codeant track --event "skill_invoked" --props '{"skill_name": "codeant-resolve-quality-gates", "source": "claude-code", "pr_number": <N>, "pr_url": "<PR_URL>"}'
Where <PR_URL> is the url field from the PR object found in Step 1.
Fetch every CodeAnt comment on the PR (including general/issue comments — the quality gate result is posted as a general PR comment, not an inline review comment):
codeant pr comments --pr-number <N> --codeant-generated true
From the returned array, find the most recent comment whose body contains the marker string CodeAnt Quality Gate Results. This is the quality gate summary comment posted by CodeAnt CI/CD.
:white_check_mark: Overall Status: PASSED, tell the user "Quality gates passed on PR #N — nothing to fix." and stop.Remember the comment's id field — you will need it in Step 8 to mark the conversation resolved (if your provider supports it).
The comment is markdown. Parse it into structured failures.
The body has these sections, in order:
# :checkered_flag: CodeAnt Quality Gate Results**Commit:** <hash> and **Scan Time:** ...:white_check_mark: Overall Status: PASSED, :x: Overall Status: FAILED, :warning: Overall Status: ERROR| Quality Gate | Status | Details |. The gates that may appear are **Secrets**, **Duplicate Code**, **SAST**, **IAC**, **SCA (Dependencies)**. Each row's status is :white_check_mark: PASSED, :x: FAILED, or :warning: ERROR.[View Full Results](<dashboard-url>) link.[Fix in Cursor](<url>) | [Fix in VSCode Claude](<url>) followed by a hint. Ignore these links — you are running the fix directly.<details><summary>View Failure Result</summary> that contains nested <details> blocks for each failed gate.From the Quality Gate Details table, collect the list of failed gates (rows whose Status is :x: FAILED).
From the Failure detail block, extract per-gate findings:
| File | Line | Type | Confidence |. Each row is one secret finding. - `<filename>` <window> ↔ `<filename>` <window> ... (<N> copies). Each list item is one duplicate-group finding.| Severity | File | Line | Rule | Message |. Each row is one security finding.Important: The visible failure detail block only contains rows for Secrets, Duplicate Code, and SAST. The comment intentionally omits detailed rows for SCA and IAC — the table only shows aggregated counts (e.g., Rating B: 3 vulnerabilities (1 high, 2 medium)).
For SCA / IAC failures, do NOT try to fabricate findings. Instead, run the equivalent local scan to get the actionable rows:
codeant security-analysis --uncommitted (or rely on dependency manifest changes). Report the vulnerabilities and recommend version bumps in package files.If a local rescan is needed, ask the user first — don't run it silently.
For each parsed finding, do the following:
Rule (e.g., python.django.security.injection.sql.sql-injection-using-format-string) plus Message describes the vulnerability and intended fix.Type (e.g., Generic API Key, AWS Access Key) tells you what was leaked. The fix is to remove the literal value and replace with an environment variable / secrets-manager lookup. Do NOT commit the secret to git history — if it's already in a previous commit, remind the user it must also be rotated.`file` line-range blocks that share the same logic. The fix is usually to extract the duplicated logic into a shared helper.For each finding, run through these checks:
Check that the code still exists at the referenced line. The file may have changed since the CI scan that produced this comment. If the code no longer matches what the finding describes, mark as STALE.
Draft a minimal fix. No suggestion is embedded in the quality gate comment — you must design the fix yourself based on the rule/type/window plus the surrounding code. Change only what is necessary to address the finding.
Validate the drafted fix:
Based on the validation, assign one of these verdicts:
ACCEPT — Safe to apply, you should accept this. Assign this when ALL of these are true:
LIKELY ACCEPT — Looks correct, but verify the callers. Assign this when:
DO NOT ACCEPT — This could break things. Assign this when ANY of these are true:
STALE — Code has changed since the scan. Assign this when:
Before making any changes, present a clear summary to the user:
SAST, Secrets, SCA)Then list every finding grouped by verdict. Within each verdict group, sub-group by gate type (SAST first, then Secrets, then Duplicate Code, then any SCA/IAC findings you collected via local rescan).
ACCEPT — Safe to apply (N): For each, show:
LIKELY ACCEPT — Verify callers (N): For each, show:
DO NOT ACCEPT — Could break logic (N): For each, show:
STALE — Code changed since scan (N): For each, show:
SCA / IAC failures (if any gate failed but findings could not be parsed from the comment):
List the gates and tell the user: "The quality gate comment summarizes these but doesn't include row-level details. Want me to run codeant security-analysis --uncommitted (or open the relevant IAC files) to enumerate them?"
Then ask: "I will apply the N ACCEPT fixes now. For the LIKELY ACCEPT fixes, I recommend you review the callers first — want me to apply those too, or skip them for now?"
After the user confirms:
For Secrets specifically: replace the literal with an environment variable lookup (e.g., os.getenv("FOO_API_KEY")), and remind the user the leaked value must be rotated regardless — removing it from the working tree does not undo prior commits.
After applying fixes, report the outcome:
codeant track --event "suggestions_applied" --props '{"skill_name": "codeant-resolve-quality-gates", "source": "claude-code", "pr_number": <N>, "pr_url": "<PR_URL>", "accept_count": <N>, "likely_accept_count": <N>, "do_not_accept_count": <N>, "stale_count": <N>, "total_findings": <N>, "failed_gates": "<comma-separated list>"}'
Use the actual counts from the verdicts assigned in Step 4. For likely_accept_count, only count ones the user chose to apply.
Present a final report:
Applied (N findings):
Not applied — DO NOT ACCEPT (N findings):
Not applied — STALE (N findings):
Remaining gates without row-level details (if any):
After presenting the final report, check which files were modified:
git status --short
List the changed files to the user and ask:
"These are the files that were changed:
<file1><file2>Would you like me to commit and push these changes to the current branch? You can also tell me to commit only specific files."
Pushing the fix commit will trigger CI again, which will re-run the quality gates and update the comment on the PR. The user does not need to manually resolve anything on the PR — passing gates flip the overall status to PASSED on the next run.
Before doing anything else, check that the codeant CLI is on the latest version:
npm view codeant-cli version
Compare this with the installed version:
codeant --version
If the installed version is older than the latest published version, update it:
npm install -g codeant-cli@latest
If the update fails (e.g., permission error), warn the user and continue — a slightly outdated CLI is better than blocking the entire workflow.
npx claudepluginhub codeant-ai/skills --plugin codeantProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.