AgentSkillsCN

dotnet-packages-upgrade

对于SDK风格的仓库,采用具备中央包管理意识、并设有恢复/构建/测试门禁的安全NuGet升级流程。

SKILL.md
--- frontmatter
name: dotnet-packages-upgrade
description: Safe NuGet upgrade workflow for SDK-style repos with central package management awareness and restore/build/test gates.
triggers:
  - "upgrade nuget packages"
  - "bump dotnet dependencies"
  - "check outdated dotnet packages"
inputs:
  - "mode flag: --dry-run | --execute | --verify-only"
outputs:
  - "outdated package inventory"
  - "verification report with restore/build/test outcomes"
safety:
  - "execute requires clean git tree"
  - "no blind mass mutation; supports targeted, reviewable upgrades"
commands:
  - "skills/dotnet-packages-upgrade/scripts/run.sh --dry-run"

When to use / when NOT to use

  • Use for NuGet hygiene and controlled upgrade planning/execution.
  • Do not use for SDK pinning changes (use dotnet-sdk-align).

Preconditions (tools, versions, repo state)

  • dotnet CLI installed.
  • Repo has .NET projects and optional central package management files.

Workflow (DISCOVER → PLAN → EXECUTE → VERIFY → REPORT)

  1. DISCOVER: locate version-definition files (Directory.Packages.props, *.csproj, lockfiles).
  2. PLAN: define package bump slices based on outdated output.
  3. EXECUTE: restore and generate upgrade candidates (manual targeted bump step).
  4. VERIFY: restore/build/test + outdated re-check.
  5. REPORT: summarize safe next edits for review.

Exact commands and expected signals

bash
skills/dotnet-packages-upgrade/scripts/run.sh --dry-run
skills/dotnet-packages-upgrade/scripts/run.sh --execute --ci
skills/dotnet-packages-upgrade/scripts/run.sh --verify-only --ci

Success: outdated inventory and verification output produced. Failure: missing dotnet or build/test failures after upgrades.

If it fails (checklist)

  • Confirm SDK/runtime compatibility.
  • Run restore with detailed logs.
  • Verify central package versions are coherent.

Final report template

  • Version-definition locations discovered.
  • Outdated package summary.
  • Restore/build/test/analyze outcomes.
  • Recommended package bump PR chunks.
  • Rollback command.