Skip to main content
skill CX Codex

codeql-expert — Claude Code skill: what it does, how to install

The codeql-expert skill guides CodeQL database setup, custom query writing, and vulnerability scans. Use it for SAST tasks, taint tracking, and GitHub security workflows.

Apache-2.0 174 installs ★ 45 updated 2026-10-12

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add personamanagmentlayer/pcl --skill codeql-expert -a claude-code
Open on GitHub

What codeql-expert does

codeql-expert covers a CodeQL workflow from extracting source code into a database to reviewing findings. It helps build queries for SQL injection, cross-site scripting, hardcoded credentials, and custom taint flows. The listed language coverage includes C/C++, C#, Go, Java, JavaScript/TypeScript, Python, and Ruby.

The skill includes patterns for running built-in and custom queries, decoding BQRS output to CSV, and wiring analysis into GitHub Actions. It also explains CodeQL query structure and security-focused result formats. Java database creation uses mvn clean package, so the build step must be available for that example to run.

It can be used with Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. Its declared tools cover reading, writing, editing, plus codeql and gh shell commands.

What it helps with

  • build a CodeQL database for a repository
  • write a query that detects SQL injection
  • trace user input to dangerous operations
  • find hardcoded credentials in source code
  • add CodeQL analysis to GitHub Actions

Example prompts for the agent

  • Create a CodeQL database for this JavaScript project and run a security scan.
  • Write a CodeQL query that traces remote input into exec, eval, or system.
  • Analyze my-db, save the SARIF report as results.sarif, and explain the findings.

How to install codeql-expert

1Skills CLI (Vercel)

npx skills add personamanagmentlayer/pcl --skill codeql-expert -a claude-code

2Manually: put the files in place

~/.claude/skills/codeql-expert/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/codeql-expert/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about codeql-expert

How do I install codeql-expert in Claude Code?

Run npx skills add personamanagmentlayer/pcl --skill codeql-expert -a claude-code. Then use the skill from ~/.claude/skills/codeql-expert/SKILL.md.

What does codeql-expert do?

It guides CodeQL database creation, QL query development, and static security analysis. Its examples cover vulnerability queries, taint tracking, result decoding, and GitHub Actions integration.

Which languages does codeql-expert cover?

The skill lists C/C++, C#, Go, Java, JavaScript/TypeScript, Python, and Ruby. Its Java database example runs with mvn clean package.

Source text

SKILL.md · Apache-2.0
---
name: codeql-expert
version: 1.1.0
description: >-
  Expert-level CodeQL for static analysis, vulnerability detection, and security code
  scanning. Use when the user mentions static analysis, SAST, vulnerability detection, or
  github security, or when the task involves writing CodeQL queries, building a CodeQL
  database, taint tracking, or scanning for injection and hardcoded credentials.
category: security
tags: [codeql, static-analysis, sast, vulnerability-detection, github-security]
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash(codeql:*, gh:*)
---

# CodeQL Expert

Expert guidance for CodeQL static analysis, custom query development, vulnerability detection, and integration with CI/CD pipelines.

## Core Concepts

### CodeQL Overview

- Semantic code analysis engine
- Treats code as data (queryable database)
- Supports C/C++, C#, Go, Java, JavaScript/TypeScript, Python, Ruby
- Powers GitHub Code Scanning
- Custom query development with QL language

### CodeQL Workflow

1. Extract code to database
2. Write QL queries
3. Run analysis
4. Review results
5. Fix vulnerabilities
6. Integrate into CI/CD

### Query Types

- Security queries (vulnerabilities)
- Code quality queries (bugs, code smells)
- Compliance queries (coding standards)
- Custom queries (org-specific patterns)

## Installation & Setup

```bash
# Download CodeQL CLI
wget https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql-linux64.zip
unzip codeql-linux64.zip
export PATH="$PATH:/path/to/codeql"

# Clone CodeQL queries
git clone https://github.com/github/codeql.git codeql-repo

# Verify
codeql --version
```

### Create Database

```bash
# JavaScript/TypeScript
codeql database create my-js-db --language=javascript

# Java (requires build)
codeql database create my-java-db \
  --language=java \
  --command="mvn clean package"

# Python
codeql database create my-python-db --language=python

# Multiple languages
codeql database create my-db --db-cluster --language=javascript,python
```

## Writing CodeQL Queries

### Basic Query Structure

```ql
/**
 * @name SQL Injection
 * @description Detects SQL injection vulnerabilities
 * @kind path-problem
 * @problem.severity error
 * @security-severity 9.8
 * @precision high
 * @id js/sql-injection
 * @tags security external/cwe/cwe-089
 */

import javascript
import semmle.javascript.security.dataflow.SqlInjectionQuery
import DataFlow::PathGraph

from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
where cfg.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
  "SQL query depends on $@.", source.getNode(), "user input"
```

### Find XSS Vulnerabilities

```ql
/**
 * @name Cross-site scripting
 * @kind path-problem
 */

import javascript
import semmle.javascript.security.dataflow.DomBasedXssQuery
import DataFlow::PathGraph

from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
where cfg.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
  "XSS vulnerability due to $@.", source.getNode(), "user input"
```

### Find Hardcoded Credentials

```ql
/**
 * @name Hardcoded credentials
 * @kind problem
 */

import javascript

from StringLiteral str, Variable v
where
  v.getAnAssignedExpr() = str and
  (
    v.getName().toLowerCase().matches("%password%") or
    v.getName().toLowerCase().matches("%apikey%") or
    v.getName().toLowerCase().matches("%secret%")
  ) and
  str.getValue().length() > 8 and
  not str.getValue().matches("TODO%")
select str, "Hardcoded credential: " + v.getName()
```

### Custom Taint Tracking

```ql
/**
 * @name Custom taint tracking
 */

import javascript
import semmle.javascript.dataflow.DataFlow

class CustomTaintTracking extends TaintTracking::Configuration {
  CustomTaintTracking() { this = "CustomTaintTracking" }

  override predicate isSource(DataFlow::Node source) {
    source instanceof RemoteFlowSource
  }

  override predicate isSink(DataFlow::Node sink) {
    exists(CallExpr call |
      call.getCalleeName() in ["exec", "eval", "system"]
    |
      sink.asExpr() = call.getAnArgument()
    )
  }

  override predicate isSanitizer(DataFlow::Node node) {
    node = DataFlow::BarrierGuard<StringOps::Validation>::getABarrierNode()
  }
}

from CustomTaintTracking cfg, DataFlow::PathNode source, DataFlow::PathNode sink
where cfg.hasFlowPath(source, sink)
select sink.getNode(), source, sink,
  "Dangerous operation with $@.", source.getNode(), "user input"
```

## Running CodeQL

```bash
# Analyze database
codeql database analyze my-db \
  --format=sarif-latest \
  --output=results.sarif \
  codeql/javascript-queries:codeql-suites/javascript-security-extended.qls

# Run custom query
codeql query run my-query.ql --database=my-db --output=results.bqrs

# Convert to CSV
codeql bqrs decode results.bqrs --format=csv --output=results.csv
```

### GitHub Actions Integration

```yaml
name: CodeQL Analysis

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  analyze:
    runs-on: ubuntu-latest
    permissions:
      security-events: write

    strategy:
      matrix:
        language: ['javascript', 'python']

    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v2
        with:
          languages: ${{ matrix.language }}
          queries: +security-extended

      - name: Autobuild
        uses: github/codeql-action/autobuild@v2

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v2
```

## Best Practices

- Start with built-in queries
- Test on small codebases first
- Optimize for performance
- Add clear documentation
- Tune to reduce false positives
- Integrate into CI/CD early

## Resources

- CodeQL Docs: https://codeql.github.com/docs/
- Queries: https://github.com/github/codeql
- Code Scanning: https://docs.github.com/en/code-security/code-scanning

© personamanagmentlayer · Apache-2.0 · personamanagmentlayer/pcl

Similar skills

All skills for Security →

From the same set104

The whole set →
rust-expert rust-expert — a skill that turns a coding agent into a Rust reviewer: borrowing rules, lifetimes, async tasks, error types. Useful when the borrow checker blocks a refactor. CX Codex +1 179installs design-expert design-expert equips your agent with system design patterns, distributed architecture principles, and Python reference code. CX Codex +1 178installs airflow-expert airflow-expert guides Apache Airflow DAG design, task dependencies, operators, sensors, and scheduling. Use it when building or reviewing data workflows. CX Codex +1 174installs cloudflare-expert cloudflare-expert is a Claude Code skill for Cloudflare Workers, CDN, edge computing, and security services. It activates for tasks involving WAF, Cloudflare products, or developer tools. CX Codex +1 174installs skill-creator-expert skill-creator-expert guides you through designing, writing and checking PCL skills, from domain analysis to a frontmatter template and a quality checklist. CX Codex +1 173installs django-expert django-expert guides full-stack Django development covering ORM models, views, forms, authentication, and Django REST Framework APIs. CX Codex +1 172installs graphql-expert graphql-expert is a Claude Code skill for GraphQL schema design, resolvers, and subscriptions, with guidance on Apollo federation and N+1 queries. CX Codex +1 169installs data-mesh-expert data-mesh-expert walks the agent through data mesh work: domains own their data, products ship with contracts, governance is federated and the platform serves itself. CX Codex +1 168installs

Project sponsors

Companies that keep this analytics open