---
title: "C# Hooks"
description: "> This file extends [common/hooks.md](../common/hooks.md) with C#-specific content."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/hooks-23
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:25:13.385Z
license: CC-BY-4.0
attribution: "C# Hooks — Claudary (https://claudary.paisolsolutions.com/skills/hooks-23)"
---

# C# Hooks
> This file extends [common/hooks.md](../common/hooks.md) with C#-specific content.

## Overview

---
paths:
  - "**/*.cs"
  - "**/*.csx"
  - "**/*.csproj"
  - "**/*.sln"
  - "**/Directory.Build.props"
  - "**/Directory.Build.targets"
---
# C# Hooks

> This file extends [common/hooks.md](../common/hooks.md) with C#-specific content.

## PostToolUse Hooks

Configure in `~/.claude/settings.json`:

- **dotnet format**: Auto-format edited C# files and apply analyzer fixes
- **dotnet build**: Verify the solution or project still compiles after edits
- **dotnet test --no-build**: Re-run the nearest relevant test project after behavior changes

## Stop Hooks

- Run a final `dotnet build` before ending a session with broad C# changes
- Warn on modified `appsettings*.json` files so secrets do not get committed

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/hooks-23) · https://claudary.paisolsolutions.com
