Logo van Code Review Csharp

Code Review Csharp

Organisatie
pnp
code-review-csharp

Perform structured code reviews of C# source code covering naming conventions, performance, security, readability, and .NET best practices. Trigger phrases include "review this C# code", "check my C# for best practices", "analyze this C# class", "find issues in my C# code".

Overzicht

Uitgeverpnp
Repositorycopilot-prompts
Skillnaamcode-review-csharp
Sterren
894
Forks
307
Meegeleverde bestanden
1
LicentieMIT
Links
  • Instructies in Markdown

    Een SKILL.md-bestand dat het model laadt wanneer nodig, zodat het alleen tokens kost als een verzoek er daadwerkelijk bij past.

  • Werkt met elk LLM

    AI-skills zijn gewone Markdown, geen aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • 1 meegeleverde bestanden

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. Bestanden zijn alleen-lezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door pnp op GitHub. Lees de broninhoud voordat je de skill installeert.

Installatie

Installeer de AI-skill Code Review Csharp in TypingMind om deze met elke LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map — het leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/pnp/copilot-prompts/tree/main/samples/skills/code-review-csharp
  4. Schakel de skill in elke chat in waarin je deze beschikbaar wilt hebben.
Plug-ins → Skills → Nieuwe skill → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pnp/copilot-prompts.git /tmp/copilot-prompts
mkdir -p .claude/skills
cp -r /tmp/copilot-prompts/samples/skills/code-review-csharp .claude/skills/code-review-csharp
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Code Review Csharp in een willekeurige chat in TypingMind in en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek erbij past, laadt het model zelf de volledige instructies — je hoeft de skill nooit handmatig aan te roepen en deze kost pas tokens wanneer je de skill daadwerkelijk gebruikt.

Het model laadt Code Review Csharp automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Code Review Csharp niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Review C# Code for Best Practices

Perform a structured code review of C# source code. Identify issues related to naming conventions, performance, security, readability, and .NET best practices. Produce a prioritized report with actionable suggestions.

Gather Context

Before reviewing, determine:

  1. Code to review — the C# file, class, or snippet. If the user points to a file, read it. If they paste code, use it directly.
  2. Review focus — what to prioritize:
    • all (default) — full review across all categories
    • naming — naming conventions only
    • performance — performance and memory only
    • security — security vulnerabilities only
    • readability — clarity, structure, and maintainability only
  3. Target framework — the .NET version. Default to .NET 8 if not specified. Auto-detect from <TargetFramework> in .csproj if accessible.
  4. Severity threshold — all (default), warnings-and-above, or critical-only.

If context is missing: Default to all focus, .NET 8, and all severities. Don't block the review to ask — just state your assumptions at the top of the report. Only ask if you genuinely have no code to review.

Report Format

markdown
# Code Review: {FileName or ClassName}

> Target: .NET {version} | Focus: {focus} | Reviewed: {date}

## Summary

{One-paragraph overview. Lead with the most important finding. State the total issue count by severity.}

## Issues

| # | Severity | Location | Issue | Why It Matters | Suggestion |
|---|----------|----------|-------|----------------|------------|
| 1 | Critical | `Class.Method:L12` | {issue} | {impact} | {fix} |
| 2 | Warning  | `Class.Property`   | {issue} | {impact} | {fix} |
| 3 | Info     | `Class.Method:L25` | {issue} | {impact} | {fix} |

## What's Done Well

- {Positive pattern — be specific, not generic}

## Recommendations

1. **[Critical]** {Highest-impact change}
2. **[Warning]** {Next priority}
3. ...

Severity levels:

  • Critical — bugs, security vulnerabilities, data loss risks. Fix immediately.
  • Warning — convention violations, performance pitfalls, maintainability concerns. Fix soon.
  • Info — style preferences, minor modernization opportunities. Fix when convenient.

Review Categories

1. Structure and Design

  • Single Responsibility Principle — does the class do too many things?
  • File length and class complexity
  • Namespace organization
  • Unnecessary or missing using directives
  • Dependency injection — is new used where DI should be?
  • Constructor complexity — too many dependencies suggests SRP violation
  • Proper use of sealed on classes not designed for inheritance

2. Naming Conventions

Verify against C# Coding Conventions:

ElementConventionExample
Classes, records, structsPascalCaseUserManager
InterfacesI + PascalCaseIUserRepository
MethodsPascalCaseGetUserById
PropertiesPascalCaseFirstName
Public constants/staticsPascalCaseMaxRetryCount
Private fields_camelCase_userCount
Local variables, parameterscamelCaseuserId
Enum types and valuesPascalCaseOrderStatus.Pending
Type parametersT + PascalCaseTEntity, TKey
Async methodsPascalCase + Async suffixGetUserAsync
BooleansIs/Has/Can/Should prefixIsActive, HasPermission
Event handlersPascalCase + EventArgsOnUserCreated

3. Performance

Check for:

  • String concatenation in loops → suggest StringBuilder or string.Join
  • Unnecessary allocations: boxing, repeated ToList(), new in hot paths
  • async void → should be async Task (except event handlers)
  • Task.Result or Task.Wait() → deadlock risk, use await instead
  • Missing ConfigureAwait(false) in library code
  • Sync-over-async (Task.Run(() => AsyncMethod().Result))
  • IEnumerable multiple enumeration → materialize with ToList() or use IReadOnlyList
  • LINQ misuse: Count() > 0 → Any(), .Count() on ICollection → .Count
  • Missing IDisposable / using / await using for disposable resources
  • Unnecessary Task.Run on already-async code
  • Large struct types being copied repeatedly (consider ref or class)

4. Security

Check for:

  • SQL injection — string concatenation or interpolation in SQL → use parameterized queries
  • Hardcoded secrets — connection strings, API keys, passwords in source → use configuration/secrets management
  • Missing input validation — public method parameters not validated → add guard clauses
  • Exception information leakage — returning stack traces or internal messages to callers → use generic error responses
  • Null safety — missing null checks, inconsistent nullable reference type annotations
  • Insecure cryptography — MD5/SHA1 for security purposes, custom crypto → use standard libraries
  • Unsafe deserialization — BinaryFormatter, TypeNameHandling.All in JSON → use safe serializers
  • Path traversal — user input in file paths without sanitization
  • HttpClient misuse — creating new instances per request → use IHttpClientFactory
  • LINQ injection — dynamic LINQ from user input without sanitization

5. Readability and Maintainability

Check for:

  • Methods over ~30 lines → suggest extraction
  • Deeply nested conditionals (3+ levels) → suggest guard clauses or early returns
  • Magic numbers and strings → extract to named constants
  • Outdated or misleading comments (worse than no comments)
  • Missing XML doc comments on public API members
  • Inconsistent formatting and whitespace
  • Modern C# opportunities (based on target framework):
    • Pattern matching (is, switch expressions)
    • File-scoped namespaces (.NET 6+)
    • Primary constructors (.NET 8+)
    • Records for immutable data types
    • var usage consistency
    • Collection expressions (.NET 8+)
    • Raw string literals (.NET 7+)
    • required properties (.NET 7+)

Rules

Do:

  • Explain why each issue matters, not just what to change
  • Be specific about locations — class name, method name, and line number where possible
  • Acknowledge good patterns — at least 1-2 things done well. A review that only lists problems is demoralizing.
  • Respect the target framework — don't suggest .NET 8 features for a .NET 6 project
  • Sort issues by severity: Critical → Warning → Info
  • If the code has no issues, say so. Don't invent problems to fill a report.
  • If asked to fix issues (not just review), apply the changes directly

Don't:

  • Modify code unless the user explicitly asks you to apply fixes
  • Flag framework-specific features as issues when they match the target version
  • Report false positives — every issue must be verifiable in the code
  • Be vague — "consider improving performance" is not actionable. Say exactly what to change and why.
  • Overwhelm with low-severity noise — if there are many Info items, summarize them rather than listing each one

Example

Input:

csharp
public class userManager
{
    string connStr = "Server=prod;Password=admin123";

    public void deleteUser(int id)
    {
        var sql = "DELETE FROM Users WHERE Id = " + id;
        // execute sql
    }

    public List<string> GetNames(List<User> users)
    {
        List<string> result = new List<string>();
        for (int i = 0; i < users.Count; i++)
        {
            result.Add(users[i].FirstName + " " + users[i].LastName);
        }
        return result;
    }
}

Output:

Code Review: userManager

Target: .NET 8 (assumed) | Focus: all | Reviewed: 2026-02-18

Summary

This class has 2 critical security issues that need immediate attention: hardcoded credentials and a SQL injection vulnerability. There are also naming convention violations and missed opportunities for modern C# patterns. 6 issues total (2 Critical, 3 Warning, 1 Info).

Issues

#SeverityLocationIssueWhy It MattersSuggestion
1CriticaluserManager.connStrHardcoded connection string with plaintext passwordCredentials in source code end up in version control and are trivially extractableMove to appsettings.json + secrets management (e.g., Azure Key Vault, User Secrets for dev)
2CriticaluserManager.deleteUser:L6SQL injection via string concatenationAttacker-controlled input can execute arbitrary SQLUse parameterized queries or an ORM (e.g., Entity Framework, Dapper with parameters)
3WarningClass declarationuserManager violates PascalCase conventionInconsistent naming makes the codebase harder to navigateRename to UserManager
4WarningdeleteUser methodMethod name violates PascalCase conventionSame as aboveRename to DeleteUser
5WarningconnStr fieldPrivate field missing _ prefix and access modifierImplicit private is less readable; missing prefix breaks conventionRename to _connectionString with explicit private
6InfoGetNames methodManual loop with string concatenation where LINQ would be clearerLINQ expresses intent more directly and reduces boilerplateusers.Select(u => $"{u.FirstName} {u.LastName}").ToList()

What's Done Well

  • GetNames returns a clearly typed List<string> — good use of explicit return types
  • Method names are descriptive of their intent (deleteUser, GetNames)

Recommendations

  1. [Critical] Remove hardcoded credentials — externalize all secrets to configuration
  2. [Critical] Replace concatenated SQL with parameterized queries throughout the codebase
  3. [Warning] Apply consistent PascalCase naming to all classes, methods, and properties
  4. [Info] Modernize GetNames with LINQ and string interpolation

Pre-Delivery Checklist

Before finalizing the report, verify:

  • Every reported issue is real and verifiable in the code — no false positives
  • Each issue has a severity, location, explanation, and actionable suggestion
  • At least 1-2 positive patterns acknowledged
  • Recommendations are ordered by impact
  • Suggestions are compatible with the target .NET version
  • Security issues (if any) are marked Critical
  • Report follows the defined format

Meegeleverde bestanden

Het model leest deze bestanden wanneer nodig terwijl de skill geladen is. Ze worden beschikbaar gesteld als leesbare bestanden en worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Code Review Csharp?

Perform structured code reviews of C# source code covering naming conventions, performance, security, readability, and .NET best practices. Trigger phrases include "review this C# code", "check my C# for best practices", "analyze this C# class", "find issues in my C# code".

Waarom Code Review Csharp gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Code Review Csharp bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model, en je kunt midden in een chat van model wisselen zonder dat de skill niet meer werkt. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Code Review Csharp in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/pnp/copilot-prompts/tree/main/samples/skills/code-review-csharp. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Code Review Csharp gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Code Review Csharp gebruiken?

Zoveel als je wilt. Zolang een model skills ondersteunt, kun je Code Review Csharp ermee gebruiken: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama en meer. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Code Review Csharp gratis?

Ja. Deze skill is door pnp op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. Deze volgt het open Agent Skills-formaat: een bestand met de naam SKILL.md met een naam en beschrijving, plus eventuele scripts, sjablonen of referentiebestanden die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇