dotnet-harden

dotnet-harden is a command for Claude Code from mathisk2095/jko-claude-plugins. It costs 33 tokens per session (984 once invoked), scanned A, original, MIT.

A review and hardening command for .NET backend code, which is software built with Microsoft’s .NET platform.

In plain words
What is it for?
Use it to inspect selected .NET projects, folders, or files and check APIs, background services, database access, dependency injection, and SignalR connections.
Why use it?
It looks for coding patterns that can cause blocked requests, incorrect service lifetimes, oversized endpoints, database misuse, or fragile real-time connections.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the dotnet-backend plugin — 1 skill, 4 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/mathisk2095/jko-claude-plugins/dotnet-harden
Clone the repo
git clone --depth 1 https://github.com/mathisk2095/jko-claude-plugins

Made for: Claude Code.

Or install dotnet-backend, the plugin that ships this one along with the rest of its 1 skill, 4 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dotnet-harden

README.md
[![agentmods](https://agentmods.dev/badge/commands/mathisk2095/jko-claude-plugins/dotnet-harden.svg)](https://agentmods.dev/commands/mathisk2095/jko-claude-plugins/dotnet-harden)
Your own site
<a href="https://agentmods.dev/commands/mathisk2095/jko-claude-plugins/dotnet-harden"><img src="https://agentmods.dev/badge/commands/mathisk2095/jko-claude-plugins/dotnet-harden.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 984 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.00984
Opus 5 $0.00016 $0.00492
Sonnet 5 $0.00007 $0.00197
Haiku 4.5 $0.00003 $0.00098

Measured 5d ago against content hash 4653a4ce887d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

dotnet-harden scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/dotnet-backend/commands/dotnet-harden.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Harden the .NET backend. If $ARGUMENTS is provided, focus on that project, directory, or file. Otherwise target the main backend projects.

First: Use the dotnet-backend-expert skill and read references/anti-patterns.md, references/dependency-injection.md, references/concurrency.md, references/data-access.md, references/signalr.md, and references/kestrel-hosting.md.

Preparation

  1. Detect the solution, SDK, and backend entry projects.
  2. Determine whether the code uses minimal APIs, controllers, SignalR hubs, workers, AppHost, EF Core, Dapper, or mixed data access.
  3. Read the composition root before making any changes.

High-Value Scans

Run targeted scans for patterns that frequently produce production bugs:

# Sync-over-async and blocking (DN-12)
rg -n '(\.Result\b|\.Wait\(|GetAwaiter\(\)\.GetResult\()' . --glob '*.cs'

# Hidden runtime resolution / service locator (DN-04)
rg -n '(IServiceProvider|GetService\(|GetRequiredService\(|CreateScope\()' . --glob '*.cs'

# Static mutable state (DN-06)
rg -n 'static\s+(?!readonly)' . --glob '*.cs'

# DbContext misuse in endpoints, hubs, or singletons (DN-07, DN-01, DN-02)
rg -n '(DbContext|ApplicationDbContext)' . --glob '*.cs'

# Task.Run inside request/endpoint code (often DN-12 or DN-13)
rg -n 'Task\.Run\(' . --glob '*.cs'

# Fire-and-forget tasks (DN-13)
rg -n '(_\s*=\s*Task\.|Task\.Factory\.StartNew|async void)' . --glob '*.cs'

# New HttpClient instead of factory/typed client
rg -n 'new\s+HttpClient\(' . --glob '*.cs'

# Generic base abstractions and ceremony-heavy layers (DN-18, DN-10)
rg -n '(BaseService|BaseRepository|IGenericRepository|GenericRepository)' . --glob '*.cs'

# In-memory SignalR truth and fragile connection bookkeeping (DN-15)
rg -n '(ConnectionId|ConcurrentDictionary<.*connection|Dictionary<.*connection|Groups\.)' . --glob '*.cs'

# Kestrel / forwarded header posture and explicit hosting choices
rg -n '(UseForwardedHeaders|ForwardedHeaders|KnownProxies|KnownNetworks|Kestrel|ListenAnyIP|ListenLocalhost|MaximumReceiveMessageSize|KeepAliveInterval|ClientTimeoutInterval)' . --glob '*.cs'

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 98 lines · 33 tokens per session scan A 4653a4ce887d

Subscribe to this mod's changes

dotnet-harden is a command published in the GitHub repository mathisk2095/jko-claude-plugins (3 stars, last pushed 2d ago), licensed MIT. It adds 33 tokens to every session and 984 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.