Skip to content
Back to skills

Csharp

ASecurity

Write robust C# avoiding null traps, async deadlocks, and LINQ pitfalls.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 6, 2026
databasesc#databaseperformance

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add clawic/skills --skill csharp --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Csharp?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Csharp
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/clawic-csharp/badge)](https://www.skillsdirectory.com/skills/clawic-csharp)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: C#
slug: csharp
version: 1.0.1
description: Write robust C# avoiding null traps, async deadlocks, and LINQ pitfalls.
homepage: https://clawic.com/skills/csharp
metadata:
  clawdbot:
    emoji: 💜
    requires:
      bins:
      - dotnet
    os:
    - linux
    - darwin
    - win32
    displayName: C#
---

## Quick Reference

| Topic | File |
|-------|------|
| Null reference, nullable types | `nulls.md` |
| Async/await, deadlocks | `async.md` |
| Deferred execution, closures | `linq.md` |
| Value vs reference, boxing | `types.md` |
| Iteration, equality | `collections.md` |
| IDisposable, using, finalizers | `dispose.md` |

## Critical Rules

- `?.` and `??` prevent NRE but `!` overrides warnings — still crashes if null
- `.Result` or `.Wait()` on UI thread — deadlock, use `await` or `ConfigureAwait(false)`
- LINQ is lazy — `query.Where(...)` doesn't execute until iteration
- Multiple enumeration of IEnumerable — may re-query database, call `.ToList()` first
- Closure captures variable, not value — loop variable in lambda captures last value
- Struct in async method — copied, modifications lost after await
- String comparison culture — `StringComparison.Ordinal` for code, `CurrentCulture` for UI
- `GetHashCode()` must be stable — mutable fields break dictionary lookup
- Modifying collection while iterating — throws, use `.ToList()` to iterate copy
- `decimal` for money — `float`/`double` have precision loss
- `readonly struct` prevents defensive copies — use for performance
- `sealed` prevents inheritance — enables devirtualization optimization

Files in this skill

  • SKILL.md1.6 KB
  • _meta.json236 B
  • async.md782 B
  • collections.md636 B
  • dispose.md608 B
  • linq.md729 B
  • nulls.md641 B
  • types.md676 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…