CodeQL is a static analysis framework that queries code as a database. Use when you need interprocedural analysis or complex data flow tracking.
View on GitHubtrailofbits/skills
testing-handbook-skills
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/trailofbits/skills/blob/main/plugins/testing-handbook-skills/skills/codeql/SKILL.md -a claude-code --skill codeqlInstallation paths:
.claude/skills/codeql/# CodeQL CodeQL is a powerful static analysis framework that allows developers and security researchers to query a codebase for specific code patterns. The CodeQL standard libraries implement support for both inter- and intraprocedural control flow and data flow analysis. However, the learning curve for writing custom queries is steep, and documentation for the CodeQL standard libraries is still scant. ## When to Use **Use CodeQL when:** - You need interprocedural control flow and data flow queries across the entire codebase - Fine-grained control over the abstract syntax tree, control flow graph, and data flow graph is required - You want to prevent introduction of known bugs and security vulnerabilities into the codebase - You have access to source code and third-party dependencies (and can build compiled languages) - The bug class requires complex analysis beyond single-file pattern matching **Consider alternatives when:** - Single-file pattern matching is sufficient → Consider Semgrep - You don't have access to source code or can't build the project - Analysis time is critical (complex queries may take a long time) - You need to analyze a closed-source repository without a GitHub Advanced Security license - The language is not supported by CodeQL ## Quick Reference | Task | Command | |------|---------| | Create database (C/C++) | `codeql database create codeql.db --language=cpp --command='make -j8'` | | Create database (Go) | `codeql database create codeql.db --language=go` | | Create database (Java/Kotlin) | `codeql database create codeql.db --language=java` | | Create database (JavaScript/TypeScript) | `codeql database create codeql.db --language=javascript` | | Create database (Python) | `codeql database create codeql.db --language=python` | | Analyze database | `codeql database analyze codeql.db --format=sarif-latest --output=results.sarif -- codeql/cpp-queries` | | List installed packs | `codeql resolve qlpacks` | | Download query pack | `codeql pack