Files
dotnet__skills/.gitignore
T
Art Leonard 0cee0843ca Add .NET performance analysis skill and optimizing agent (#6)
* Add .NET deep performance fixer agent and performance patterns skill

Introduce a dotnet-performance-optimizer agent and the
dotnet-performance-patterns skill with reference guides covering:
- Async patterns
- Collections and LINQ
- Critical performance patterns
- I/O and serialization
- Memory and strings
- Regex patterns

* Align agent and skill performance reporting workflow

- Add two-pass analysis methodology (Pass 1: LLM-only, Pass 2: skill-based)
- Consolidate skill references to match actual reference files
- Remove references to non-existent skills (dotnet-jit-optimization, dotnet-async-patterns, dotnet-sync-primitives)
- Update pattern count to 85+ to reflect current reference corpus

* Update performance patterns skill with expanded reference coverage

- Add structural-patterns.md reference file
- Expand collections-and-linq, memory-and-strings, regex patterns references
- Update critical-patterns with refined rules
- Expand SKILL.md with additional workflow guidance

* Add missing structural-patterns.md reference to agent skill list

* Add non-deterministic results disclaimer to agent and skill output

* Trim agent per skill authoring best practices

Apply recommendations from platform.claude.com best practices:
- Remove sections Claude already knows (Core Expertise, Edge Cases,
  Key Principles, When to Ask, Tone) - these waste context tokens
- Remove skill internal reference file listing (skill handles its
  own progressive disclosure)
- Condense 138 lines to 55 lines (-60%)
- Keep only what Claude needs: two-pass workflow, output format,
  skill reference, escalation guidance

* Trim SKILL.md per skill authoring best practices

Apply recommendations from platform.claude.com best practices:
- Remove Purpose section (redundant with description frontmatter)
- Remove When to Use (redundant with description triggers)
- Consolidate signal table (11 rows → 5, merging same-reference rows)
- Remove 50-line checklist example template (keep the rule, not the example)
- Remove 25-line Recipe Completeness Verification (redundant with gate)
- Remove 40-line Output Format example (Claude knows markdown)
- Trim Validation from 8 items + gate to 5 essential items
- Trim Common Pitfalls from 3-column to 2-column
- Condense Steps 5+6 into single Step 5
- 311 lines → 134 lines (-57%)

* Trim reference files per Claude skill authoring best practices

Apply 'Claude is already smart' principle to reference files:
- Remove 6 patterns Claude already knows (Interlocked, SemaphoreSlim dup,
  Array.Empty, Any() vs Count(), Enum.HasFlag, Random.Shared)
- Remove IEquatable<T> duplicate (kept in structural-patterns.md)
- Remove 'Why a Separate File' meta-commentary from structural-patterns.md
- Remove all horizontal rules between patterns
- Remove explanatory prose and obvious inline comments
- Preserve all Detection sections, scan recipes, and Impact statements

Total: 1,819 → 1,372 lines (-25%)

* Rename skill and agent to gerund form per naming conventions

- dotnet-performance-patterns → analyzing-dotnet-performance
- dotnet-performance-optimizer → optimizing-dotnet-performance
- Update all cross-references in frontmatter and agent skill list

* Rewrite descriptions per effective description guidelines

- Agent: Replace second-person trigger phrases and verbose examples with
  concise third-person description stating what it does and when to use it
- Skill: Add specificity (85+ patterns, tiered severity) and clearer triggers
- Both now follow: third person, specific key terms, what + when format

* Refine performance report structure and findings format for clarity and conciseness

* Remove outdated reference link from SKILL.md for clarity

* Remove further reading section from SKILL.md for conciseness

* Add compound allocation check to performance analysis workflow

* Add performance analysis scenarios for critical patterns, collections, I/O, and struct issues

* Address PR #6 review feedback from Stephen Toub

Remove 15 patterns that are correctness-only, redundant, or not actionable:
- async void, lock+async, Async All the Way Down, NonBacktracking,
  Regex timeouts, Cache Regex, Budget Compiled Regex, Seal Classes stub,
  ConfigureAwait(false), Parallel.ForEachAsync, async lambda Action,
  C#10 Interpolation Handlers, Span-Based Comparison, Utf8JsonWriter,
  JsonSerializerContext for AOT

Clarify 3 patterns where rationale was unclear:
- IEquatable<T>: explain boxing via EqualityComparer<T>.Default
- IsMatch guard: explain Replace always allocates even on no-match
- Chained strings: split into 3 distinct anti-pattern/fix pairs

Rework 3 patterns per feedback:
- CollectionsMarshal.AsSpan: qualified to ultra-hot-path-only
- LINQ guardrail: moved to Common Pitfalls table
- params overloads: added params ReadOnlySpan<T> as .NET 9+ alternative

Fix nits:
- Title: arrays → substring for slicing pattern
- Remove try/finally from ArrayPool example
- Qualify impact statement on boxing
- Remove numbered headings for consistency across reference files
- Add unsafe code pitfall to Common Pitfalls
- Update pattern count 85→70, critical count 24→17

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Move skill, agent, and tests to src/dotnet/ component layout

Restructure to match upstream directory conventions:
- skills/ → src/dotnet/skills/
- agents/ → src/dotnet/agents/
- skill tests → src/dotnet/tests/
- Update eval.yaml fixture source paths

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix eval.yaml source paths to resolve relative to skill directory

The validator resolves source paths via join(skillPath, source),
so fixture references need ../../tests/ prefix from the skill dir.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove validator results from tracking and add to .gitignore

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Replace synthetic eval fixtures with Humanizer-derived needle-in-haystack test suite

Replace 4 synthetic Contoso fixtures with 11 realistic test fixtures modeled
on patterns from the Humanizer library performance analysis (Runs A-J).

10 eval scenarios with 51 rubric items (up from 4 scenarios / 19 rubric items):
- Scenarios 1-9: patterns the skill outperformed naked model on (J vs B)
- Scenario 10: baseline patterns J missed (Span inconsistencies, unsealed classes)

Each fixture is 240-380 lines with ~80% clean haystack code surrounding
the anti-pattern needles, including decoys, positive findings, and correct
patterns as contrast.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Split scenario 10 into two focused scenarios for truncation and unsealed classes

The combined scenario was timing out at 120s with 2 files and 6 rubric items.
Split into:
- Scenario 10: Span inconsistencies and compound method chains (Truncation.cs, 3 rubric items)
- Scenario 11: Unsealed leaf classes and locale hierarchy (Locales.cs, 3 rubric items)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Increase timeout to 180s for scenarios 7 and 10

These scenarios consistently timed out at 120s before the agent could
synthesize findings, causing weak/negative improvement scores despite
the skill detecting correct patterns.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Increase timeout to 180s for scenarios 4, 8, 9

All three timed out at 120s — agent spent time loading skill references
and running grep recipes, never reaching synthesis before cutoff.
Scenarios 7 and 10 already at 180s from prior fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune SKILL.md for sandboxed eval and add results report

SKILL.md changes:
- Add fallback for missing reference files (skip filesystem search)
- Inline core scan recipes so agent works without reference files
- Add 'read small files first' guidance to reduce grep overhead
- Update validation checklist for reference-optional workflow

Results: 73.7% overall improvement, 11/11 scenarios strong (≥60%)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Addressing @danmoseley feedback

* Update src/dotnet/skills/analyzing-dotnet-performance/references/critical-patterns.md

Co-authored-by: Dan Moseley <danmose@microsoft.com>

* Address PR #6 review feedback: skill docs and fixture fixes

Skill/reference changes:
- Remove CollectionsMarshal.AsSpan section (too much churn per stephentoub)
- Remove startup/initialization as examples of non-perf-sensitive code
- Split Contains into own grep with false-positive note
- Clarify 'exact counts' means grep match counts
- GeneratedRegex: ALWAYS for static patterns, always beneficial
- Rewrite regex engine section: static->GeneratedRegex, never remove NonBacktracking
- Sealed class grep catches protected and file classes
- StringComparison grep uses proper ERE, catches variable args

Test fixture fixes:
- Fix invalid regex character class in inflector-and-regex.cs
- Fix Hungarian converter cache key (use original number)
- Add truncation guard for truncationString >= length
- Use explicit ordered array instead of dictionary keys for Farsi/Kurdish
- Preserve negative sign in ToMetric null-symbol fallback
- Remove stray double semicolon

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
2026-02-26 11:15:27 +01:00

420 lines
7.2 KiB
Plaintext

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.env
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
[Aa][Rr][Mm]64[Ee][Cc]/
bld/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Build results on 'Bin' directories
**/[Bb]in/*
# Uncomment if you have tasks that rely on *.refresh files to move binaries
# (https://github.com/github/gitignore/pull/3736)
#!**/[Bb]in/*.refresh
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.trx
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Approval Tests result files
*.received.*
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.idb
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
# but not Directory.Build.rsp, as it configures directory-level build defaults
!Directory.Build.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
**/.paket/paket.exe
paket-files/
# FAKE - F# Make
**/.fake/
# CodeRush personal settings
**/.cr/personal
# Python Tools for Visual Studio (PTVS)
**/__pycache__/
*.pyc
# Cake - Uncomment if you are using it
#tools/**
#!tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
MSBuild_Logs/
# AWS SAM Build and Temporary Artifacts folder
.aws-sam
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
**/.mfractor/
# Local History for Visual Studio
**/.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
**/.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
.skill-validator-results/