본문으로 건너뛰기
cccskills
무료GitHub에 공개

csharp

Apply these opinionated C# conventions whenever writing or reviewing C# 12 / .NET 8+ code: nullable enabled with warnings as errors, records and primary constructors, pattern matching over cast chains, the Result pattern for expected failures, async all the way with CancellationToken, IOptions config, IHttpClientFactory, and never returning EF entities from an API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

C# Conventions

House conventions for C# 12 / .NET 8+. Apply them to code you are writing or changing — don't rewrite untouched files to match unless asked.

Conventions

  • <Nullable>enable</Nullable> and warnings as errors. The nullable annotations only pay off if the warnings block the build; ignored, they become decoration that lies about which references can be null.

  • C# 12 defaults: file-scoped namespaces, primary constructors, collection expressions, required members. Records for DTOs and value objects — value equality is what you want when comparing data, and hand-written Equals/GetHashCode pairs drift apart.

  • Pattern matching over type-test-and-cast chains. Switch expressions on a closed hierarchy let the compiler warn about unhandled cases; an if/else if ladder just falls through silently when a new type appears.

  • Result pattern for expected failures, exceptions for genuinely exceptional ones. "Not found" and "invalid input" are ordinary outcomes and belong in the return type where the caller must deal with them; using exceptions for control flow hides them from the signature and costs a stack unwind per occurrence. A closed record hierarchy gives you exhaustive switch over the outcomes:

    public abstract record Result<T>
    {
        public sealed record Ok(T Value) : Result<T>;
        public sealed record Fail(string Error) : Result<T>;
    }
    
    var message = GetUser(id) switch
    {
        Result<User>.Ok(var user) => $"Found {user.Name}",
        Result<User>.Fail(var error) => error,
    };
    
  • Async all the way down. .Result and .Wait() deadlock under a synchronisation context and burn a thread pool thread everywhere else. If a call chain has to be async at the bottom, it is async at the top.

  • Accept and pass a CancellationToken on every async public method. Without it a cancelled request keeps its database query and HTTP call running to completion, and the work is charged to a caller who has already gone.

  • Never expose EF entities from an API. Project to a DTO with Select — otherwise you ship whatever the schema grows next, and lazy loading turns serialisation into an N+1 query storm.

  • EF specifics that show up as production incidents rather than test failures: AsNoTracking() on every read-only query, since change tracking on a large result set is pure overhead; AsSplitQuery() when Include-ing more than one collection, because a single join multiplies rows cartesian-style; ExecuteUpdateAsync/ExecuteDeleteAsync (.NET 7+) for bulk changes rather than loading entities to modify them; a global HasQueryFilter for soft deletes so no query can forget the flag.

  • Keyed services when one interface has several implementations (.NET 8): register with AddKeyedScoped<INotifier, EmailNotifier>("email") and resolve with [FromKeyedServices("email")]. It beats an enum-switching factory because the container still owns the lifetimes.

  • IOptions<T> with validated, strongly-typed config. configuration["Some:Key"] fails at the call site, at runtime, on a typo. A bound options class with ValidateOnStart fails at boot with the field named.

  • IHttpClientFactory, never new HttpClient() per call — socket exhaustion from lingering TIME_WAIT connections is the classic failure, and it only appears under load.

  • Span<T>/Memory<T> and pooling where a profiler says allocations matter. They complicate the code, so spend that complexity where there is a measurement, not on principle.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Write a short, fact-checked reply that answers a colleague's question in one meaning only, ready to copy and paste. The input is their pasted message. Check the claims against the code first, use the project glossary terms, and print only the reply in chat. Read-only — no writes to code, the issue tracker, GitHub, chat or any MCP. Use on "/cortex-communication:answer-buzzkill", "help me answer", "reply to this question", or when the user pastes a colleague's question and asks for an answer in the same manner.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Apply these opinionated .NET 8 architecture conventions whenever structuring or reviewing a backend service: clean architecture layering and which direction dependencies point, when CQRS with MediatR is worth it, cross-cutting concerns as pipeline behaviours, minimal APIs grouped by feature, keeping DbContext in Infrastructure, health checks and structured logging, WebApplicationFactory integration tests, and when AOT pays off.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Apply these opinionated Python 3.11+ conventions when writing Python in this codebase: type hints with mypy, async/await, pytest fixtures, dataclasses, Poetry packaging, production patterns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Apply these opinionated testing conventions whenever writing, reviewing, or planning tests: what earns a test and what is coverage theatre, asserting outputs rather than mock calls, the three modes (functional, performance, security), naming and isolation rules, where to mock, and reporting findings for coverage rather than self-filtering. Includes house Jest standards for NestJS unit and contract tests, TDD discipline, and test-report structure.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

ALWAYS invoke for any task involving docstrings, JSDoc/TSDoc, or REST API documentation — even when the request seems handleable without it. Enforces Microsoft contract-first conventions and a bare-minimum rule that Claude won't apply by default: never restate the signature, drop @param/@returns that only echo names and types, always document @throws, and document data shapes as WHAT not WHY. Covers Python docstring styles (Google/NumPy/Sphinx), TSDoc tags and @inheritDoc, and API doc patterns for NestJS/Express/FastAPI/Django. Trigger on: adding or auditing docstrings, redundant or missing tags, deleting comment rot, or producing a documentation-health report. Do not skip for documentation tasks — consistent conventions are the whole point.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

Remove signs of AI-generated writing from text. Use after drafting to make copy sound more natural and human-written. Based on Wikipedia's "Signs of AI writing" guide.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alexander-danilenko/cortex-claude-code-plugins172026년 10월 13일 업데이트

alexander-danilenko의 스킬 모두 보기

이 스킬의 문제 신고