swe-programming-csharp

C# coding standards from authoritative docs/explanation/software-engineering/programming-languages/c-sharp/ documentation

9 stars

Best use case

swe-programming-csharp is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

C# coding standards from authoritative docs/explanation/software-engineering/programming-languages/c-sharp/ documentation

Teams using swe-programming-csharp should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/swe-programming-csharp/SKILL.md --create-dirs "https://raw.githubusercontent.com/wahidyankf/open-sharia-enterprise/main/.claude/skills/swe-programming-csharp/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/swe-programming-csharp/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How swe-programming-csharp Compares

Feature / Agentswe-programming-csharpStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

C# coding standards from authoritative docs/explanation/software-engineering/programming-languages/c-sharp/ documentation

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# C# Coding Standards

## Purpose

Progressive disclosure of C# coding standards for agents writing C# code.

**Usage**: Auto-loaded for agents when writing C# code. Provides quick reference to idioms, best practices, and antipatterns.

**Authoritative Source**: [docs/explanation/software-engineering/programming-languages/c-sharp/README.md](../../../docs/explanation/software-engineering/programming-languages/c-sharp/README.md)

## Prerequisite Knowledge

**IMPORTANT**: This skill provides **OSE Platform-specific style guides**, not educational tutorials.

Complete the AyoKoding C# learning path first:

1. **[C# Learning Path](../../../apps/ayokoding-web/content/en/learn/software-engineering/programming-languages/c-sharp/)** - 0-95% language coverage
2. **[C# By Example](../../../apps/ayokoding-web/content/en/learn/software-engineering/programming-languages/c-sharp/by-example/)** - 75+ annotated examples

**See**: [Programming Language Documentation Separation](../../../repo-governance/conventions/structure/programming-language-docs-separation.md)

## Quick Standards Reference

### Naming Conventions

**Classes/Interfaces/Methods/Properties**: PascalCase

- `ZakatCalculator`, `IZakatRepository`, `CalculateAmount()`, `TotalWealth`

**Local Variables/Parameters**: camelCase

- `zakatAmount`, `nisabThreshold`, `paymentDate`

**Private Fields**: `_camelCase` prefix

- `private readonly IZakatRepository _repository;`

**Constants**: PascalCase

- `public const decimal ZakatRate = 0.025m;`

### Nullable Reference Types

```csharp
// CORRECT: Enable nullable in .csproj
// <Nullable>enable</Nullable>

// CORRECT: Non-nullable by default
public string ContractId { get; init; } = string.Empty;

// CORRECT: Nullable when intentional
public string? Notes { get; init; }

// CORRECT: Null-forgiving with justification
var value = GetValue()!; // Safe because we validated above
```

### Records for Value Objects

```csharp
// CORRECT: Record for immutable value object
public record ZakatCalculation(
    decimal Wealth,
    decimal Nisab,
    decimal Amount,
    DateOnly CalculationDate
)
{
    public static ZakatCalculation Calculate(decimal wealth, decimal nisab)
    {
        var amount = wealth >= nisab ? wealth * 0.025m : 0m;
        return new ZakatCalculation(wealth, nisab, amount, DateOnly.FromDateTime(DateTime.UtcNow));
    }
}
```

### Async/Await

```csharp
// CORRECT: async Task with CancellationToken
public async Task<ZakatCalculation> CalculateAsync(
    decimal wealth,
    CancellationToken cancellationToken = default)
{
    var nisab = await _repository.GetCurrentNisabAsync(cancellationToken);
    return ZakatCalculation.Calculate(wealth, nisab);
}

// WRONG: Blocking async code
public ZakatCalculation Calculate(decimal wealth)
{
    var nisab = _repository.GetCurrentNisabAsync().Result; // DEADLOCK RISK!
    return ZakatCalculation.Calculate(wealth, nisab);
}
```

### Error Handling

```csharp
// CORRECT: ProblemDetails for HTTP errors (RFC 7807)
app.UseExceptionHandler(exceptionHandlerApp =>
    exceptionHandlerApp.Run(async context =>
    {
        context.Response.ContentType = "application/problem+json";
        var problemDetails = new ProblemDetails
        {
            Status = StatusCodes.Status500InternalServerError,
            Title = "An unexpected error occurred"
        };
        await context.Response.WriteAsJsonAsync(problemDetails);
    }));

// CORRECT: Result pattern for domain errors
public Result<ZakatCalculation> Calculate(decimal wealth, decimal nisab)
{
    if (wealth < 0)
        return Result.Failure<ZakatCalculation>("Wealth cannot be negative");

    return Result.Success(ZakatCalculation.Calculate(wealth, nisab));
}
```

### Testing with xUnit and FluentAssertions

```csharp
public class ZakatCalculatorTests
{
    [Theory]
    [InlineData(10000, 5000, 250)]
    [InlineData(3000, 5000, 0)]
    public async Task CalculateAsync_ReturnsCorrectAmount(
        decimal wealth, decimal nisab, decimal expectedAmount)
    {
        // Arrange
        var mockRepo = new Mock<IZakatRepository>();
        mockRepo.Setup(r => r.GetCurrentNisabAsync(It.IsAny<CancellationToken>()))
                .ReturnsAsync(nisab);
        var calculator = new ZakatCalculator(mockRepo.Object);

        // Act
        var result = await calculator.CalculateAsync(wealth);

        // Assert
        result.Amount.Should().Be(expectedAmount);
    }
}
```

## Comprehensive Documentation

**Authoritative Index**: [docs/explanation/software-engineering/programming-languages/c-sharp/README.md](../../../docs/explanation/software-engineering/programming-languages/c-sharp/README.md)

### Mandatory Standards

1. **[Coding Standards](../../../docs/explanation/software-engineering/programming-languages/c-sharp/coding-standards.md)**
2. **[Testing Standards](../../../docs/explanation/software-engineering/programming-languages/c-sharp/testing-standards.md)**
3. **[Code Quality Standards](../../../docs/explanation/software-engineering/programming-languages/c-sharp/code-quality-standards.md)**
4. **[Build Configuration](../../../docs/explanation/software-engineering/programming-languages/c-sharp/build-configuration.md)**

### Context-Specific Standards

1. **[Error Handling](../../../docs/explanation/software-engineering/programming-languages/c-sharp/error-handling-standards.md)**
2. **[Concurrency](../../../docs/explanation/software-engineering/programming-languages/c-sharp/concurrency-standards.md)**
3. **[Type Safety](../../../docs/explanation/software-engineering/programming-languages/c-sharp/type-safety-standards.md)**
4. **[Performance](../../../docs/explanation/software-engineering/programming-languages/c-sharp/performance-standards.md)**
5. **[Security](../../../docs/explanation/software-engineering/programming-languages/c-sharp/security-standards.md)**
6. **[API Standards](../../../docs/explanation/software-engineering/programming-languages/c-sharp/api-standards.md)**
7. **[DDD Standards](../../../docs/explanation/software-engineering/programming-languages/c-sharp/ddd-standards.md)**
8. **[Framework Integration](../../../docs/explanation/software-engineering/programming-languages/c-sharp/framework-integration.md)**

## Related Skills

- docs-applying-content-quality
- repo-practicing-trunk-based-development

## References

- [C# README](../../../docs/explanation/software-engineering/programming-languages/c-sharp/README.md)
- [Functional Programming](../../../repo-governance/development/pattern/functional-programming.md)

Related Skills

swe-programming-typescript

9
from wahidyankf/open-sharia-enterprise

TypeScript coding standards from authoritative docs/explanation/software-engineering/programming-languages/typescript/ documentation

swe-programming-rust

9
from wahidyankf/open-sharia-enterprise

Rust coding standards from authoritative docs/explanation/software-engineering/programming-languages/rust/ documentation

swe-programming-golang

9
from wahidyankf/open-sharia-enterprise

Go coding standards from authoritative docs/explanation/software-engineering/programming-languages/golang/ documentation

swe-programming-fsharp

9
from wahidyankf/open-sharia-enterprise

F# coding standards from authoritative docs/explanation/software-engineering/programming-languages/f-sharp/ documentation

nx-workspace

9
from wahidyankf/open-sharia-enterprise

Explore and understand Nx workspaces. USE WHEN answering questions about the workspace, projects, or tasks. ALSO USE WHEN an nx command fails or you need to check available targets/configuration before running a task. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What depends on library Y?', 'What targets can I run?', 'Cannot find configuration for task', 'debug nx task failure'.

nx-run-tasks

9
from wahidyankf/open-sharia-enterprise

Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.

nx-plugins

9
from wahidyankf/open-sharia-enterprise

Find and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.

nx-import

9
from wahidyankf/open-sharia-enterprise

Import, merge, or combine repositories into an Nx workspace using nx import. USE WHEN the user asks to adopt Nx across repos, move projects into a monorepo, or bring code/history from another repository.

nx-generate

9
from wahidyankf/open-sharia-enterprise

Generate code using nx generators. INVOKE IMMEDIATELY when user mentions scaffolding, setup, structure, creating apps/libs, or setting up project structure. Trigger words - scaffold, setup, create a ... app, create a ... lib, project structure, generate, add a new project. ALWAYS use this BEFORE calling nx_docs or exploring - this skill handles discovery internally.

monitor-ci

9
from wahidyankf/open-sharia-enterprise

Monitor Nx Cloud CI pipeline and handle self-healing fixes. USE WHEN user says "monitor ci", "watch ci", "ci monitor", "watch ci for this branch", "track ci", "check ci status", wants to track CI status, or needs help with self-healing CI fixes. Prefer this skill over native CI provider tools (gh, glab, etc.) for CI monitoring — it integrates with Nx Cloud self-healing which those tools cannot access.

link-workspace-packages

9
from wahidyankf/open-sharia-enterprise

Link workspace packages in monorepos (npm, yarn, pnpm, bun). USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) user imports from a sibling package and needs to add it as a dependency, (3) you get resolution errors for workspace packages (@org/*) like "cannot find module", "failed to resolve import", "TS2307", or "cannot resolve". DO NOT patch around with tsconfig paths or manual package.json edits - use the package manager's workspace commands to fix actual linking.

swe-developing-frontend-ui

9
from wahidyankf/open-sharia-enterprise

UI development skill covering design token usage, shadcn/ui + Radix composition patterns, accessibility requirements, anti-patterns catalog, and brand context for OrganicLever and OSE Platform. Auto-loads when working on TSX components, CSS, or UI design tasks.