chezmoi-source (чистая пересборка, не дамп 1.2 ГБ): - dot_claude: CLAUDE.md лин-роутер, AGENTS.md.tmpl (VPS вычищен), settings.json.tmpl (deny-щит 20 + security-guard hook), rules (structure + ECC 21 язык), 30 generic ECC-агентов, health-check - dot_codex: symlink-паритет; dot_agents: registry 13 скриптов HOME-генерик + методология docs - плагины: plugins.manifest + bootstrap Слой 1b (marketplace+install) - launchd: health.plist (PATH-фикс 127) + session-reaper.example - smoke++: secret-токен guard + канон-проверки (зелёный) - 0 hard личных данных; cut личного (kb/references/gsd/owner) → Ф4
2.0 KiB
2.0 KiB
paths
| paths | ||
|---|---|---|
|
C# Coding Style
This file extends common/coding-style.md with C#-specific content.
Standards
- Follow current .NET conventions and enable nullable reference types
- Prefer explicit access modifiers on public and internal APIs
- Keep files aligned with the primary type they define
Types and Models
- Prefer
recordorrecord structfor immutable value-like models - Use
classfor entities or types with identity and lifecycle - Use
interfacefor service boundaries and abstractions - Avoid
dynamicin application code; prefer generics or explicit models
public sealed record UserDto(Guid Id, string Email);
public interface IUserRepository
{
Task<UserDto?> FindByIdAsync(Guid id, CancellationToken cancellationToken);
}
Immutability
- Prefer
initsetters, constructor parameters, and immutable collections for shared state - Do not mutate input models in-place when producing updated state
public sealed record UserProfile(string Name, string Email);
public static UserProfile Rename(UserProfile profile, string name) =>
profile with { Name = name };
Async and Error Handling
- Prefer
async/awaitover blocking calls like.Resultor.Wait() - Pass
CancellationTokenthrough public async APIs - Throw specific exceptions and log with structured properties
public async Task<Order> LoadOrderAsync(
Guid orderId,
CancellationToken cancellationToken)
{
try
{
return await repository.FindAsync(orderId, cancellationToken)
?? throw new InvalidOperationException($"Order {orderId} was not found.");
}
catch (Exception ex)
{
logger.LogError(ex, "Failed to load order {OrderId}", orderId);
throw;
}
}
Formatting
- Use
dotnet formatfor formatting and analyzer fixes - Keep
usingdirectives organized and remove unused imports - Prefer expression-bodied members only when they stay readable