本文へスキップ
Skillpedia
APIとサーバー(バックエンド)40k · #7310

nuget-manager

できること

このエージェントは、.NETのプログラミングプロジェクトでコードパッケージを管理するのを手伝います。正しいツールを使って、パッケージを安全に追加、削除、更新できるようにします。

使う場面

  • ✓新しいコードパッケージを追加したいとき。
  • ✓もう使っていないパッケージを削除したいとき。
  • ✓パッケージを新しいバージョンに更新したいとき。

スキルのリンク

https://github.com/github/awesome-copilot/blob/main/skills/nuget-manager/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/github/awesome-copilot/blob/main/skills/nuget-manager/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“'MyProject' プロジェクトに 'Newtonsoft.Json' パッケージを追加して”

毎週5つの新しいスキル。1分で読めます。

仕組み

パッケージの管理には、専用の.NETコマンドを使います。手作業で編集するとプロジェクトが壊れる可能性があるため、それを避けます。更新の場合は、新しいバージョンが存在するかを確認し、プロジェクトを復元して問題なく動くことを確かめます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

NuGet Manager

Overview

This skill ensures consistent and safe management of NuGet packages across .NET projects. It prioritizes using the dotnet CLI to maintain project integrity and enforces a strict verification and restoration workflow for version updates.

Prerequisites

  • .NET SDK installed (typically .NET 8.0 SDK or later, or a version compatible with the target solution).
  • dotnet CLI available on your PATH.
  • jq (JSON processor) OR PowerShell (for version verification using dotnet package search).

Core Rules

  1. NEVER directly edit .csproj, .props, or Directory.Packages.props files to add or remove packages. Always use dotnet add package and dotnet remove package commands.
  2. DIRECT EDITING is ONLY permitted for changing versions of existing packages.
  3. VERSION UPDATES must follow the mandatory workflow:
    • Verify the target version exists on NuGet.
    • Determine if versions are managed per-project (.csproj) or centrally (Directory.Packages.props).
    • Update the version string in the appropriate file.
    • Immediately run dotnet restore to verify compatibility.

Workflows

Adding a Package

Use dotnet add [<PROJECT>] package <PACKAGE_NAME> [--version <VERSION>]. Example: dotnet add src/MyProject/MyProject.csproj package Newtonsoft.Json

Removing a Package

Use dotnet remove [<PROJECT>] package <PACKAGE_NAME>. Example: dotnet remove src/MyProject/MyProject.csproj package Newtonsoft.Json

Updating Package Versions

When updating a version, follow these steps:

  1. Verify Version Existence: Check if the version exists using the dotnet package search command with exact match and JSON formatting. Using jq: dotnet package search <PACKAGE_NAME> --exact-match --format json | jq -e '.searchResult[].packages[] | select(.version == "<VERSION>")' Using PowerShell: (dotnet package search <PACKAGE_NAME> --exact-match --format json | ConvertFrom-Json).searchResult.packages | Where-Object { $_.version -eq "<VERSION>" }

  2. Determine Version Management:

    • Search for Directory.Packages.props in the solution root. If present, versions should be managed there via <PackageVersion Include="Package.Name" Version="1.2.3" />.
    • If absent, check individual .csproj files for <PackageReference Include="Package.Name" Version="1.2.3" />.
  3. Apply Changes: Modify the identified file with the new version string.

  4. Verify Stability: Run dotnet restore on the project or solution. If errors occur, revert the change and investigate.

Examples

User: "Add Serilog to the WebApi project"

Action: Execute dotnet add src/WebApi/WebApi.csproj package Serilog.

User: "Update Newtonsoft.Json to 13.0.3 in the whole solution"

Action:

  1. Verify 13.0.3 exists: dotnet package search Newtonsoft.Json --exact-match --format json (and parse output to confirm "13.0.3" is present).
  2. Find where it's defined (e.g., Directory.Packages.props).
  3. Edit the file to update the version.
  4. Run dotnet restore.
よくある質問

パッケージを追加・削除するためにプロジェクトファイルを直接編集できますか?

いいえ。パッケージの追加や削除には、必ず「dotnet add package」と「dotnet remove package」コマンドを使います。直接編集が許可されているのはバージョンの更新のみです。

パッケージの更新でエラーが起きたらどうなりますか?

更新後にエラーが発生した場合、エージェントは変更を元に戻します。その後、問題の原因を調べる必要があります。

バージョンをどこで更新すればよいかは、どうやって判断しますか?

バージョンが中央の設定ファイル(`Directory.Packages.props`)で管理されているか、個々のプロジェクトファイル(`.csproj`)で管理されているかを確認し、正しい場所に更新を適用します。

詳細

作者による元の説明

Manage NuGet packages in .NET projects/solutions. Use this skill when adding, removing, or updating NuGet package versions. It enforces using `dotnet` CLI for package management and provides strict procedures for direct file edits only when updating versions.

repo: github/awesome-copilot

人気

GitHubのスター
40k
ランキング
#7310
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル