NuGet/NPM 依赖升级与验证
update-dependencies
将仓库中的 NuGet 和 NPM 依赖及锁定文件更新到最新兼容版本,然后验证库构建和 bUnit 测试。当用户要求更新或升级仓库依赖时使用。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 4.9k
- Forks
- 494
01 前言 Front Matter
- name
- update-dependencies
- description
- Update repository NuGet and NPM dependencies and lockfiles to the latest compatible versions, then validate library builds and bUnit tests. Use when asked to update or upgrade repository dependencies.
- user-invocable
- true
- disable-model-invocation
- true
02 资源文件 2
- 参考文档references/validation.md5.6 KB
- 参考文档writing-good-tests.md8.1 KB
03 SKILL.md 正文
Update and validate dependencies
Update dependencies using the repository's current configuration, not assumptions about SDKs, scripts, or test runners.
Execution contract
- Work on the current local branch. Do not create or switch branches, commit, push, create pull requests or comments, or change remote status.
- Allow only dependency-version edits in repository-owned
Directory.Packages.propsandpackage.jsonfiles, plus corresponding NPM-generatedpackage-lock.jsonupdates. - Do not manually edit lockfiles, delete them to force upgrades, or introduce unrelated resolution changes. Preserve compatible locked resolutions.
- Do not modify project files,
global.json, NuGet/NPM configuration, build scripts, NPM scripts or unrelated metadata, code, tests, snapshots, generated sources, or other lockfiles. Do not add a report file. - Preserve existing user changes, comments, formatting, MSBuild conditions, and dependency range conventions. Never reset or discard someone else's work.
- If an upgrade requires changes outside this boundary, select a compatible version or leave the dependency unchanged and explain why.
- Run all restore, install, build, and test commands in an isolated disposable
copy outside the working tree. Script builds can rewrite tracked
src\BuildConstants.tsfiles. Never copy generated outputs back, except for validated NPM lockfiles. - Do not install system-wide tools or edit SDK pins without approval.
.NET framework policy
Keep framework package families within their corresponding major version:
net8.0 uses 8.x, net9.0 uses 9.x, net10.0 uses 10.x, and net11.0 uses 11.x.
Package updates and local validation are separate requirements. Always
query and update .NET 11 packages to their latest compatible published versions,
including RuntimeVersion11, AspNetCoreVersion11, EfCoreVersion11, and literal
versions. Verify every shared-property consumer using NuGet metadata.
Validate .NET 8, 9, and 10; missing prerequisites are blockers. Validate .NET 11 only when an already installed SDK supports it, including Preview/RC SDKs. Its tests additionally require the corresponding runtime. Otherwise mark the affected checks as intentionally skipped, not failed or blocked. Do not install an SDK/runtime just for .NET 11 validation, defer its updates, or revert them solely because local validation is unavailable.
1. Inspect and capture the starting state
- Record Git status, including untracked files and existing changes. Capture
starting dependency versions, shared MSBuild values, and existing NPM
lockfiles from the working tree, not just
HEAD, for the final comparison. - Locate repository-owned manifests, consuming projects, package sources, NPM workspaces, build scripts, and actual test projects. Exclude generated, vendored, and installed dependency directories.
- Read Directory.Packages.props, Directory.Build.props, and global.json. Inspect framework overrides, project references, runners, and configuration-dependent build behavior.
- Check
dotnet --info,dotnet --list-sdks,dotnet --list-runtimes,node --version, andnpm --versionagainst project requirements. - Before installing or building, prepare the validation copy with current
source, relevant pre-existing user changes, manifests, lockfiles, and required
resources. Preserve relative paths; exclude
.gitand generated/install directories. A clean checkout ofHEADalone is not sufficient. Report limitations caused by external references or unavailable credentials.
2. Select compatible versions
- Query configured NuGet sources and the NPM registry for published versions. Use metadata and official release notes, not guessed versions or textual version sorting. Never disclose feed credentials.
- Default to the latest compatible stable release. Do not introduce prereleases into stable lines without approval. For existing prereleases, compare the latest compatible prerelease and stable alternative; do not automatically downgrade. Respect framework preview/RC requirements.
- Check supported TFMs, minimum SDK/Node versions, peer dependencies, related constraints, breaking changes, and known advisories. Update tightly coupled families together.
- Inspect NPM
dependencies,devDependencies, and existing peer/optional dependencies and overrides. Preserve range styles unless a justified constraint change is necessary. Annpm outdatedexit code indicating outdated packages is not itself a registry failure. - Distinguish external dependencies from repository-owned package/version relationships; do not switch local development to unrelated published packages.
- Present a concise proposal: ecosystem, package/property, current and proposed versions, constraints, and release-note links. Ask for approval before potentially breaking major upgrades or uncertain changes; otherwise proceed.
Shared NuGet versions
This repository uses Central Package Management with shared properties such as
RuntimeVersion8, AspNetCoreVersion8, and EfCoreVersion8, and corresponding
properties for the other framework versions.
For Version="$(AspNetCoreVersion8)", update the property in PropertyGroup,
not the consuming attribute. Identify every consumer and verify that the
proposed version is published and compatible for all of them. Runtime, ASP.NET
Core, and EF Core packages do not necessarily publish identical versions.
Update literal PackageVersion values directly only when not property-backed.
Preserve expressions and framework conditions; do not inline shared values,
duplicate declarations, remove framework groups, or move version definitions.
TypeScript policy
Keep TypeScript on the latest compatible 5.x version by default.
Reevaluate this repository policy on each run using the
official support policy,
release notes, and peer dependencies for the exact proposed
@typescript-eslint/parser and @typescript-eslint/eslint-plugin versions.
A permissive peer range or successful install does not prove official support.
If a newer TypeScript major is officially supported, request approval before upgrading. Run existing lint scripts, where available, in addition to the required builds and tests. Report the findings and any deferred TypeScript upgrade.
3. Apply and validate
- Make focused version edits in allowed manifests only. Avoid broad upgrade
commands that rewrite other files. Do not use
npm audit fix,--force, or--legacy-peer-depsto hide incompatibilities. - Refresh the validation copy with the exact proposed manifests and candidate lockfiles before each attempt.
- Read and follow the validation procedure before running validation. Complete all required checks even when no dependency needed updating. Capture every command, exit code, and result.
- If an upgrade fails, investigate and choose a compatible version or revert only that attempted version edit, preserving the initial user state. Regenerate affected lockfiles and rerun affected checks. Complete the final matrix against the final manifests and lockfiles.
- Copy back only lockfiles whose final manifests, installs, and builds were validated. Do not overwrite a lockfile changed concurrently since capture. If a manifest changes after validation, refresh its lockfile and repeat the affected checks before copying.
Do not suppress new errors or relax warnings, dependency constraints, or tests to obtain a successful result.
4. Review and report
Compare final manifest/lockfile diffs and Git status with the initial state. Confirm that only allowed edits were introduced, unrelated user changes remain intact, and final manifests/lockfiles are exactly those validated. Remove only the specifically identified disposable workspace and temporary files created by this operation.
Always report in chat, including when validation fails:
- Applied updates using the table below. Include one row per package and
manifest/framework combination. For shared properties, expand every affected
package to its effective previous/new versions. Preserve exact NPM ranges,
including
^or~. Omit rejected/reverted attempts; if nothing changed, state "No dependencies were updated". - Deferred/rejected upgrades, compatibility reasons, and remaining advisories.
- .NET 11 updates, clearly separating metadata verification from executed or skipped restore/build/test checks.
- Library matrix: two projects by four TFMs, with separate restore/build results and explicit intentional skips where applicable.
- Install/build results and lockfile updates for both NPM projects; results and passed/failed/skipped counts for every bUnit project. Explicitly identify browser/Playwright and other non-bUnit suites as excluded, not blocked/passed.
- Exact validation commands, failures, blockers, and unexecuted checks.
- Modified manifests/lockfiles, previous/new resolved versions for lockfile-only updates, and confirmation that no other files changed because of this run.
| Ecosystem | Package | Manifest / Target framework | Previous version | New version | Shared MSBuild property |
|---|---|---|---|---|---|
| NuGet | <package ID> | <manifest and TFM> | <starting version> | <final version> | <property name or N/A> |
| NPM | <package name> | <manifest> | <starting range> | <final range> | N/A |
Declare success only if all required restores, builds, and tests passed. Intentional .NET 11 prerequisite-related skips and excluded non-bUnit suites do not prevent success, but do not establish compiled/tested .NET 11 compatibility. Otherwise state that validation is incomplete or failed.
Workflow inspiration: Aspire dependency-update skill. Use its discover/assess/update/verify approach, not its repository-specific internal mirroring pipeline or companion scripts.
04 同仓库更多 Skills
Fluent UI Blazor v5 使用指南
Fluent UI Blazor v5 — Usage Guide
提供使用 Microsoft.FluentUI.AspNetCore.Components v5 NuGet 包构建 Blazor 应用的准确编码模式。涵盖服务注册、主题设置(基于 CSS,不使用 FluentDesignTheme)、布局、导航、对话框、数据网格、表单、图标以及常见陷阱。
C#/.NET 编码规范
csharp-naming-conventions
C# 和 .NET 命名规范、编码最佳实践、布局规则、单元测试以及 Blazor 组件指南。在编写、审查或重构 C# / .NET / Blazor 代码,或使用 xUnit 和 bUnit 编写单元测试时使用。