MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Codeql

Codeql是一款productivity方向的AI技能,核心价值是Comprehensive guide for setting up and configuring CodeQL code scanning via GitHub Actions workflows and the CodeQL CLI,可用于解决开发者在productivity领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Comprehensive guide for setting up and configuring CodeQL code scanning via GitHub Actions workflows and the CodeQL CLI. This skill should be used when users need help with code scanning configuration

Last verified on: 2026-05-30
mkdir -p ./skills/codeql && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/codeql/SKILL.md -o ./skills/codeql/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# CodeQL Code Scanning


This skill provides procedural guidance for configuring and running CodeQL code scanning — both through GitHub Actions workflows and the standalone CodeQL CLI.


When to Use This Skill


Use this skill when the request involves:


- Creating or customizing a `codeql.yml` GitHub Actions workflow

- Choosing between default setup and advanced setup for code scanning

- Configuring CodeQL language matrix, build modes, or query suites

- Running CodeQL CLI locally (`codeql database create`, `database analyze`, `github upload-results`)

- Understanding or interpreting SARIF output from CodeQL

- Troubleshooting CodeQL analysis failures (build modes, compiled languages, runner requirements)

- Setting up CodeQL for monorepos with per-component scanning

- Configuring dependency caching, custom query packs, or model packs


Supported Languages


CodeQL supports the following language identifiers:


| Language | Identifier | Alternatives |

|---|---|---|

| C/C++ | `c-cpp` | `c`, `cpp` |

| C# | `csharp` | — |

| Go | `go` | — |

| Java/Kotlin | `java-kotlin` | `java`, `kotlin` |

| JavaScript/TypeScript | `javascript-typescript` | `javascript`, `typescript` |

| Python | `python` | — |

| Ruby | `ruby` | — |

| Rust | `rust` | — |

| Swift | `swift` | — |

| GitHub Actions | `actions` | — |


> Alternative identifiers are equivalent to the standard identifier (e.g., `javascript` does not exclude TypeScript analysis).


Core Workflow — GitHub Actions


Step 1: Choose Setup Type


- **Default setup** — Enable from repository Settings → Advanced Security → CodeQL analysis. Best for getting started quickly. Uses `none` build mode for most languages.

- **Advanced setup** — Create a `.github/workflows/codeql.yml` file for full control over triggers, build modes, query suites, and matrix strategies.


To switch from default to advanced: disable default setup first, then commit the workflow file.


Step 2: Configure Workflow Triggers


Define when scanning runs:


yaml
on:
  push:
    branches: [main, protected]
  pull_request:
    branches: [main]
  schedule:
    - cron: '30 6 * * 1'  # Weekly Monday 6:30 UTC

- `push` — scans on every push to specified branches; results appear in Security tab

- `pull_request` — scans PR merge commits; results appear as PR check annotations

- `schedule` — periodic scans of the default branch (cron must exist on default branch)

- `merge_group` — add if repository uses merge queues


To skip scans for documentation-only PRs:


yaml
on:
  pull_request:
    paths-ignore:
      - '**/*.md'
      - '**/*.txt'

> `paths-ignore` controls whether the workflow runs, not which files are analyzed.


Step 3: Configure Permissions


Set least-privilege permissions:


yaml
permissions:
  security-events: write   # Required to upload SARIF results
  contents: read            # Required to checkout code
  actions: read             # Required for private repos using codeql-action

Step 4: Configure Language Matrix


Use a matrix strategy to analyze each language in parallel:


yaml
jobs:
  analyze:
    name: Analyze (${{ matrix.language }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - language: javascript-typescript
            build-mode: none
          - language: python
            build-mode: none

For compiled languages, set the appropriate `build-mode`:

- `none` — no build required (supported for C/C++, C#, Java, Rust)

- `autobuild` — automatic build detection

- `manual` — custom build commands (advanced setup only)


> For detailed per-language autobuild behavior and runner requirements, search `references/compiled-languages.md`.


Step 5: Configure CodeQL Init and Analysis


yaml
steps:
  - name: Checkout repository
    uses: actions/checkout@v4

  - name: Initialize CodeQL
    uses: github/codeql-action/init@v4
    with:
      languages: ${{ matrix.language }}
      build-mode: ${{ matrix.build-mode }}
      queri

🎯 Best For

  • UI designers
  • Product designers
  • Claude users
  • GitHub Copilot users
  • Knowledge workers

💡 Use Cases

  • Generating component mockups
  • Creating design system tokens
  • Using Codeql in daily workflow
  • Automating repetitive productivity tasks

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Codeql to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

Does this work with Figma?

Some design skills integrate with Figma plugins. Check the Works With section for supported tools.

How do I install Codeql?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/codeql/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping usability testing

AI-generated designs should be validated with real users before development.

Not reading the full skill

Skills contain important context and edge cases beyond the quick start.

🔗 Related Skills