codeql
Scans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis. Triggers on "run codeql", "codeql scan", "codeql analysis", "build codeql database", or "find vulnerabilities with codeql". Supports "run all" (security-and-quality + security-experimental suites) and "important only" (high-precision security findings) scan modes. Also handles creating data extension models and processing CodeQL SARIF output.
Security Assessment
Detected risks:
About codeql
The CodeQL skill provides automated security scanning for codebases by leveraging CodeQL's interprocedural data flow and taint tracking analysis. It is designed to detect potential security vulnerabilities and weaknesses in multiple programming languages, including Python, JavaScript/TypeScript, Go, Java/Kotlin, C/C++, C#, Ruby, and Swift. By building a CodeQL database and running queries against it, this skill helps developers and security engineers identify high-risk code patterns and areas susceptible to exploitation, reducing the likelihood of security incidents before deployment.
This skill supports several key capabilities, including executing comprehensive scans using either 'run all' or 'important only' modes. It handles the creation of custom data extension models to catch vulnerabilities that standard queries might miss, and it ensures robust database quality through assessments of file counts, extraction completeness, and error checks. Additionally, it processes CodeQL SARIF output to produce organized results and maintains a structured output directory containing logs, databases, diagnostics, extensions, and final results. The skill also provides guidance for platform-specific considerations, such as macOS Apple Silicon workarounds, and enforces step-by-step workflow execution to ensure accurate and complete analysis.
CodeQL is particularly suited for security teams, developers, and DevSecOps practitioners who need to integrate automated security analysis into their development pipelines. Typical use cases include scanning applications before deployment, auditing third-party libraries for vulnerabilities, and maintaining high-security standards in enterprise codebases. Its structured approach and support for multiple languages make it versatile for projects ranging from small open-source repositories to large-scale enterprise systems, providing actionable insights to improve code security and quality.
FAQ
Which programming languages are supported by the CodeQL skill?
The skill supports Python, JavaScript/TypeScript, Go, Java/Kotlin, C/C++, C#, Ruby, and Swift.
How do I specify the output directory for scan results?
You can specify an output directory in your prompt. If not specified, the skill defaults to './static_analysis_codeql_1' and increments if the directory already exists. The directory is created automatically before any workflow executes.
What does 'important only' scan mode do?
'Important only' mode runs high-precision security queries to identify the most critical vulnerabilities, filtering out less significant findings.
Why might a scan produce zero findings?
Zero findings may indicate issues such as poor database quality, missing data extension models, incorrect query packs, or suite filtering. Investigate the database and workflow steps rather than assuming the code is vulnerability-free.
Are there platform-specific considerations for running CodeQL?
Yes, on macOS Apple Silicon, exit code 137 can occur due to architecture mismatches (arm64e/arm64). Using Homebrew arm64 tools or Rosetta can resolve these issues before changing build modes.
All Files
16 filesInstall codeql
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
trailofbits/skills