From security-code-audit
This skill should be used when the user asks to "review MR for security", "check PR for vulnerabilities", "security review merge request", "review pull request for security", "audit merge request", or provides a GitLab/GitHub MR/PR URL.
How this skill is triggered — by the user, by Claude, or both
Slash command
/security-code-audit:security-code-audit-mrThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Security review for GitLab Merge Requests and GitHub Pull Requests.
Security review for GitLab Merge Requests and GitHub Pull Requests.
Analyze merge requests and pull requests for security vulnerabilities before merging. Auto-detects platform from URL, fetches diff, and performs comprehensive security analysis.
$ARGUMENTS - MR/PR URL (required) + optional additional context
/security-code-audit-mr https://github.com/owner/repo/pull/123
/security-code-audit-mr https://gitlab.com/owner/repo/-/merge_requests/456
/security-code-audit-mr https://github.com/owner/repo/pull/123 "focus on auth changes"
Extract from URL:
| Platform | URL Pattern | Extract |
|---|---|---|
| GitHub | github.com/{owner}/{repo}/pull/{number} | owner, repo, PR number |
| GitLab | gitlab.com/{owner}/{repo}/-/merge_requests/{number} | owner, repo, MR number |
| GitLab Self-hosted | gitlab.* hostname | Same as GitLab |
# URL parsing example
# GitHub: https://github.com/owner/repo/pull/123
# GitLab: https://gitlab.com/owner/repo/-/merge_requests/456
# Check for required CLI
which gh || echo "gh not installed - brew install gh"
which glab || echo "glab not installed - brew install glab"
# Verify authentication
gh auth status 2>/dev/null || echo "GitHub CLI not authenticated"
glab auth status 2>/dev/null || echo "GitLab CLI not authenticated"
GitHub:
gh pr view {number} --repo {owner}/{repo} --json title,author,headRefName,baseRefName,state
GitLab:
glab mr view {number} --repo {owner}/{repo}
GitHub:
gh pr diff {number} --repo {owner}/{repo}
GitLab:
glab mr diff {number} --repo {owner}/{repo}
Fallback (if CLI unavailable):
git clone --depth 1 {repo_url} /tmp/review_repo
cd /tmp/review_repo
git fetch origin pull/{number}/head:pr-{number}
git diff main...pr-{number}
From diff output:
--- a/file and +++ b/file+ prefix- prefix@@ hunk headersFor each changed file:
../security-code-audit-review/references/language-checks.md)grepai search "function context for changed code" --json --compact
| Change Type | Priority Checks |
|---|---|
| Authentication/authorization | Auth bypass, privilege escalation |
| Input handling | Injection, XSS, path traversal |
| Cryptographic changes | Weak crypto, hardcoded secrets |
| Database operations | SQL injection, data exposure |
| External API calls | SSRF, header injection |
{
"mr_pr": {
"platform": "github",
"url": "https://github.com/owner/repo/pull/123",
"number": 123,
"title": "Add user authentication",
"author": "developer",
"source_branch": "feature/auth",
"target_branch": "main",
"state": "open"
},
"reviews": [
{
"file": "src/api/handlers.py",
"changes": {
"added_lines": [45, 46, 47],
"removed_lines": [42]
},
"reviews": [
{
"issue": "SQL Injection",
"code_snippet": "cursor.execute(f\"SELECT * FROM users WHERE id = {user_id}\")",
"reasoning": "Line 46 uses f-string for SQL query with unsanitized user_id",
"mitigation": "Use parameterized queries: cursor.execute(\"SELECT * FROM users WHERE id = %s\", (user_id,))",
"confidence": 0.95,
"cwe": "CWE-89",
"severity": "CRITICAL",
"line_number": 46
}
]
}
],
"summary": {
"files_changed": 3,
"additions": 25,
"deletions": 5,
"total_issues": 2,
"by_severity": {
"CRITICAL": 1,
"HIGH": 0,
"MEDIUM": 1,
"LOW": 0
},
"potential_fixes": [
"Removed insecure eval() in utils.py line 12"
]
}
}
See ../security-code-audit-review/references/ for:
language-checks.md - Security checks per languagecwe-reference.md - Severity levels and CWE IDsoutput-schema.md - JSON format validation| Error | Resolution |
|---|---|
| CLI not installed | Provide installation instructions |
| Not authenticated | Guide user through gh auth login or glab auth login |
| MR/PR not found | Verify URL and permissions |
| Empty diff | MR/PR may have no changes or be already merged |
npx claudepluginhub mfakbar127/agent-skills --plugin security-code-auditProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.