К основному содержанию
правило CX Codex

consuming-dotnettool — правило для Claude Code: установка

Правило consuming-dotnettool для Claude Code организует локальные .NET-инструменты через manifest-файл, фиксирует версии и добавляет их восстановление в CI/CD.

Apache-2.0 ★ 138 обновлён 2025-03-29

Установить в Cursor · Вручную: положить файлы Все способы и платформы ↓
.cursor/rules/consuming-dotnettool.mdc
Открыть на GitHub

Что делает consuming-dotnettool

consuming-dotnettool задаёт порядок работы с зависимостями dotnet tool в .NET-проектах. Оно требует хранить manifest в .config/dotnet-tools.json, указывать явные версии и добавлять файл в систему контроля версий. Для нового manifest используется dotnet new tool-manifest, а инструменты добавляются через dotnet tool install <tool-package> --version <version>.

Правило описывает установку, обновление и проверку инструментов, а также документацию в README или contributing guidelines. В CI/CD нужно запускать dotnet tool restore до сборки или тестов и проверять, что версии в manifest не изменились самовольно. Отдельные рекомендации касаются доверенных источников, лицензий и отказа от диапазонов версий.

В CI/CD dotnet tool restore должен выполняться до build или test, иначе этот процесс не восстановит инструменты из manifest заранее.

Какие задачи решает

  • создать manifest для локальных .NET-инструментов
  • зафиксировать версии dotnet tool в проекте
  • восстановить инструменты перед сборкой и тестами
  • обновить инструмент с заданной версией
  • проверить manifest на устаревшие зависимости

Примеры запросов агенту

  • Проверь, как подключить dotnet tool к этому проекту через .config/dotnet-tools.json.
  • Создай manifest командой dotnet new tool-manifest и добавь в него <tool-package> версии <version>.
  • Подготовь шаги CI/CD: восстановление через dotnet tool restore, проверка версий и описание инструментов в README.

Как установить consuming-dotnettool

Вручную: положить файлы

.cursor/rules/consuming-dotnettool.mdc

Во frontmatter: description, globs, alwaysApply

По шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules

Вопросы о consuming-dotnettool

Как установить consuming-dotnettool в Claude Code?

Создайте файл правила по пути .claude/rules/consuming-dotnettool.md и поместите туда содержимое consuming-dotnettool.

Что делает consuming-dotnettool?

Правило помогает вести зависимости dotnet tool через manifest, фиксировать версии, восстанавливать инструменты локально и в CI/CD и документировать их назначение.

С какими платформами работает consuming-dotnettool?

Правило предназначено для Claude Code и Cursor. Для Claude Code используется путь .claude/rules/consuming-dotnettool.md, для Cursor — .cursor/rules/consuming-dotnettool.mdc.

Исходный текст

consuming-dotnettool.mdc · Apache-2.0
---
description: This tool is used for helping manage and organize the installation of `dotnet tool` instances that are used for .NET projects.
globs: 
alwaysApply: false
---

# Cursor Rules File: Best Practices for Consuming dotnet Tool Instances
# This file provides guidelines for projects that depend on dotnet tools. It ensures that:
# - A tool manifest is maintained for local and CI/CD consistency.
# - Tool versions are explicitly defined.
# - Proper installation, updating, and documentation practices are followed.

General:
  Description: >
    Projects consuming dotnet tool instances must manage their tool dependencies through a tool manifest.
    This approach promotes reproducible builds and clear dependency management, ensuring that the correct
    tool versions are used consistently across different environments.
  Requirements:
    - Maintain a tool manifest file (typically located at `.config/dotnet-tools.json`) in the project root.
    - Use explicit versioning for all dotnet tools to prevent unexpected updates.
    - Integrate tool management into the CI/CD pipeline for automated restoration.

Preparation:
  - If a tool manifest does not exist, create one by running:
      - `dotnet new tool-manifest`
  - Update the tool manifest with the necessary tools by executing:
      - `dotnet tool install <tool-package> --version <version>`
  - Ensure the manifest file (`.config/dotnet-tools.json`) is checked into version control for consistency.

Tool Management:
  - Installation:
      - Use `dotnet tool install` with an explicit version to add a tool to the manifest.
      - Verify that the installed tool versions match the ones specified in the manifest.
      - For tools that support both global and local installation, prefer local installation via manifest.
  - Updating:
      - To update a tool, use `dotnet tool update <tool-package> --version <version>`.
      - After updating, validate that the manifest reflects the new version.
  - Restoration:
      - Ensure that `dotnet tool restore` is executed as part of local setup and CI/CD processes to install all tools defined in the manifest.
  - Verification:
      - Periodically review the manifest to confirm that all tool versions are current and that deprecated or unused tools are removed.

Integration & CI/CD:
  - Include the following steps in your CI/CD pipeline:
      - **Restore Tools:** Run `dotnet tool restore` prior to build or test phases.
      - **Version Check:** Validate that the manifest has not drifted from the expected tool versions.
      - **Cache Tools:** Consider caching the restored tools between pipeline runs to improve build times.
  - Document the usage of these tools in your project README or contributing guidelines for clarity.

Documentation & Maintenance:
  - Document in your project README:
      - The purpose of each dotnet tool listed in the manifest.
      - Instructions for installing, updating, or troubleshooting the tools.
  - Regularly audit the manifest to:
      - Remove outdated or unused tools.
      - Update tools when new versions become available and are verified for compatibility.
  - Maintain clear commit messages when changes are made to the tool manifest.

Security & Compliance:
  - Ensure that all tools come from trusted sources and have proper licensing.
  - Avoid using wildcard or range versioning to mitigate the risk of unintentional upgrades.
  - Document any security advisories or considerations related to the consumed tools.

Automation:
  - Automate tool restoration by incorporating `dotnet tool restore` into your build scripts.
  - Consider using scripts or CI/CD tasks to:
      - Check for available updates to the tools.
      - Validate the integrity and security compliance of the manifest file.
      - Monitor for security advisories related to installed tools.
      - Automatically create PRs for tool updates after successful testing.
      
# End of Cursor Rules File

© Aaronontheweb · Apache-2.0 · Aaronontheweb/dotnet-cursor-rules

Похожие правила IDE

Все правила IDE по теме «Языки программирования» →
dotnet-devcert-trust Aaronontheweb Скилл dotnet-devcert-trust для Claude Code диагностирует доверие к HTTPS-сертификатам .NET в Linux. Он включается при ошибках TLS в localhost, Redis или вызовах Aspire. CX Codex +1 468установок migrate-vstest-to-mtp dotnet Скилл migrate-vstest-to-mtp помогает перевести тестовые проекты .NET с VSTest на Microsoft.Testing.Platform: правит Directory.Build.props, global.json и аргументы dotnet test. CX Codex +1 4 300установок setup-local-sdk dotnet Скилл setup-local-sdk ставит .NET SDK в папку .dotnet/ внутри проекта и подключает его через global.json, не трогая системную установку. CX Codex +1 4 000установок dotnet-local-tools Aaronontheweb Скилл dotnet-local-tools объясняет, как вести локальные .NET CLI-инструменты через .config/dotnet-tools.json, чтобы у команды и в CI были одинаковые версии. CX Codex +1 560установок powershell-7-expert VoltAgent Community Субагент powershell-7-expert пишет кроссплатформенные сценарии PowerShell 7+ и автоматизирует инфраструктуру Azure, Entra и GitHub Actions. Помогает перевести старые скрипты на синтаксис .NET 6/7. CX Codex 256установок dotnet-upgrade официальный github Правило dotnet-upgrade ведёт поэтапное обновление .NET-решения: от анализа проектов и зависимостей до сборки, тестов и проверки CI/CD. CX Codex +1 ★ 41 430звёзд репо

Из того же набора11

Весь набор →
meta Правило meta задаёт, как менять файлы .mdc в репозитории: сохранять форматирование и обновлять существующие правила, а не плодить новые без причины. CX Codex +1 ★ 138звёзд репо publishing-dotnettool Правило publishing-dotnettool для Claude Code и Cursor направляет ИИ-агента при создании и публикации dotnet-инструментов в NuGet. Гарантирует семантическое версионирование, правильную упаковку и совместимость с разными версиями .NET. CX Codex +1 ★ 138звёзд репо code-signing Правило code-signing задаёт стандарты подписи сборок и пакетов NuGet через SignClient в проектах на .NET. Применяется при настройке CI/CD. CX Codex +1 ★ 138звёзд репо dependency-management Правило dependency-management для безопасного управления NuGet-зависимостями: проверка уязвимостей, совместимость лицензий, версионирование через dotnet CLI. Применяется к файлам проекта автоматически. CX Codex +1 ★ 138звёзд репо solution-management Правило solution-management задаёт стандарты организации решений .NET: фиксирует версии SDK, общие свойства сборки и централизованное управление NuGet-пакетами. CX Codex +1 ★ 138звёзд репо benchmarking Правило benchmarking для Claude Code учит агента писать корректные тесты производительности .NET через BenchmarkDotNet. Тесты измеряют скорость кода и отслеживают регрессии. CX Codex +1 ★ 138звёзд репо nuget-package-publishing Правило nuget-package-publishing, которое учит агента упаковывать .NET-библиотеки в NuGet по стандартам: с SPDX-лицензией, README и символами для отладки. CX Codex +1 ★ 138звёзд репо testing Правило testing задаёт стандарты написания тестов на C# с xUnit: настройку .NET 8 проектов, фикстуры, проверку покрытия кода и запуск интеграционных тестов. CX Codex +1 ★ 138звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой