Enforces C# coding standards for Project KONGOR, including naming conventions, formatting rules, British English usage, and code generation best practices.
This skill enforces the comprehensive coding standards for Project KONGOR's open-source C# codebase, ensuring consistency across syntax, formatting, naming, and code generation practices.
- Correct: `UserID`, `GetGUID`, `HTMLParser`
- Incorrect: `UserId`, `GetGuid`, `HtmlParser`
- Correct: `userGUID`, `accountID`, `httpStatusCode`
- Incorrect: `userGuid`, `accountId`, `hTTPStatusCode`
- Correct: `configuration`, `administrator`, `implementation`
- Incorrect: `config`, `admin`, `impl`
- Correct: `numbers.Select(number => number * number)`
- Incorrect: `numbers.Select(x => x * x)`
Align lambda operators in switch expressions:
```csharp
return UserType switch
{
UserType.Staff => "internal",
UserType.Client => "external",
_ => throw new ArgumentOutOfRangeException($"Unsupported User Type \"{UserType}\"")
};
```
Example:
```csharp
// This Is A Sample Comment Explaining The Purpose Of The "request" Variable In The HTTP Handler
```
Example:
```csharp
/// <summary>
/// This method retrieves user information based on the provided user ID.
/// It does so by using the "request" variable from the HTTP handler.
/// </summary>
```
Correct `<see cref="..."/>` usage:
- Correct: "colour", "optimise", "behaviour"
- Incorrect: "color", "optimize", "behavior"
- Use "TRUE", "FALSE", "NULL" to distinguish from natural language
Never use the null-forgiving operator (`!`) except in these cases:
1. Entity Framework queries with `Include`/`ThenInclude` for navigation properties known to be non-null
2. When assigning `null!` is unavoidable without excessive complexity AND runtime null is guaranteed impossible
Example:
```csharp
global using Aspire.Hosting;
global using Microsoft.Extensions.DependencyInjection;
```
1. **Correctness**: Ensure syntactic correctness and adherence to language best practices
2. **Performance**: Optimise for efficiency unless it compromises readability
3. **Security**: Follow best practices to prevent vulnerabilities (injection, leaks, unauthorized access)
4. **Consistency**: Match existing codebase style, conventions, and architecture
5. **Targeted**: Avoid unnecessary features or complexity
When generating code:
1. Check relevant online sources or documentation when needed
2. Inspect existing codebase for patterns to follow
3. Review the prompt to ensure alignment with objectives
4. Present options to the user when ambiguity exists
When reviewing or generating C# code for Project KONGOR:
1. Verify all naming conventions match the acronym/initialism rules
2. Check indentation is exactly four spaces
3. Confirm British English usage throughout
4. Validate lambda parameters use full descriptive names
5. Ensure comments use StartCase and XML docs use sentence case
6. Check `<see cref="..."/>` tags omit parameters
7. Verify global using directives are in `Internals/UsingDirectives.cs`
8. Confirm consistency with surrounding code style
9. Review for unnecessary complexity or features
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/c-kongor-project-style-guide/raw