
csharp-init
by zadazorg
SKILL.md
name: csharp-init description: > Initialize .NET project with C# 14 standards configuration. Creates Directory.Build.props, Directory.Packages.props, .editorconfig, BannedSymbols.txt, and Makefile. Use for "/init" or "setup project". user-invocable: true allowed-tools:
- Read
- Write
- Bash
- Glob
- AskUserQuestion metadata: author: csharp-standards version: "3.0.0"
Project Initialization
Initialize a .NET project with modern C# 14 / .NET 10 standards configuration.
Files Created
| File | Purpose |
|---|---|
Directory.Build.props | Build settings, analyzers, nullability |
Directory.Packages.props | Central Package Management (CPM) |
.editorconfig | Code style rules (K&R braces, naming) |
BannedSymbols.txt | Forbidden APIs list |
Makefile | Standard build targets |
Workflow
Step 1: Check Existing Files
ls -la Directory.Build.props Directory.Packages.props .editorconfig BannedSymbols.txt Makefile 2>/dev/null
If files exist, ask user whether to overwrite or skip.
Step 2: Copy Templates
Templates are in templates/ directory. Copy each file to repository root.
# Example for each file
cp templates/Directory.Build.props ./
cp templates/Directory.Packages.props ./
cp templates/.editorconfig ./
cp templates/BannedSymbols.txt ./
cp templates/Makefile ./
Step 3: Restore and Build
dotnet restore
dotnet build
Step 4: Commit Changes (if requested)
git add Directory.Build.props Directory.Packages.props .editorconfig BannedSymbols.txt Makefile
git commit -m "feat: add C# 14 standards configuration"
Template Overview
Directory.Build.props
Key settings applied to ALL projects:
<!-- C# Language -->
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Strict Analysis -->
<AnalysisLevel>latest-all</AnalysisLevel>
<AnalysisMode>All</AnalysisMode>
<WarningLevel>9999</WarningLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- AOT-Readiness -->
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<!-- Unified Output -->
<UseArtifactsOutput>true</UseArtifactsOutput>
<!-- NuGet Security -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditLevel>moderate</NuGetAuditLevel>
<!-- Reproducible Builds -->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
Analyzers included:
- Roslynator.Analyzers
- SonarAnalyzer.CSharp
- Microsoft.CodeAnalysis.BannedApiAnalyzers
- Microsoft.VisualStudio.Threading.Analyzers
Directory.Packages.props
Central Package Management (CPM) for version control:
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
Pre-configured versions for:
- Analyzers
- Testing (xUnit, Shouldly, NSubstitute)
- Microsoft.Extensions.*
- EF Core
- ErrorOr
.editorconfig
Code style enforcement:
- K&R brace style (
csharp_new_line_before_open_brace = none) - File-scoped namespaces
varfor obvious types- Naming conventions (PascalCase, _camelCase for fields)
BannedSymbols.txt
Forbidden APIs:
DateTime.Now→ useTimeProviderDateTime.UtcNow→ useTimeProviderThread.Sleep→ useTask.DelayTask.Result→ useawaitTask.Wait→ useawait
Makefile
Standard targets:
make build— build solutionmake test— run testsmake lint— check formattingmake fix— auto-fix issuesmake up— docker compose upmake down— docker compose down
Post-Init Checklist
After initialization, verify:
-
dotnet buildsucceeds with no errors -
dotnet format --verify-no-changespasses - All projects use CPM (no Version= in PackageReference)
- packages.lock.json files generated and committed
Customization
Add Project-Specific Packages
Edit Directory.Packages.props:
<ItemGroup Label="MyProject">
<PackageVersion Include="SomePackage" Version="1.0.0" />
</ItemGroup>
Suppress Specific Warnings
Edit .editorconfig:
# Suppress specific warning in specific files
[**/Migrations/*.cs]
dotnet_diagnostic.CA1062.severity = none
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です