شعار Code Review Csharp

Code Review Csharp

مؤسسة
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".

نظرة عامة

الناشرpnp
المستودعcopilot-prompts
اسم المهارةcode-review-csharp
النجوم
894
التفريعات
307
الملفات المرفقة
1
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 1

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها pnp على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Code Review Csharp في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/pnp/copilot-prompts/tree/main/samples/skills/code-review-csharp
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

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
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Code Review Csharp في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Code Review Csharp تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Code Review Csharp بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

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

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة أثناء تحميل المهارة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي 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".

لماذا تستخدم Code Review Csharp على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Code Review Csharp عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Code Review Csharp في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/pnp/copilot-prompts/tree/main/samples/skills/code-review-csharp. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Code Review Csharp؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Code Review Csharp؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Code Review Csharp معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Code Review Csharp مجانية؟

نعم. نشرها pnp على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇