Skip to content

Add skill for using dotnet format whitespace#358

Draft
jjonescz wants to merge 5 commits intodotnet:mainfrom
jjonescz:format-whitespace
Draft

Add skill for using dotnet format whitespace#358
jjonescz wants to merge 5 commits intodotnet:mainfrom
jjonescz:format-whitespace

Conversation

@jjonescz
Copy link
Copy Markdown
Member

No description provided.

@jjonescz jjonescz marked this pull request as ready for review March 13, 2026 19:25
Copilot AI review requested due to automatic review settings March 13, 2026 19:25
@jjonescz
Copy link
Copy Markdown
Member Author

/evaluate

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new .NET plugin skill document to guide users on using dotnet format whitespace for fast, whitespace-only formatting, positioned as a safer alternative to analyzer/style formatting when the goal is indentation/trailing whitespace cleanup.

Changes:

  • Introduces a new dotnet-format skill focused on dotnet format whitespace.
  • Documents recommended --folder-based workflow, key flags, validation checklist, and pitfalls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread plugins/dotnet/skills/dotnet-format/SKILL.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 13, 2026 19:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new dotnet plugin skill documenting how to use dotnet format whitespace for fast, safe whitespace-only formatting in C#/.NET codebases.

Changes:

  • Introduces a new dotnet-format skill with guidance on when to use dotnet format whitespace vs style/analyzers
  • Documents a recommended workflow using --folder, --include, and --verify-no-changes
  • Adds validation checklist and common pitfalls for consistent usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread plugins/dotnet/skills/dotnet-format/SKILL.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 13, 2026 19:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new .NET plugin skill document describing how to use dotnet format whitespace for fast, whitespace-only formatting (primarily via --folder mode) to clean up indentation/trailing whitespace after edits or code generation.

Changes:

  • Introduces the dotnet-format skill with usage guidance, workflow steps, and validation checklist for dotnet format whitespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread plugins/dotnet/skills/dotnet-format/SKILL.md
Comment thread plugins/dotnet/skills/dotnet-format/SKILL.md
@danmoseley
Copy link
Copy Markdown
Member

/evaluate

@github-actions
Copy link
Copy Markdown
Contributor

Skill Validation Results

❌ Skill validation errors

  • dotnet-format: No tests/eval.yaml found (required by --require-evals)

Model: claude-opus-4.6 | Judge: claude-opus-4.6

Full results

@danmoseley
Copy link
Copy Markdown
Member

I'd be very surprised if this skill is better than no skill: probably worse since it's using up context with its tokens. This is basically just restating the docs which models are already trained on?

@danmoseley
Copy link
Copy Markdown
Member

You'd have to add an eval.yaml then we could see.

Add two evaluation scenarios:
- Format specific files after editing (tests --folder + --include usage)
- Verify formatting without modifying files (tests --verify-no-changes)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jjonescz
Copy link
Copy Markdown
Member Author

I'd be very surprised if this skill is better than no skill: probably worse since it's using up context with its tokens. This is basically just restating the docs which models are already trained on?

I got the feedback that models generally just use dotnet format which can be slow (it needs to load the full roslyn workspace, runs analyzers and code fixers) or dotnet format whitespace (which still needs to load the workspace) when they really just want dotnet format whitespace --folder which is a subtle difference that causes it to be much faster (doesn't load workspace).

You'd have to add an eval.yaml then we could see.

Added, but it seems I cannot run /evaluate in this repo (tried in another PR) since I don't have write permissions.

Copilot AI review requested due to automatic review settings April 9, 2026 21:13
@danmoseley
Copy link
Copy Markdown
Member

/evaluate

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new dotnet-format skill to the dotnet plugin focused on using dotnet format whitespace in --folder mode, plus accompanying evaluation scenarios to validate correct agent guidance for whitespace-only formatting without a solution file.

Changes:

  • Introduces plugins/dotnet/skills/dotnet-format/SKILL.md documenting a workflow for dotnet format whitespace (including --folder, --include, --verify-no-changes).
  • Adds tests/dotnet/dotnet-format/eval.yaml with scenarios for formatting specific files and verifying formatting without modifying files.
Show a summary per file
File Description
tests/dotnet/dotnet-format/eval.yaml Adds eval scenarios/assertions intended to enforce use of dotnet format whitespace with folder-mode targeting.
plugins/dotnet/skills/dotnet-format/SKILL.md Adds the new skill documentation and recommended command patterns for whitespace-only formatting.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (2)

tests/dotnet/dotnet-format/eval.yaml:36

  • Scenario 2’s rubric requires --folder and --include, but the assertions don’t check for either (only dotnet format whitespace and --verify-no-changes). Since task completion is gated by assertions/constraints (not the rubric), this scenario can pass without actually using folder mode or targeting src/Services/PaymentService.cs. Add assertions for --folder plus the specific --include src/Services/PaymentService.cs.
    assertions:
      - type: "output_contains"
        value: "dotnet format whitespace"
      - type: "output_contains"
        value: "--verify-no-changes"
    rubric:
      - "Uses `dotnet format whitespace` with `--verify-no-changes` to verify without modifying the file"
      - "Uses --folder mode since there is no solution file available"
      - "Uses --include to target the specific file rather than checking the entire directory"

plugins/dotnet/skills/dotnet-format/SKILL.md:35

  • The skill doc doesn’t explicitly state prerequisites/inputs (e.g., that dotnet/the .NET SDK must be available, and that dotnet format must be installed/available in the environment). CONTRIBUTING’s skill checklist calls out documenting inputs/prereqs; adding a short “Prerequisites” or “Inputs” section would make the skill more self-contained and reduce failure modes.
## When to Use

- Fixing indentation or trailing whitespace in files you just created or edited
- Batch-formatting a set of changed files before committing
- Cleaning up generated code that has inconsistent whitespace

## When Not to Use

- You need code-style fixes (naming, `var` vs explicit type, etc.) — use `dotnet format style` instead
- You need analyzer-driven fixes (e.g., SA1200) — use `dotnet format analyzers` instead

## Workflow

### Step 1: Determine files to format

Identify the file paths that need formatting — typically files that were just created or edited.

### Step 2: Run `dotnet format whitespace`

Use `--folder` mode to format without needing a project/solution file:

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment on lines +9 to +16
assertions:
- type: "output_contains"
value: "dotnet format whitespace"
- type: "output_contains"
value: "--folder"
- type: "output_matches"
pattern: "--include"
rubric:
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario 1’s assertions only check that the output mentions --include, but they don’t ensure the agent targets the specific files listed in the prompt. As written, the test can pass even if the agent formats the whole folder or includes unrelated paths. Consider asserting that the output contains both src/Services/OrderService.cs and src/Models/Order.cs (or a regex that requires both --include occurrences).

This issue also appears on line 28 of the same file.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +9
---
name: dotnet-format
description: >
Format C#/.NET source files using the `dotnet format whitespace` subcommand.
USE FOR: quickly fixing whitespace and indentation in one or more files after
code generation or editing, batch-formatting changed files before a commit.
DO NOT USE FOR: enforcing code-style analyzers (SA/IDE rules), fixing
non-whitespace style issues, or formatting entire large repositories at once.
---
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This skill adds a new plugins/dotnet/skills/dotnet-format entry, but the dotnet plugin README’s skill list doesn’t include dotnet-format (it currently lists only csharp-scripts, dotnet-pinvoke, and nuget-trusted-publishing). Please update plugins/dotnet/README.md to keep the published skill inventory accurate.

This issue also appears on line 15 of the same file.

Copilot uses AI. Check for mistakes.
github-actions Bot added a commit that referenced this pull request Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

Skill Validation Results

Skill Scenario Quality Skills Loaded Overfit Verdict
dotnet-format Format specific files after editing 3.0/5 ⏰ → 3.0/5 ⏰ ✅ dotnet-format; tools: report_intent, skill / ✅ dotnet-format; tools: skill, bash, report_intent [1]
dotnet-format Verify whitespace formatting without modifying files 3.0/5 ⏰ → 3.0/5 ⏰ ⚠️ NOT ACTIVATED / ✅ dotnet-format; tools: report_intent, skill, bash [2]

[1] ⚠️ High run-to-run variance (CV=1.08) — consider re-running with --runs 5. (Isolated) Quality unchanged but weighted score is -1.2% due to: time (81.0s → 120.1s)
[2] ⚠️ High run-to-run variance (CV=1.73) — consider re-running with --runs 5. (Isolated) Quality unchanged but weighted score is -7.5% due to: tokens (65 → 4235), tool calls (0 → 1)

timeout — run(s) hit the (120s) scenario timeout limit; scoring may be impacted by aborting model execution before it could produce its full output (increase via timeout in eval.yaml)

Model: claude-opus-4.6 | Judge: claude-opus-4.6

🔍 Full Results - additional metrics and failure investigation steps

▶ Sessions Visualisation -- interactive replay of all evaluation sessions

@danmoseley
Copy link
Copy Markdown
Member

danmoseley commented Apr 9, 2026

@jjonescz in the eval above, in the first case baseline (no skill) gives the same result but 30% faster (didn't need to read in the skill). In the second case, the skill doesn't activate at all.

edit: in the first case, with the skill added it actually didn't even complete apparently in the 120s -- not sure why it got graded anyway

If you click on the link it will give

For PR 358 in dotnet/skills, download eval artifacts with gh run download 24213650400 --repo dotnet/skills --pattern "skill-validator-results-*" --dir ./eval-results, then fetch https://raw.githubusercontent.com/dotnet/skills/6a308d7d9b2dee2a72a39fcfc37babd26ff874e1/eng/skill-validator/src/docs/InvestigatingResults.md and follow it to analyze the results.json files. Diagnose each failure, suggest fixes to the eval.yaml and skill content, and tell me what to fix first.

this is handy to have AI look at the actual logs and you can ask it eg why did it not activate? But I think you might need to devise more eval scenario(s) that show why the skill is needed. One way to start might be to try locally -- without the skill -- and give it a task in Copilot CLI with some model or other and see what fails that you want to work. Then put that in an eval.

What I've learned working on skills for this repo is it's often surprisingly hard to beat the agent-without-skill results. You start at -100 points because it has to read and interpret the skill - and because it uses up context window too

For the ability to run '/evaluate' @ViktorHofer do we have a group to add Jan to?

@ViktorHofer
Copy link
Copy Markdown
Member

Just maintainer permissions are needed, no special group. You can reach out to @timheuer to get the required perms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants