binlog-generation — скилл для Claude Code: что делает и как установить
Скилл заставляет агента добавлять /bl:{} к каждой команде MSBuild, чтобы после сборки остался файл .binlog с полной трассировкой. Пригодится, когда сборка падает или тормозит.
npx skills add dotnet/skills --skill binlog-generation -a claude-codeЧто делает binlog-generation
Скилл дописывает флаг /bl:{} к любой команде, которая вызывает MSBuild: dotnet build, test, pack, publish, restore и прямой вызов msbuild. После прогона рядом остаётся .binlog с полной картиной того, что делал движок сборки. Агент делает это сам при каждом запуске — напоминать не нужно.
Плейсхолдер {} MSBuild заменяет на уникальный идентификатор, поэтому две сборки подряд не затрут один и тот же файл. Работает это на MSBuild 17.8+ и .NET 8 SDK и новее — на более старых версиях {} не раскроется, и имя файла придётся выбирать вручную: скилл советует глянуть уже лежащие в каталоге *.binlog и взять свободный номер. В PowerShell переключатель берут в кавычки целиком, вот так: dotnet build '-bl:{}', иначе оболочка разберёт фигурные скобки по-своему.
После сборки агент проверяет, что файл действительно появился: сборка, упавшая до старта MSBuild (скажем, из-за кривого аргумента), binlog не оставит. Отдельным пунктом идёт git clean -fdx — без -e "*.binlog" он сносит историю сборок, а вместе с ней и возможность сравнить «до» и «после». Читают эти логи скиллы binlog-failure-analysis и build-perf-diagnostics, для них binlog — входные данные.
Какие задачи решает
- оставить binlog от упавшей сборки, не перезапуская её
- собрать Debug и Release, не перезаписав логи
- скормить трассировку сборки в
binlog-failure-analysis - сохранить историю сборок при
git clean -fdx
Примеры запросов агенту
- Собери решение с
/bl:{}, чтобы остался binlog - Прогони
dotnet test '-bl:{}'в PowerShell и покажи, куда лёг файл - Пересобери в Release с
/bl:{}и сравни с прошлым binlog
Как установить binlog-generation
1Через Skills CLI (Vercel)
npx skills add dotnet/skills --skill binlog-generation -a claude-code2Вручную: положить файлы
~/.claude/skills/binlog-generation/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/binlog-generation/
1Через Skills CLI (Vercel)
npx skills add dotnet/skills --skill binlog-generation -a codex2Вручную: положить файлы
.agents/skills/binlog-generation/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dotnet/skills --skill binlog-generation -a cursor2Вручную: положить файлы
.cursor/skills/binlog-generation/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dotnet/skills binlog-generation2Вручную: положить файлы
.github/skills/binlog-generation/SKILL.md1Через Skills CLI (Vercel)
npx skills add dotnet/skills --skill binlog-generation -a gemini-cli2Командой платформы
gemini skills install https://github.com/dotnet/skills --path plugins/dotnet-msbuild/skills/binlog-generationВручную: положить файлы
.devin/skills/binlog-generation/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add dotnet/skills --skill binlog-generation -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о binlog-generation
Как установить binlog-generation в Claude Code?
Выполни npx skills add dotnet/skills --skill binlog-generation -a claude-code. Скилл окажется в ~/.claude/skills/binlog-generation/SKILL.md.
Что делает binlog-generation?
Добавляет /bl:{} к командам dotnet build, test, pack, publish, restore и к msbuild, чтобы после сборки остался .binlog с полной трассировкой выполнения. По этому файлу потом разбирают ошибки сборки или просадки по времени.
На какой версии MSBuild работает плейсхолдер {}?
Нужен MSBuild 17.8+ или .NET 8 SDK и новее. Если версия старше, имя файла задают самому — свериться с уже существующими *.binlog и взять свободное.
Исходный текст
SKILL.md · MIT
---
name: binlog-generation
description: "Generate MSBuild binary logs (binlogs) for build diagnostics and analysis. USE FOR: adding /bl:{} to any dotnet build, test, pack, publish, or restore command to capture a full build execution trace, prerequisite for binlog-failure-analysis and build-perf-diagnostics skills, enabling post-build investigation of errors or performance. Requires MSBuild 17.8+ / .NET 8 SDK+ for {} placeholder; PowerShell must quote the complete switch as '-bl:{}'. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead), binlog MCP startup failures (use troubleshoot-binlog-mcp)."
license: MIT
---
# Generate Binary Logs
**Pass the `/bl` switch when running any MSBuild-based command.** This is a non-negotiable requirement for all .NET builds.
## Commands That Require /bl
You MUST add the `/bl:{}` flag to:
- `dotnet build`
- `dotnet test`
- `dotnet pack`
- `dotnet publish`
- `dotnet restore`
- `msbuild` or `msbuild.exe`
- Any other command that invokes MSBuild
## Preferred: Use `{}` for Automatic Unique Names
> **Note:** The `{}` placeholder requires MSBuild 17.8+ / .NET 8 SDK or later.
The `{}` placeholder in the binlog filename is replaced by MSBuild with a unique identifier, guaranteeing no two builds ever overwrite each other — without needing to track or check existing files.
```bash
# Every invocation produces a distinct file automatically
dotnet build /bl:{}
dotnet test /bl:{}
dotnet build --configuration Release /bl:{}
```
**PowerShell requires quoting the complete switch:**
```powershell
# Keep the literal {} placeholder in one argument
dotnet build '-bl:{}'
dotnet test '-bl:{}'
```
## Why This Matters
1. **Unique names prevent overwrites** - You can always go back and analyze previous builds
2. **Failure analysis** - When a build fails, the binlog is already there for immediate analysis
3. **Comparison** - You can compare builds before and after changes
4. **No re-running builds** - You never need to re-run a failed build just to generate a binlog
## Examples
```bash
# ✅ CORRECT - {} generates a unique name automatically (bash/cmd)
dotnet build /bl:{}
dotnet test /bl:{}
# ✅ CORRECT - quote the complete PowerShell argument
dotnet build '-bl:{}'
dotnet test '-bl:{}'
# ❌ WRONG - Missing /bl flag entirely
dotnet build
dotnet test
# ❌ WRONG - No filename (overwrites the same msbuild.binlog every time)
dotnet build /bl
dotnet build /bl
```
## One build = one binlog
Add `/bl:{}` to **every** MSBuild invocation separately — never reuse a name and
never rely on bare `/bl`:
- Building several configurations, projects, or retrying a failed build? Each
command still gets its own `/bl:{}` so the logs never overwrite each other.
```bash
dotnet build -c Debug /bl:{} # unique file
dotnet build -c Release /bl:{} # another unique file
```
## Verify the binlog exists
After the build, confirm a `.binlog` was actually produced before moving on to
analysis — a build that fails *before* MSBuild starts (e.g. a bad argument)
writes no binlog:
```bash
ls -1 *.binlog # bash
dir /b *.binlog # Windows cmd
```
```powershell
Get-ChildItem *.binlog # PowerShell
```
Note the resulting path so `binlog-failure-analysis` or `build-perf-diagnostics`
can consume it.
## When a Specific Filename Is Required
If the binlog filename needs to be known upfront (e.g., for CI artifact upload), or if `{}` is not available in the installed MSBuild version, pick a name that won't collide with existing files:
1. Check for existing `*.binlog` files in the directory
2. Choose a name not already taken (e.g., by incrementing a counter from the highest existing number)
```bash
# Example: directory contains 3.binlog — use 4.binlog
dotnet build /bl:4.binlog
```
## Cleaning the Repository
When cleaning the repository with `git clean`, **always exclude binlog files** to preserve your build history:
```bash
# ✅ CORRECT - Exclude binlog files from cleaning
git clean -fdx -e "*.binlog"
# ❌ WRONG - This deletes binlog files (they're usually in .gitignore)
git clean -fdx
```
This is especially important when iterating on build fixes - you need the binlogs to analyze what changed between builds.
© dotnet · MIT · dotnet/skills