Project Structure

codewithmukesh/dotnet-claude-kit/skills/project-structure

by codewithmukesh23300897f4d1No license754 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 2 months ago

.NET solution and project structure conventions. Covers .slnx format, Directory.Build.props, Directory.Packages.props for central package management, global usings, and naming conventions. Load this skill when setting up a new solution, adding projects, configuring build properties, or when the user mentions "solution structure", ".slnx", "Directory.Build.props", "central package management", "Directory.Packages.props", "global usings", ".editorconfig", "project layout", or "naming conventions".

Instructions onlySoftware Development
AI-generated overview

Conventions for structuring .NET solutions: .slnx format, shared build props, central package management and naming.

What it does
This skill provides .NET solution and project structure conventions. It documents the .slnx solution format, Directory.Build.props for shared MSBuild settings, Directory.Packages.props for central package management, global.json SDK pinning, global usings, and naming conventions. It also lists anti-patterns and a decision guide for choosing a project layout. It is guidance only and produces no files or scripts.
When to use it
Use it when setting up a new .NET solution, adding projects, configuring build properties, or when the user mentions solution structure, .slnx, Directory.Build.props, central package management, Directory.Packages.props, global usings, .editorconfig, project layout or naming conventions.
Requirements
No tools, packages or credentials are required; it is instructions only and ships no scripts. The guidance targets .NET projects using MSBuild, NuGet and the .NET SDK.

Project Structure

Core Principles

  1. Central package management — Use Directory.Packages.props to manage NuGet package versions in one place. No version numbers in individual .csproj files.
  2. Shared build properties — Use Directory.Build.props for common settings (target framework, nullable, implicit usings). Don't repeat in every project.
  3. .slnx for solutions — The new XML-based solution format is cleaner and more merge-friendly than the legacy .sln format.
  4. src/tests separation — Source projects in src/, test projects in tests/. Clear boundary.

Patterns

Solution Layout

MyApp/├── MyApp.slnx                       # Solution file├── Directory.Build.props             # Shared MSBuild properties├── Directory.Packages.props          # Central package management├── .editorconfig                     # Code style rules├── .gitignore├── global.json                       # SDK version pinning├── src/│   ├── MyApp.Api/                    # Web API (entry point)│   │   ├── MyApp.Api.csproj│   │   ├── Program.cs│   │   └── Features/│   ├── MyApp.Domain/                 # Domain entities, value objects (optional)│   │   └── MyApp.Domain.csproj│   └── MyApp.Infrastructure/         # EF Core, external services (optional)│       └── MyApp.Infrastructure.csproj└── tests/    └── MyApp.Api.Tests/        └── MyApp.Api.Tests.csproj

Directory.Build.props

xml
<Project>  <PropertyGroup>    <TargetFramework>net10.0</TargetFramework>    <LangVersion>14</LangVersion>    <Nullable>enable</Nullable>    <ImplicitUsings>enable</ImplicitUsings>    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>  </PropertyGroup></Project>

Directory.Packages.props (Central Package Management)

xml
<Project>  <PropertyGroup>    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>  </PropertyGroup>
  <ItemGroup>    <!-- Versions below are illustrative — resolve the current stable versions         with `dotnet add package <name>` (no --version flag); see the packages rule -->    <!-- ASP.NET Core -->    <PackageVersion Include="Mediator.Abstractions" Version="3.0.0" />    <PackageVersion Include="Mediator.SourceGenerator" Version="3.0.0" />    <PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
    <!-- Data -->    <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.10" />    <PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.10" />
    <!-- Observability -->    <PackageVersion Include="Serilog.AspNetCore" Version="10.0.0" />    <PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.17.0" />
    <!-- Testing -->    <PackageVersion Include="xunit.v3" Version="3.2.2" />    <PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.10" />    <PackageVersion Include="Testcontainers.PostgreSql" Version="4.13.0" />  </ItemGroup></Project>

Project File (.csproj) with Central Package Management

xml
<Project Sdk="Microsoft.NET.Sdk.Web">  <!-- No TargetFramework here — inherited from Directory.Build.props -->
  <ItemGroup>    <!-- No Version attribute — managed centrally -->    <PackageReference Include="Mediator.Abstractions" />    <PackageReference Include="Mediator.SourceGenerator" />    <PackageReference Include="FluentValidation.DependencyInjectionExtensions" />    <PackageReference Include="Microsoft.EntityFrameworkCore" />    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />    <PackageReference Include="Serilog.AspNetCore" />  </ItemGroup>
  <ItemGroup>    <ProjectReference Include="..\MyApp.Domain\MyApp.Domain.csproj" />    <ProjectReference Include="..\MyApp.Infrastructure\MyApp.Infrastructure.csproj" />  </ItemGroup></Project>

global.json (SDK Pinning)

json
{  "sdk": {    "version": "10.0.100",    "rollForward": "latestFeature"  }}

.slnx Solution Format

xml
<Solution>  <Folder Name="/src/">    <Project Path="src/MyApp.Api/MyApp.Api.csproj" />    <Project Path="src/MyApp.Domain/MyApp.Domain.csproj" />    <Project Path="src/MyApp.Infrastructure/MyApp.Infrastructure.csproj" />  </Folder>  <Folder Name="/tests/">    <Project Path="tests/MyApp.Api.Tests/MyApp.Api.Tests.csproj" />  </Folder></Solution>

Naming Conventions

ElementConventionExample
SolutionCompanyName.AppName or AppNameMyApp.slnx
ProjectAppName.LayerMyApp.Api, MyApp.Domain
NamespaceMatches folder pathMyApp.Api.Features.Orders
Feature folderPascalCase, pluralFeatures/Orders/
Test projectProjectName.TestsMyApp.Api.Tests

Anti-patterns

Don't Scatter Package Versions

xml
<!-- BAD — version in every .csproj, version drift --><PackageReference Include="Mediator.Abstractions" Version="2.0.0" />  <!-- in Project A --><PackageReference Include="Mediator.Abstractions" Version="3.0.0" />  <!-- in Project B -->
<!-- GOOD — central management, one version --><!-- Directory.Packages.props: <PackageVersion Include="Mediator.Abstractions" Version="3.0.0" /> --><!-- .csproj: <PackageReference Include="Mediator.Abstractions" /> -->

Don't Repeat Build Properties

xml
<!-- BAD — same properties in every .csproj --><PropertyGroup>  <TargetFramework>net10.0</TargetFramework>  <Nullable>enable</Nullable>  <ImplicitUsings>enable</ImplicitUsings></PropertyGroup>
<!-- GOOD — once in Directory.Build.props, inherited everywhere -->

Don't Mix Source and Test Projects

# BAD — tests mixed with sourcesrc/  MyApp.Api/  MyApp.Api.Tests/    # test project in src/
# GOOD — clear separationsrc/  MyApp.Api/tests/  MyApp.Api.Tests/

Decision Guide

ScenarioRecommendation
New solution.slnx format
Package version managementDirectory.Packages.props (central)
Shared build settingsDirectory.Build.props
SDK version pinningglobal.json
Common using directivesGlobal usings in Directory.Build.props
Small API (1-2 devs)Single project (MyApp.Api)
Medium API (3-5 devs)2-3 projects (Api, Domain, Infrastructure)
Large / modular appModule-per-project with shared Contracts

Source and attribution

Source:codewithmukesh/dotnet-claude-kitinskills/project-structureat commit2330089

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal

More from codewithmukesh/dotnet-claude-kit

Wrap Up

codewithmukesh

Captures end-of-session work, pending tasks and learnings into a handoff file, and reloads it at session start.

Productivity & Workflow754updated 2 months ago

Workflow Mastery

codewithmukesh

Claude Code workflow mastery for .NET developers. Covers parallel execution with git worktrees, plan mode strategy, verification loops, auto-formatting hooks, permission setup for dotnet CLI, prompting techniques, subagent patterns, and context discipline — token budget management, MCP-first navigation, lazy loading, and subagent isolation — all adapted for the .NET ecosystem. Load this skill when setting up Claude Code for a .NET project, optimizing workflows, running parallel sessions, when context is running low or sessions feel sluggish, when exploring a large codebase efficiently, or when the user mentions "productivity", "workflow", "parallel", "worktree", "plan mode", "permissions", "hooks", "10x", "setup Claude Code", "speed up development", "context", "tokens", "budget", "running out of context", "too many files", or "large codebase". Inspired by tips from Boris Cherny (creator of Claude Code) and the Anthropic team.

Awaiting classification754updated 2 months ago

Vertical Slice

codewithmukesh

Guides .NET developers in structuring applications with Vertical Slice Architecture, covering feature folders, endpoint grouping and handler patterns.

Software Development754updated 2 months ago

Testing

codewithmukesh

Testing strategy for .NET 10 applications. Covers xUnit v3, WebApplicationFactory for integration tests, Testcontainers for real database testing, Verify for snapshot testing, and the AAA pattern. Load this skill when writing tests, setting up test infrastructure, reviewing test coverage, or when the user mentions "test", "xUnit", "WebApplicationFactory", "Testcontainers", "integration test", "unit test", "bUnit", "snapshot test", "Verify", "test coverage", "AAA pattern", "WireMock", or "FakeTimeProvider".

Awaiting classification754updated 2 months ago

Tdd

codewithmukesh

Guided test-driven development workflow for .NET 10 using xUnit v3, WebApplicationFactory, Testcontainers, and Verify snapshots. Follows the strict red-green-refactor cycle. Use when: "TDD", "test-driven", "let's TDD this", "red green refactor", "write the test first", or when building a feature with clear acceptance criteria.

Awaiting classification754updated 2 months ago

Spec

codewithmukesh

Turns a vague feature idea into an agreed, persisted specification file through structured questioning rounds.

Productivity & Workflow754updated 2 months ago