本文へ移動
cccskills
無料GitHub で公開

dotnet-agent-harness-hooks

Hooks and MCP server guide for dotnet-agent-harness. How hooks behave, how to disable them, MCP configuration and troubleshooting.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

dotnet-agent-harness-hooks

Source: dotnet-artisan (MIT) — Claire Novotny LLC. Ported into dotnet-agent-harness.

This guide explains the hook patterns and MCP server integration used by the dotnet-agent-harness ecosystem.


Hooks overview

Hooks fire automatically during Claude Code sessions. They provide .NET-focused defaults and suggestions.

PostToolUse hook (Write|Edit)

A single hook entry with matcher Write|Edit dispatches to scripts/hooks/post-edit-dotnet.sh, which inspects the edited file's extension and takes the appropriate action.

File patternBehaviorDetails
*Tests.cs, *Test.csSuggests running related testsOutputs a systemMessage with a dotnet test --filter command targeting the modified test class
*.csAuto-formats with dotnet formatRuns dotnet format --include <file> asynchronously; reports results on the next turn
*.csprojSuggests dotnet restoreOutputs a systemMessage recommending restore after project file changes
*.xamlValidates XML well-formednessUses xmllint or falls back to python3 xml.etree.ElementTree; reports validation errors

This hook runs asynchronously (async: true) with a 60-second timeout. It never blocks editing (always exits 0).

SessionStart hook (startup)

The scripts/hooks/session-start-context.sh hook fires once when a new Claude Code session starts. It detects whether the current directory is a .NET project and injects context.

  • Counts .sln/.slnx solution files (up to 3 directories deep)
  • Counts .csproj project files (up to 3 directories deep)
  • Checks for global.json
  • Extracts the target framework moniker (TFM) from the first .csproj found

If .NET project indicators are found, the hook outputs an additionalContext message such as:

This is a .NET project (net10.0) with 3 project(s) in 1 solution(s).

This context helps Claude understand the project environment from the start of the session.


How to disable hooks

Plugin hooks can be disabled in two ways:

  1. Disable all hooks globally: set disableAllHooks: true in your .claude/settings.json file. This disables hooks from all plugins.
  2. Per-session control: use the /hooks menu within Claude Code to review and toggle individual hooks during a session. Hooks snapshot at session startup; changes via /hooks take effect immediately but do not persist across restarts.

To re-enable hooks after disabling, remove the disableAllHooks setting or toggle them back on via /hooks.


MCP server configuration

The plugin configures the following MCP server in .mcp.json.

Context7

PropertyValue
Transportstdio
Commandnpx -y @upstash/context7-mcp@latest
PurposeLibrary documentation lookup covering Microsoft Learn, NuGet, and .NET ecosystem docs

Context7 provides on-demand documentation lookups that enhance skill guidance with live, up-to-date library references.

Version note: The plugin currently uses @latest for initial ship. After stabilization, the version may be pinned (for example @1.x.x) to prevent upstream breaking changes.

Requirements

  • Node.js is required for MCP servers that use npx. Verify Node.js is installed by running node --version in your terminal. You can also check MCP server status with the /mcp command inside Claude Code.
  • MCP servers start automatically when the plugin is enabled. After enabling or disabling the plugin, restart Claude Code to apply MCP server changes.

Troubleshooting

dotnet not found

The PostToolUse hook checks for dotnet in PATH before running dotnet format. If the .NET SDK is not installed or not in PATH, the hook degrades gracefully: it outputs a warning message and exits 0 without blocking.

Fix: install the .NET SDK and ensure dotnet is available in your shell's PATH.

npx not available

MCP servers configured with npx (such as Context7) will not start if Node.js is not installed.

Fix: install Node.js (LTS recommended). After installation, restart Claude Code so MCP servers can initialize.

Hooks not firing

Hooks are snapshotted when a Claude Code session starts. If you install or update the plugin mid-session, hooks from the new version will not fire until the next session.

Fix: restart Claude Code to pick up hook changes. Use /hooks to verify hooks are registered.

jq not found

The hook scripts use jq to parse JSON input from stdin. If jq is not installed, the hook scripts will fail. The post-edit-dotnet.sh script requires jq for extracting the file_path from tool input.

Fix: install jq via your system package manager.

  • macOS: brew install jq
  • Ubuntu/Debian: sudo apt-get install jq
  • Windows: winget install jqlang.jq

XAML validation unavailable

The XAML well-formedness check requires either xmllint or python3. If neither is available, the hook skips validation and reports a warning.

Fix: install libxml2-utils (for xmllint) or ensure python3 is in your PATH.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Patterns and techniques for evaluating and improving AI agent outputs.

日本語の概要は準備中です。原文の説明を表示しています。

rudironsoni/Synaxis22026年3月17日 更新

Comprehensive AI prompt engineering safety review and improvement prompt. Analyzes prompts for safety, bias, security vulnerabilities, and effectiveness while providing detailed improvement recommendations.

日本語の概要は準備中です。原文の説明を表示しています。

rudironsoni/Synaxis22026年3月17日 更新

Use when user requests research requiring multiple sources, comprehensive analysis, or synthesis across topics - technical research, domain knowledge gathering, market analysis, or learning about complex subjects

日本語の概要は準備中です。原文の説明を表示しています。

rudironsoni/Synaxis22026年3月17日 更新

deep-wiki

無料

AI-powered wiki generation for code repositories with commands, agents, and skills

日本語の概要は準備中です。原文の説明を表示しています。

rudironsoni/Synaxis22026年3月17日 更新

Use when building .NET 10 or C# 14 applications; when using minimal APIs, modular monolith patterns, or feature folders; when implementing HTTP resilience, Options pattern, Channels, or validation; when seeing outdated patterns like old extension method syntax

日本語の概要は準備中です。原文の説明を表示しています。

rudironsoni/Synaxis22026年3月17日 更新

Implements accessible .NET UI. SemanticProperties, ARIA, AutomationPeer, testing per platform.

日本語の概要は準備中です。原文の説明を表示しています。

rudironsoni/Synaxis22026年3月17日 更新

rudironsoni のスキルをすべて見る

このスキルの問題を報告する