alinaqi/maggy/cpg-analysis
- community
Checking that the SKILL.md file is still in the repository.
Deep code property graph analysis with Joern CPG (AST+CFG+PDG) and CodeQL for control flow, data flow, taint analysis, and security auditing
Install
npx vskill@latest install alinaqi/maggy/cpg-analysisSKILL.md
CPG Analysis Skill
Purpose: Deep code analysis beyond AST. Use Joern for full Code Property Graph (control flow, data flow, program dependencies) and CodeQL for interprocedural taint analysis and vulnerability detection.
These are opt-in tools. They require Docker/JVM (Joern) or CodeQL CLI. Use codebase-memory-mcp (Tier 1, always-on) for everyday navigation. Use these for deep analysis when Tier 1 is not enough.
Tier Selection Guide
Tier 2: Joern CPG (CodeBadger MCP)
When to Use Joern
| Scenario | Why Joern | Tier 1 Can't Do This | |
|---|---|---|---|
| Trace data flow through functions | Full DDG traversal | Tier 1 has no data flow | |
| Understanding control flow paths | CFG analysis with branch conditions | Tier 1 has no CFG | |
| Finding dead/unreachable code | PDG reachability analysis | Tier 1 only detects unused exports | |
| Complex refactoring impact | Cross-function dependency chains | Tier 1 limited to call graph | |
| Auditing third-party library usage | Deep call chain traversal | Tier 1 stops at import boundary | |
| Understanding exception flow | CFG includes throw/catch paths | Tier 1 ignores exceptions |
Key MCP Tools (Joern/CodeBadger)
| Tool | Purpose | Example Query | |
|---|---|---|---|
generate_cpg | Build CPG for project | First-time setup or after major changes | |
get_cpg_status | Check CPG build status | Verify CPG is ready before querying | |
run_cpgql_query | Run arbitrary CPGQL queries | cpg.method("login").callOut.code.l | |
get_cpgql_syntax_help | Query language reference | When unsure about query syntax | |
get_cfg | Control flow graph for a method | Understand execution paths in a function | |
list_methods | List all methods in project | Overview of available functions | |
get_method_source | Get source code of a method | Read specific function source | |
list_calls | List calls from/to a method | Caller/callee analysis | |
get_call_graph | Full call graph visualization | Understand call chains | |
get_type_definition | Type/class definitions | Understand type hierarchy |
Supported Languages (Joern)
Java, Scala, C/C++, Python, JavaScript, TypeScript, PHP, Ruby, Go, Kotlin, Swift, Lua
Not supported: Rust (use CodeQL for Rust)
MCP Configuration (Joern)
Prerequisites
- Docker (for Joern backend)
- Python 3.10+ (for MCP server)
- Install:
~/.claude/install-graph-tools.sh --joern
Common CPGQL Queries
Tier 3: CodeQL
When to Use CodeQL
| Scenario | Why CodeQL | Other Tiers Can't Do This | |
|---|---|---|---|
| Security audit before release | Interprocedural taint analysis | Joern has basic taint, CodeQL is deeper | |
| Reviewing auth/payment code | Data flow from source to sink | Cross-function, cross-file taint | |
| PR security review | Targeted vulnerability scan | Pre-built OWASP query packs | |
| Compliance checking | CWE/OWASP pattern matching | Curated security query suites | |
| Rust security analysis | Full Rust support | Joern doesn't support Rust |
Key MCP Tools (CodeQL)
| Tool | Purpose | |
|---|---|---|
run_query | Execute a CodeQL query against the database | |
find_definitions | Locate symbol definitions | |
find_references | Find all references to a symbol | |
get_results | Parse BQRS (Binary Query Result Sets) |
Supported Languages (CodeQL)
C/C++, C#, Go, Java, Kotlin, JavaScript, TypeScript, Python, Ruby, Swift, Rust
MCP Configuration (CodeQL)
Prerequisites
- CodeQL CLI (
brew install codeqlon macOS) - Install:
~/.claude/install-graph-tools.sh --codeql
Common CodeQL Patterns
Combined Workflow: Deep Analysis
When performing security review or complex refactoring, use all tiers:
Anti-Patterns
| Anti-Pattern | Do This Instead | |
|---|---|---|
| Using Joern/CodeQL for simple symbol lookup | Use Tier 1 search_graph (sub-ms vs seconds) | |
| Running full CPG build on every commit | Build CPG on-demand; use Tier 1 for continuous monitoring | |
Querying Joern without checking get_cpg_status | Always verify CPG is built and current before querying | |
| Running CodeQL without a specific security question | Have a hypothesis first; CodeQL queries are expensive | |
| Ignoring Tier 1 blast radius before deep analysis | Always scope with Tier 1 first, then go deep on flagged areas | |
| Using CodeQL for non-security structural queries | Use Joern CPGQL for structural/flow queries; CodeQL for security |
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/cpg-analysis/SKILL.md
Popularity
- Repository stars
- 701
- Repository forks
- 55
- 7-day trend score
- 33
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
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/alinaqi/maggy/cpg-analysis)