publishing-dotnettool — правило для Claude Code и Cursor
Правило publishing-dotnettool для Claude Code и Cursor направляет ИИ-агента при создании и публикации dotnet-инструментов в NuGet. Гарантирует семантическое версионирование, правильную упаковку и совместимость с разными версиями .NET.
Apache-2.0 ★ 138 обновлён 2025-03-29
.cursor/rules/publishing-dotnettool.mdcЧто делает publishing-dotnettool
Правило описывает роль ИИ как .NET-эксперта и автора open-source, который должен убедиться, что проект содержит правильный .csproj с флагом <PackAsTool>true</PackAsTool>, метаданные пакета (PackageId, Authors, Description, License) и полную документацию с примерами использования и FAQ.
При подготовке проекта агент проверяет зависимости, нацеливает сборку на .NET 8 (если нет явных требований к другой версии) и добавляет <RollForward>LatestMajor</RollForward> для автоматической совместимости с новыми runtime. На этапе упаковки используется команда dotnet pack для генерации .nupkg-файла с верификацией содержимого и локального установки инструмента.
Правило применяется к файлам .cursor/rules/, .claude/rules/ и аналогичных директорий IDE, актуально для разработчиков, которые публикуют собственные dotnet-инструменты и хотят автоматизировать проверку качества с помощью Cursor или Claude Code.
Какие задачи решает
- проверить соответствие dotnet-инструмента семантическому версионированию
- убедиться, что проект правильно упакован как NuGet-пакет
- валидировать метаданные и зависимости перед публикацией
- задать совместимость инструмента с новыми версиями .NET без переиздания
Примеры запросов агенту
- Создай dotnet-инструмент с правильной конфигурацией для публикации в NuGet
- Проверь, что мой проект содержит
<PackAsTool>true</PackAsTool>и все нужные метаданные - Упакуй и протестируй инструмент перед выпуском нового релиза
Как установить publishing-dotnettool
Вручную: положить файлы
.cursor/rules/publishing-dotnettool.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/publishing-dotnettool.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/publishing-dotnettool.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/publishing-dotnettool.mdВручную: положить файлы
.clinerules/publishing-dotnettool.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о publishing-dotnettool
Как установить правило publishing-dotnettool в Claude Code?
Скопируй файл правила в директорию .claude/rules/publishing-dotnettool.md в корне проекта. Claude Code автоматически подхватит его при работе с dotnet-инструментами.
Что делает это правило?
Направляет ИИ-агента на проверку и применение best practices при создании dotnet-инструментов: семантическое версионирование, правильная упаковка в NuGet, совместимость с разными версиями .NET, полная документация.
Какую версию .NET должен использовать инструмент?
По умолчанию правило рекомендует .NET 8 (текущий LTS). Если проект нацелен на другую версию или multi-target, инструмент это учитывает. Добавь <RollForward>LatestMajor</RollForward> для совместимости с новыми runtime.
Исходный текст
publishing-dotnettool.mdc · Apache-2.0
---
description: This file serves as a guideline for the Cursor AI Agent to ensure the proper creation, packaging, and publishing of a `dotnet tool`. Follow these rules to maintain consistency, quality, and security across published tools.
globs:
alwaysApply: false
---
# Cursor Rules File: Best Practices for Publishing a dotnet Tool
# This file serves as a guideline for the Cursor AI Agent to ensure the proper
# creation, packaging, and publishing of a dotnet tool. Follow these rules to
# maintain consistency, quality, and security across published tools.
Role Definition:
- .NET Expert
- OSS author
- Aware that users running on multiple versions of .NET in different environments might need access to this tool
General:
Description: >
The dotnet tool must be packaged as a NuGet package that adheres to
semantic versioning, proper dependency management, and includes comprehensive
documentation. This file outlines the steps and checks that need to be performed.
Requirements:
- Use a project file (.csproj) with the property <PackAsTool>true</PackAsTool>
- Follow semantic versioning (MAJOR.MINOR.PATCH)
- Ensure the tool is documented with a README and inline help support
Preparation:
- Validate that the project file includes:
- <PackAsTool>true</PackAsTool>
- Proper versioning and package metadata (e.g., PackageId, Authors, Description, License)
- Include a detailed README file with:
- Installation instructions (e.g., `dotnet tool install -g <package-id>`)
- Usage examples and command options
- Troubleshooting and FAQ sections
- Confirm that all dependencies are explicitly declared
- Always target the most recent long-term release of .NET (currently .NET 8) unless the project is explicitly set to multi-target or targets and older version of the runtime
- Always include a `<RollForward>LatestMajor</RollForward>` so the tool can automatically be used with newer runtimes without a new version needing to be released
Packaging:
- Use the `dotnet pack` command to generate the NuGet package:
- Ensure that all necessary files (binaries, assets, configuration files) are included
- Verify that the output .nupkg file contains the expected metadata and assets
- Run tests to verify that the tool functions correctly in a local install scenario
# End of Cursor Rules File
© Aaronontheweb · Apache-2.0 · Aaronontheweb/dotnet-cursor-rules