create-codeql-query-unit-test-csharp

Generate and validate CodeQL unit tests for C# queries.

30|3|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/advanced-security/codeql-development-mcp-server --skill create-codeql-query-unit-test-csharp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-codeql-query-unit-test-csharp
Source: https://github.com/advanced-security/codeql-development-mcp-server/tree/main/.github/skills/create-codeql-query-unit-test-csharp
Command: npx skills add https://github.com/advanced-security/codeql-development-mcp-server --skill create-codeql-query-unit-test-csharp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill reduces the effort required to design, implement, and validate CodeQL unit tests for C# queries, accelerating secure query development and maintaining coverage.

Core Features & Use Cases

  • Guided test scaffolding for C# CodeQL queries
  • Structured test layouts for query packs including Example.cs, {QueryName}.qlref, and .expected
  • MCP-aligned testing workflow for extraction, execution, and validation within the MCP server

Quick Start

Create a new C# CodeQL test package under your query pack's test directory following the described structure, then extract and run the tests to validate query behavior.

Frequently Asked Questions about create-codeql-query-unit-test-csharp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate unit tests for C# CodeQL queries?

To generate unit tests for C# CodeQL queries, use guided test scaffolding to create structured test layouts within your query pack's test directory, including Example.cs, .qlref, and .expected files.

What is the standard file structure for a CodeQL query unit test?

The standard CodeQL query unit test structure requires an Example.cs file containing test code, a {QueryName}.qlref file linking to the query, and a .expected file defining the expected results.

How does test-driven development work with CodeQL queries?

Test-driven development with CodeQL queries involves creating example C# code patterns and expected result files first, then validating query behavior by extracting and executing tests through MCP server tooling.

Can I validate multiple code patterns in a single CodeQL test package?

Yes, you can validate multiple code patterns in a single CodeQL test package by extending test coverage across different scenarios, organizing them with reference linking and expected result files.

Does the MCP server support CodeQL database extraction and test execution?

Yes, the MCP server supports CodeQL database extraction and test execution by providing an MCP-aligned testing workflow that integrates directly with tooling to validate C# query behavior end-to-end.