Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

nuget-trusted-publishingnuget 可信出版

Agent Skill

nuget-trusted-publishing 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

5,108

周安装

215

GitHub Stars

1,474

下载量

1,789
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nuget-trusted-publishing(nuget 可信出版)
来源仓库:https://github.com/dotnet/skills
仓库路径:skills/nuget-trusted-publishing
安装命令:
npx skills add https://github.com/dotnet/skills --skill nuget-trusted-publishing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dotnet/skills --skill nuget-trusted-publishing

简介

nuget-trusted-publishing 用于查找、检索和筛选相关信息,适合在主流 Agent 宿主中快速定位候选结果。

  • 适用于围绕 NuGet 可信发布流程进行信息检索与筛选。
  • 通过 npx skills add 命令安装,需结合原始 README 确认具体用法。
  • 安装前建议确认权限范围、维护状态及是否触发联网或文件读写操作。
  • 可结合来源仓库进一步核验功能细节和使用限制。

SKILL.md

NuGet Trusted Publishing Setup

Set up NuGet trusted publishing on a GitHub Actions repo. Replaces long-lived API keys with OIDC-based short-lived tokens — no secrets to rotate or leak.

Prerequisites

  • GitHub Actions — this skill covers GitHub Actions setup only
  • nuget.org account — the user needs access to create trusted publishing policies

When to Use This Skill

Use this skill when:

  • Setting up trusted publishing for a NuGet package
  • Migrating from secrets.NUGET_API_KEY to OIDC-based publishing
  • Asked about keyless or secure NuGet publishing
  • Creating a new NuGet publish workflow from scratch
  • Asked to "remove NuGet API key" or "use NuGet/login"
  • Setting up publishing for a dotnet tool, MCP server, or template package
  • Asked about NuGet/login@v1 or id-token: write

Safety Rules

⚠️ Bail-out rule: If any phase fails after one fix attempt on an infrastructure/auth issue, stop and ask the user. Don't loop on environment problems.
⚠️ Never delete or overwrite without confirmation: Removing API key secrets, deleting tags/releases, removing workflow steps, or changing package IDs. NuGet package IDs are permanent — mistakes can't be undone.

Process

Fast-path for greenfield repos: When the user has a simple setup (one packable project, no existing publish workflow), don't gate on multi-turn assessment. Combine phases: create the workflow immediately, include nuget.org policy guidance, local pack recommendation, and filename-matching warning all in one response. The full phased process below is for complex or migration scenarios.

Phase 1: Assess

Inspect the repo and report findings before making any changes.

  1. Find and classify packable projects — check .csproj files and Directory.Build.props (package metadata is often set repo-wide). Classify in this order (earlier matches win):

- <PackageType>Template</PackageType>Template - <PackageType>McpServer</PackageType>MCP server (also a dotnet tool) - <PackAsTool>true</PackAsTool>Dotnet tool - Class library (IsPackable=true or no OutputType) → Library - <OutputType>Exe</OutputType> with <IsPackable>true</IsPackable>Application package (not a tool, but still publishable) - <OutputType>Exe</OutputType> without PackAsTool or IsPackable → Not packable by default (ask user if they intend to publish it)

  1. Validate structure for each project's type: Type Required All PackageId, Version (in.csproj or Directory.Build.props) Dotnet tool PackAsTool (required); ToolCommandName (optional but recommended — defaults to assembly name) MCP server PackageType=McpServer, .mcp/server.json included in package Template PackageType=Template, .template.config/template.json under content dir
  2. Find existing publish workflows in .github/workflows/ — look for dotnet nuget push, nuget push, or dotnet pack.
  3. Check version consistency — for MCP servers, verify .csproj <Version> matches both server.json version fields (root version and packages[].version). Flag any mismatch.
  4. Report findings to the user: classification, missing properties, version mismatches, existing workflows. For multi-project repos, note whether one workflow or separate workflows per package are needed. Offer to fix gaps — use ask_user before modifying project files.
❌ See references/package-types.md for per-type details and required properties.

Phase 2: Local Verification

Pack and verify locally before touching nuget.org — publishing errors waste a permanent version number.

⚠️ Always mention this step, even if you defer running it. Tell the user: "Before your first publish, run dotnet pack -c Release -o./artifacts to verify the.nupkg is created correctly."
  1. dotnet pack -c Release -o./artifacts — verify .nupkg is created
  2. For tools/MCP servers: install from ./artifacts, run --help, uninstall
  3. For libraries: inspect the .nupkg contents (it's a zip)

Phase 3: nuget.org Policy

This phase requires the user to act on nuget.org — guide them with exact values.

  1. Determine the repo owner, repo name, and the workflow filename that will publish. ❌ The policy requires the exact workflow filename (e.g., publish.yml or publish.yaml) — just the filename, no path prefix. Matching is case-insensitive. Don't use the workflow name: field.
  2. Guide the user to create the trusted publishing policy: Go to nuget.org/account/trustedpublishingAdd policy Repository Owner: {owner} Repository: {repo} Workflow File: {filename}.yml Environment: release *(only if the workflow uses environment:; leave blank otherwise)* Policy ownership: the user chooses individual account or organization. Org-owned policies apply to all packages owned by that org. For private repos: policy is "temporarily active" for 7 days — becomes permanent after the first successful publish.
  3. Guide the user to create a GitHub Environment (recommended but optional — provides secret scoping + approval gates): Repo SettingsEnvironmentsNew environmentrelease Add environment secret: Name = NUGET_USER, Value = nuget.org username (NOT email) Optional: add Required reviewers for an approval gate.
⚠️ Wait for the user to confirm they've created the policy before asking them to remove old API keys/secrets or before attempting to run/publish with the workflow. Drafting or showing the workflow file itself is OK before confirmation.

Phase 4: Workflow Setup

Create or modify the publish workflow. The workflow must always be created or shown in your response — you may draft/show it even if the nuget.org policy is not yet confirmed, but do not guide the user to actually run/publish or remove old secrets until after confirmation.

Greenfield: Create publish.yml from the template in references/publish-workflow.md. Adapt.NET version, project path, and environment name. Ensure your output explicitly mentions id-token: write and NuGet/login@v1.

Migration (existing workflow with API key): Modify in place —

  1. Add OIDC permission and environment to the publishing job: jobs: publish: environment: release permissions: id-token: write # Required — without this, NuGet/login fails with 403 contents: read # Explicit — setting permissions overrides defaults
  2. Add the NuGet login step before push: - name: NuGet login (OIDC) id: login uses: NuGet/login@v1 with: user: ${{secrets.NUGET_USER}} # nuget.org profile name, NOT email
  3. Replace the API key in the push step: --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate
  4. Verify: Ask the user to trigger a publish and confirm the package appears on nuget.org.
Don't delete the old API key secret until trusted publishing is verified. Removing it is a one-way door — wait for confirmation.

Troubleshooting

ProblemCauseFix
NuGet/login 403Missing id-token: writeAdd to job permissions
"no matching policy"Workflow filename mismatchVerify exact filename on nuget.org
Push unauthorizedPackage not owned by policy accountCheck policy owner on nuget.org
Token expiredLogin step >1hr before pushMove NuGet/login closer to push
"temporarily active" policyPrivate repo, first publish pendingPublish within 7 days
already_exists on pushRe-running same versionAdd --skip-duplicate
GitHub Release 422Duplicate release for tagDelete conflicting release (confirm first)
Re-run uses wrong YAMLgh run rerun replays original commit's YAMLDelete obstacle, re-run — never re-tag
⚠️ If any blocker persists after one fix attempt, stop and ask the user.

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.71%
按下载量换算603

Claude

29.7%
按下载量换算531

Cursor

20.77%
按下载量换算372

Gemini CLI

8.89%
按下载量换算159

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills