azure/bicep-perf-profiling
Capture and analyze .NET traces for Bicep CLI compilation. Use when profiling Bicep builds, batch compilation, CPU hotspots, allocations, GC pressure, contention, or compiler performance with dotnet-trace and filtrace.
npx skills add https://github.com/Azure/bicep --skill bicep-perf-profiling
Capture a Release trace of bicep build --pattern, then use the filtrace MCP server to identify actionable compiler hotspots.
pwsh, the SDK pinned by global.json, and dotnet-trace are available.dotnet-trace with dotnet tool install --global dotnet-trace.Run the bundled profile script:
pwsh ./.github/skills/bicep-trace-analysis/scripts/BuildAndProfile.ps1 src/Bicep.Core.Samples/Files/user_submitted
The script:
Bicep.Cli in Release mode under src/Bicep.Cli/bin/profile/Release.bicep build --pattern <folder>/**/*.bicep.profile-<UTC timestamp>.nettrace to the current directory.Use filtrace in this order:
trace_info with the trace path and symbols=src/Bicep.Cli/bin/profile/Release.trace_rank with both self and inclusive measures.root=Bicep.Cli.Commands.BuildCommand.Compile. Whole-process rankings include runtime service threads and sampled waits that can obscure compiler work.trace_rank with both measures and run trace_gc for collection count, pause time, peak heap, and promoted bytes.trace_callers on hot framework leaves such as file I/O, JSON serialization, array growth, boxing, or locks until reaching the Bicep-owned caller.trace_tree for major Bicep phases and trace_lines or trace_heatmap only when matching PDBs provide sufficient source attribution.Useful first-pass analyses:
trace_info(path, symbols)
trace_rank(path, metric=cpu, measure=self, root=Bicep.Cli.Commands.BuildCommand.Compile, symbols=symbols)
trace_rank(path, metric=cpu, measure=inclusive, root=Bicep.Cli.Commands.BuildCommand.Compile, symbols=symbols)
trace_rank(path, metric=alloc, measure=self)
trace_rank(path, metric=alloc, measure=inclusive)
trace_gc(path)
Report the top five optimization areas. For each area include:
Call out capture limitations. Prefer a longer trace when a result has fewer than 200 samples, and do not claim allocation absence unless allocation capture is known to be enabled. Re-capture and compare like-for-like traces after any optimization.
Take azure/bicep-perf-profiling from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.