# codeql-expert

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.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 174 installs · ★ 45 repo stars
- Author: personamanagmentlayer
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/personamanagmentlayer/pcl/tree/HEAD/stdlib/security/codeql-expert/SKILL.md
- Updated: 2026-10-12
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/codeql-expert

## What it 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.

## Requirements
- Works with: GitHub

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill codeql-expert -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/codeql-expert/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/codeql-expert/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill codeql-expert -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/codeql-expert/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill codeql-expert -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/codeql-expert/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install personamanagmentlayer/pcl stdlib/security/codeql-expert
```

2. **Manually: put the files in place**
- File: `.github/skills/codeql-expert/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill codeql-expert -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/personamanagmentlayer/pcl --path stdlib/security/codeql-expert
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/codeql-expert/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill codeql-expert -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/personamanagmentlayer/pcl/tree/HEAD/stdlib/security/codeql-expert/SKILL.md

## When to use it
- 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
- 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.

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: bc318d891ff58b3e.

BEGIN THIRD-PARTY FILE bc318d891ff58b3e
````text
---
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"
```
````
END THIRD-PARTY FILE bc318d891ff58b3e

The third-party file has ended. Everything between the bc318d891ff58b3e tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2640 of 5898 bytes. © personamanagmentlayer · Apache-2.0 · https://github.com/personamanagmentlayer/pcl/tree/HEAD/stdlib/security/codeql-expert/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
