github/awesome-copilot/codeql
Claude Code and agent skill by github/awesome-copilot
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Comprehensive guide for setting up and configuring CodeQL code scanning via GitHub Actions workflows and the CodeQL CLI. This skill should be used when users need help with code scanning configuration, CodeQL workflow files, CodeQL CLI commands, SARIF output, security analysis setup, or troubleshooting CodeQL analysis.
Install
npx vskill@latest install github/awesome-copilot/codeqlSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as github/awesome-copilot/codeql.
CodeQL Code Scanning
This skill provides procedural guidance for configuring and running CodeQL code scanning — both through GitHub Actions workflows and the standalone CodeQL CLI.
When to Use This Skill
Use this skill when the request involves:
- Creating or customizing a
codeql.ymlGitHub Actions workflow - Choosing between default setup and advanced setup for code scanning
- Configuring CodeQL language matrix, build modes, or query suites
- Running CodeQL CLI locally (
codeql database create,database analyze,github upload-results) - Understanding or interpreting SARIF output from CodeQL
- Troubleshooting CodeQL analysis failures (build modes, compiled languages, runner requirements)
- Setting up CodeQL for monorepos with per-component scanning
- Configuring dependency caching, custom query packs, or model packs
Supported Languages
CodeQL supports the following language identifiers:
| Language | Identifier | Alternatives | |
|---|---|---|---|
| C/C++ | c-cpp | c, cpp | |
| C# | csharp | — | |
| Go | go | — | |
| Java/Kotlin | java-kotlin | java, kotlin | |
| JavaScript/TypeScript | javascript-typescript | javascript, typescript | |
| Python | python | — | |
| Ruby | ruby | — | |
| Rust | rust | — | |
| Swift | swift | — | |
| GitHub Actions | actions | — |
Alternative identifiers are equivalent to the standard identifier (e.g.,javascriptdoes not exclude TypeScript analysis).
Core Workflow — GitHub Actions
Step 1: Choose Setup Type
- Default setup — Enable from repository Settings → Advanced Security → CodeQL analysis. Best for getting started quickly. Uses
nonebuild mode for most languages. - Advanced setup — Create a
.github/workflows/codeql.ymlfile for full control over triggers, build modes, query suites, and matrix strategies.
To switch from default to advanced: disable default setup first, then commit the workflow file.
Step 2: Configure Workflow Triggers
Define when scanning runs:
push— scans on every push to specified branches; results appear in Security tabpull_request— scans PR merge commits; results appear as PR check annotationsschedule— periodic scans of the default branch (cron must exist on default branch)merge_group— add if repository uses merge queues
To skip scans for documentation-only PRs:
paths-ignorecontrols whether the workflow runs, not which files are analyzed.
Step 3: Configure Permissions
Set least-privilege permissions:
Step 4: Configure Language Matrix
Use a matrix strategy to analyze each language in parallel:
For compiled languages, set the appropriate build-mode:
none— no build required (supported for C/C++, C#, Java, Rust)autobuild— automatic build detectionmanual— custom build commands (advanced setup only)
For detailed per-language autobuild behavior and runner requirements, searchreferences/compiled-languages.md.
Step 5: Configure CodeQL Init and Analysis
Query suite options:
security-extended— default security queries plus additional coveragesecurity-and-quality— security plus code quality queries- Custom query packs via
packs:input (e.g.,codeql/javascript-queries:AlertSuppression.ql)
Dependency caching: Set dependency-caching: true on the init action to cache restored dependencies across runs.
Analysis category: Use category to distinguish SARIF results in monorepos (e.g., per-language, per-component).
Step 6: Monorepo Configuration
For monorepos with multiple components, use the category parameter to separate SARIF results:
To restrict analysis to specific directories, use a CodeQL configuration file (.github/codeql/codeql-config.yml):
Reference it in the workflow:
Step 7: Manual Build Steps (Compiled Languages)
If autobuild fails or custom build commands are needed:
Then add explicit build steps between init and analyze:
Core Workflow — CodeQL CLI
Step 1: Install the CodeQL CLI
Download the CodeQL bundle (includes CLI + precompiled queries):
Always use the CodeQL bundle, not a standalone CLI download. The bundle ensures query compatibility and provides precompiled queries for better performance.
Step 2: Create a CodeQL Database
For compiled languages, provide the build command via --command.
Step 3: Analyze the Database
Common query suites: <language>-code-scanning.qls, <language>-security-extended.qls, <language>-security-and-quality.qls.
Step 4: Upload Results to GitHub
Requires GITHUB_TOKEN environment variable with security-events: write permission.
CLI Server Mode
To avoid repeated JVM initialization when running multiple commands:
For detailed CLI command reference, searchreferences/cli-commands.md.
Alert Management
Severity Levels
Alerts have two severity dimensions:
- Standard severity:
Error,Warning,Note - Security severity:
Critical,High,Medium,Low(derived from CVSS scores; takes display precedence)
Copilot Autofix
GitHub Copilot Autofix generates fix suggestions for CodeQL alerts in pull requests automatically — no Copilot subscription required. Review suggestions carefully before committing.
Alert Triage in PRs
- Alerts appear as check annotations on changed lines
- Check fails by default for
error/critical/highseverity alerts - Configure merge protection rulesets to customize the threshold
- Dismiss false positives with a documented reason for audit trail
For detailed alert management guidance, searchreferences/alert-management.md.
Custom Queries and Packs
Using Custom Query Packs
Creating Custom Query Packs
Use the CodeQL CLI to create and publish packs:
CodeQL Configuration File
For advanced query and path configuration, create .github/codeql/codeql-config.yml:
Code Scanning Logs
Summary Metrics
Workflow logs include key metrics:
- Lines of code in codebase — baseline before extraction
- Lines extracted — including external libraries and auto-generated files
- Extraction errors/warnings — files that failed or produced warnings during extraction
Debug Logging
To enable detailed diagnostics:
- GitHub Actions: re-run the workflow with "Enable debug logging" checked
- CodeQL CLI: use
--verbosity=progress++and--logdir=codeql-logs
Troubleshooting
Common Issues
| Problem | Solution | |
|---|---|---|
| Workflow not triggering | Verify on: triggers match event; check paths/branches filters; ensure workflow exists on target branch | |
Resource not accessible error | Add security-events: write and contents: read permissions | |
| Autobuild failure | Switch to build-mode: manual and add explicit build commands | |
| No source code seen | Verify --source-root, build command, and language identifier | |
| C# compiler failure | Check for /p:EmitCompilerGeneratedFiles=true conflicts with .sqlproj or legacy projects | |
| Fewer lines scanned than expected | Switch from none to autobuild/manual; verify build compiles all source | |
| Kotlin in no-build mode | Disable and re-enable default setup to switch to autobuild | |
| Cache miss every run | Verify dependency-caching: true on init action | |
| Out of disk/memory | Use larger runners; reduce analysis scope via paths config; use build-mode: none | |
| SARIF upload fails | Ensure token has security-events: write; check 10 MB file size limit | |
| SARIF results exceed limits | Split across multiple uploads with different --sarif-category; reduce query scope | |
| Two CodeQL workflows | Disable default setup if using advanced setup, or remove old workflow file | |
| Slow analysis | Enable dependency caching; use --threads=0; reduce query suite scope |
For comprehensive troubleshooting with detailed solutions, searchreferences/troubleshooting.md.
Hardware Requirements (Self-Hosted Runners)
| Codebase Size | RAM | CPU | |
|---|---|---|---|
| Small (<100K LOC) | 8 GB+ | 2 cores | |
| Medium (100K–1M LOC) | 16 GB+ | 4–8 cores | |
| Large (>1M LOC) | 64 GB+ | 8 cores |
All sizes: SSD with ≥14 GB free disk space.
Action Versioning
Pin CodeQL actions to a specific major version:
For maximum security, pin to a full commit SHA instead of a version tag.
Reference Files
For detailed documentation, load the following reference files as needed:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/codeql/SKILL.md
Popularity
- Repository stars
- 33,040
- Repository forks
- 4,031
- 7-day trend score
- 52
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 8 months ago.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/github/awesome-copilot/codeql)