gh-code-scanning
FreeRuns bundled scriptsNot checkedRetrieves GitHub code scanning alerts and groups them by tool and rule ID using the gh CLI
by microsoft★ 1,654 GitHub starsAbout this skill
GitHub Code Scanning Skill
Overview
GitHub code scanning alerts are produced by static analysis tools such as CodeQL and Scorecard and surfaced in the GitHub Security tab. The GitHub Security tab is not accessible through the default MCP toolset, so this skill provides scripts for all read operations.
Prerequisites
| Requirement | Details |
|---|---|
pwsh |
PowerShell 7+; install from https://learn.microsoft.com/powershell |
gh CLI |
Installed and on PATH; install from https://cli.github.com |
| Auth | Run gh auth login or set GH_TOKEN; requires security_events scope |
| Scope | security_events for private repos; public_repo for public-only |
The repo scope also satisfies security_events. The gh CLI handles authentication automatically; no explicit token passing is needed in commands.
Get-CodeScanningAlerts.ps1 validates both prerequisites at startup and aborts with a targeted error message if either check fails.
Quick Start
Run this command to get a grouped summary of open code scanning alerts, sorted by frequency. This is the recommended first command when triaging a repository's code scanning posture.
pwsh scripts/Get-CodeScanningAlerts.ps1 -Owner "{owner}" -Repo "{repo}" -OutputFormat Json
This returns a JSON array of alert groups sorted by occurrence count, descending. Always use -OutputFormat Json when consuming results programmatically.
Parameters Reference
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
-Owner |
String | Yes | GitHub organization or user that owns the repository | |
-Repo |
String | Yes | Repository name | |
-OutputFormat |
String | No | Table | Output format: agents must always use Json for programmatic consumption; GroupedJson is accepted as an alias for Json |
-Branch |
String | No | main |
Branch to scope alert results |
-IncludeDismissedStillDetected |
Switch | No | Also report dismissed alerts that are still detected on the branch, as groups with Kind set to dismissed-still-detected |
These parameters apply to
Get-CodeScanningAlerts.ps1. For bash script flags including-s {severity}and-d, see the Script Reference section below.
Script Reference
Get-CodeScanningAlerts.ps1
Groups and sorts open code scanning alerts by occurrence count, descending.
# JSON output for programmatic consumption
pwsh scripts/Get-CodeScanningAlerts.ps1 -Owner "{owner}" -Repo "{repo}" -OutputFormat Json
# Scope to a specific branch
pwsh scripts/Get-CodeScanningAlerts.ps1 -Owner "{owner}" -Repo "{repo}" -Branch "{branch}" -OutputFormat Json
# Also report dismissed alerts that are still detected
pwsh scripts/Get-CodeScanningAlerts.ps1 -Owner "{owner}" -Repo "{repo}" -OutputFormat Json -IncludeDismissedStillDetected
get-code-scanning-alerts.sh
Groups and sorts open code scanning alerts by occurrence count, descending. Requires jq.
# JSON output for programmatic consumption
bash scripts/get-code-scanning-alerts.sh -o "{owner}" -r "{repo}"
# Scope to a specific branch
bash scripts/get-code-scanning-alerts.sh -o "{owner}" -r "{repo}" -b "{branch}"
# Filter by severity
bash scripts/get-code-scanning-alerts.sh -o "{owner}" -r "{repo}" -s critical
# Also report dismissed alerts that are still detected
bash scripts/get-code-scanning-alerts.sh -o "{owner}" -r "{repo}" -d
When to Use This Skill
Use this skill when the task involves reading code scanning alerts only. Get-CodeScanningAlerts.ps1 is the only supported method for listing and grouping code scanning alerts. gh api must not be used as a fallback for listing or grouping.
When the GitHub MCP server is configured with the code_security toolset, read-only access to code scanning alerts is available without gh api. Enable via toolsets: all or explicit toolset configuration.
Code Scanning Alerts
List and group open alerts
Always run with -OutputFormat Json. Parse the JSON output and present it to the user.
pwsh scripts/Get-CodeScanningAlerts.ps
Install gh-code-scanning in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the gh-code-scanning skill do?
Retrieves GitHub code scanning alerts and groups them by tool and rule ID using the gh CLI
How do I install the gh-code-scanning skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the gh-code-scanning skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic