microsoft/vscode-cmake-tools/presets-vs-kits
Claude Code and agent skill by microsoft/vscode-cmake-tools
- vendor
Checking that the SKILL.md file is still in the repository.
Use when writing or reviewing code that must work in both CMake Presets and Kits/Variants modes. Covers configure, build, test, environment, and generator paths. Triggers: "presets vs kits", "useCMakePresets", "works in both modes".
Install
npx vskill@latest install microsoft/vscode-cmake-tools/presets-vs-kitsSKILL.md
The same SKILL.md was published earlier as microsoft/vscode-cmake-tools/presets-vs-kits.
Presets Mode vs Kits/Variants Mode
Guide for writing code that works correctly in both operating modes of CMake Tools. Any shared code path (configure, build, test, environment, targets) must handle both modes.
The two modes
CMake Tools operates in one of two mutually exclusive modes per project folder:
| Presets mode | Kits/variants mode | ||
|---|---|---|---|
| Source of truth | CMakePresets.json / CMakeUserPresets.json | Kit selection + variant settings | |
| When active | cmake.useCMakePresets is 'always', or 'auto' and preset files exist | cmake.useCMakePresets is 'never', or 'auto' and no preset files exist | |
| Runtime check | CMakeProject.useCMakePresets === true | CMakeProject.useCMakePresets === false |
How the mode is determined
The resolved boolean is stored in CMakeProject._useCMakePresets and exposed via the useCMakePresets getter.
When you MUST handle both modes
Any shared code path that touches configure, build, test, environment setup, or target resolution must branch on the mode. Omitting the check for one mode is a latent bug.
The canonical branching pattern
Another real example — default build targets
Canonical data access — Presets mode
Merged preset tree
Use PresetsController (in src/presets/presetsController.ts) to access the merged, expanded preset tree. Never re-parse CMakePresets.json or CMakeUserPresets.json directly — the controller handles include chaining, expansion, and file watching.
Active presets on CMakeProject
Preset types
All preset interfaces are defined in src/presets/preset.ts. Key types include ConfigurePreset, BuildPreset, TestPreset, PackagePreset, WorkflowPreset.
CMake executable override
In presets mode, the configure preset can override the CMake path:
Canonical data access — Kits/variants mode
Active kit
Kit environment
This merges compiler paths, VS Developer Environment (on Windows via vcvarsall.bat), and any custom environmentVariables defined on the kit.
SpecialKits — always check before treating a kit as a real compiler
These sentinel values appear in the kit list as UI actions. Before using kit.compilers, kit.toolchainFile, or kit.preferredGenerator, check:
Kit interface
Variant handling
Variants (src/kits/variant.ts) provide build type and other CMake variable overrides in kits mode. The VariantManager is only initialized when not using presets:
Generator handling in both modes
Multi-config vs single-config
Always check the generator before any build-type logic:
| Generator type | Examples | Build type mechanism | |
|---|---|---|---|
| Single-config | Ninja, Unix Makefiles | CMAKE_BUILD_TYPE set at configure time | |
| Multi-config | Visual Studio, Xcode, Ninja Multi-Config | --config <type> passed at build time |
Exception: cmake.setBuildTypeOnMultiConfig
When this setting is true, CMAKE_BUILD_TYPE is also set at configure time for multi-config generators (used by some CMake scripts that read it). See src/drivers/cmakeDriver.ts.
How it shows up in both modes
- Presets mode: The generator is embedded in
configurePreset.generator. The preset may also setCMAKE_BUILD_TYPEincacheVariablesor useconfigurationin the build preset. - Kits mode: The generator comes from
Kit.preferredGenerator.nameor is auto-detected. Build type comes from the active variant.
Common mistakes
1. Testing only one mode
If you add or change behavior in a shared code path, you must verify it works in both presets mode and kits/variants mode. Many bugs ship because the developer only tested with presets (or only with kits).
2. Assuming single-config generator
Never assume CMAKE_BUILD_TYPE is the way to set the build configuration. Always check isMultiConfGeneratorFast() first.
3. Reading preset files directly
4. Not checking for SpecialKits sentinel values
5. Forgetting the driver instance guard
In kits mode, no driver is created without a kit:
Always handle null driver returns in calling code.
Testing checklist
- [ ] Verified in presets mode (create a
CMakePresets.jsonwith configure + build presets) - [ ] Verified in kits/variants mode (remove preset files or set
cmake.useCMakePresets: "never") - [ ] Verified with a single-config generator (Ninja or Unix Makefiles)
- [ ] Verified with a multi-config generator (Visual Studio, Ninja Multi-Config, or Xcode)
- [ ]
SpecialKitssentinel values handled (no crash on__unspec__kit) - [ ]
nulldriver /nullpreset /nullkit cases handled gracefully - [ ] Windows, macOS, and Linux path differences considered
See also: `.github/copilot-instructions.md` for project-wide conventions.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 8 Jun 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/presets-vs-kits/SKILL.md
Popularity
- Repository stars
- 1,681
- Repository forks
- 530
- 7-day trend score
- 37
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Jul 2026, 4 months ago.
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/microsoft/vscode-cmake-tools/presets-vs-kits)