@lvlup-sw/exarchos 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.mcp.json +17 -0
- package/AGENTS.md +59 -0
- package/CLAUDE.md.template +62 -0
- package/LICENSE +202 -0
- package/README.md +258 -0
- package/commands/autocompact.md +37 -0
- package/commands/checkpoint.md +85 -0
- package/commands/cleanup.md +99 -0
- package/commands/debug.md +145 -0
- package/commands/delegate.md +56 -0
- package/commands/ideate.md +82 -0
- package/commands/plan.md +150 -0
- package/commands/refactor.md +139 -0
- package/commands/reload.md +37 -0
- package/commands/resume.md +130 -0
- package/commands/review.md +51 -0
- package/commands/sync-schemas.md +74 -0
- package/commands/synthesize.md +122 -0
- package/commands/tdd.md +58 -0
- package/dist/exarchos-cli.js +8828 -0
- package/dist/exarchos-mcp.js +50 -0
- package/hooks/hooks.json +53 -0
- package/package.json +59 -0
- package/rules/coding-standards.md +46 -0
- package/rules/mcp-tool-guidance.md +26 -0
- package/rules/pr-descriptions.md +12 -0
- package/rules/rm-safety.md +9 -0
- package/rules/skill-path-resolution.md +10 -0
- package/rules/tdd.md +41 -0
- package/rules/telemetry-awareness.md +9 -0
- package/scripts/assess-refactor-scope.sh +239 -0
- package/scripts/check-benchmark-regression.sh +229 -0
- package/scripts/check-coderabbit.sh +288 -0
- package/scripts/check-coverage-thresholds.sh +194 -0
- package/scripts/check-polish-scope.sh +245 -0
- package/scripts/check-property-tests.sh +167 -0
- package/scripts/check-tdd-compliance.sh +265 -0
- package/scripts/coderabbit-review-gate.sh +518 -0
- package/scripts/debug-review-gate.sh +201 -0
- package/scripts/extract-fix-tasks.sh +179 -0
- package/scripts/extract-task.sh +67 -0
- package/scripts/generate-traceability.sh +209 -0
- package/scripts/investigation-timer.sh +171 -0
- package/scripts/needs-schema-sync.sh +174 -0
- package/scripts/new-project.sh +103 -0
- package/scripts/post-delegation-check.sh +317 -0
- package/scripts/pre-synthesis-check.sh +440 -0
- package/scripts/reconcile-state.sh +346 -0
- package/scripts/reconstruct-stack.sh +432 -0
- package/scripts/review-diff.sh +63 -0
- package/scripts/review-verdict.sh +169 -0
- package/scripts/security-scan.sh +248 -0
- package/scripts/select-debug-track.sh +186 -0
- package/scripts/setup-worktree.sh +323 -0
- package/scripts/spec-coverage-check.sh +230 -0
- package/scripts/static-analysis-gate.sh +236 -0
- package/scripts/sync-labels.sh +122 -0
- package/scripts/validate-companion.sh +161 -0
- package/scripts/validate-dotnet-standards.sh +267 -0
- package/scripts/validate-installation.sh +101 -0
- package/scripts/validate-plugin.sh +223 -0
- package/scripts/validate-refactor.sh +234 -0
- package/scripts/validate-rm.sh +93 -0
- package/scripts/verify-delegation-saga.sh +240 -0
- package/scripts/verify-doc-links.sh +211 -0
- package/scripts/verify-ideate-artifacts.sh +296 -0
- package/scripts/verify-plan-coverage.sh +228 -0
- package/scripts/verify-review-triage.sh +219 -0
- package/scripts/verify-worktree-baseline.sh +159 -0
- package/scripts/verify-worktree.sh +84 -0
- package/settings.json +47 -0
- package/skills/brainstorming/SKILL.md +127 -0
- package/skills/brainstorming/references/design-template.md +65 -0
- package/skills/cleanup/SKILL.md +147 -0
- package/skills/cleanup/references/merge-verification.md +40 -0
- package/skills/debug/SKILL.md +204 -0
- package/skills/debug/references/hotfix-track.md +134 -0
- package/skills/debug/references/investigation-checklist.md +217 -0
- package/skills/debug/references/rca-template.md +150 -0
- package/skills/debug/references/state-schema.md +294 -0
- package/skills/debug/references/thorough-track.md +194 -0
- package/skills/debug/references/triage-questions.md +155 -0
- package/skills/debug/references/troubleshooting.md +47 -0
- package/skills/delegation/SKILL.md +150 -0
- package/skills/delegation/references/adaptive-orchestration.md +31 -0
- package/skills/delegation/references/agent-teams-saga.md +248 -0
- package/skills/delegation/references/fix-mode.md +74 -0
- package/skills/delegation/references/fixer-prompt.md +162 -0
- package/skills/delegation/references/implementer-prompt.md +322 -0
- package/skills/delegation/references/parallel-strategy.md +124 -0
- package/skills/delegation/references/pbt-patterns.md +172 -0
- package/skills/delegation/references/pr-fixes-mode.md +154 -0
- package/skills/delegation/references/state-management.md +51 -0
- package/skills/delegation/references/testing-patterns.md +129 -0
- package/skills/delegation/references/troubleshooting.md +33 -0
- package/skills/delegation/references/workflow-steps.md +127 -0
- package/skills/delegation/references/worktree-enforcement.md +64 -0
- package/skills/dotnet-standards/SKILL.md +269 -0
- package/skills/dotnet-standards/references/csharp-standards.md +120 -0
- package/skills/dotnet-standards/templates/.editorconfig +366 -0
- package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
- package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
- package/skills/dotnet-standards/templates/global.json +6 -0
- package/skills/dotnet-standards/templates/nuget.config +9 -0
- package/skills/dotnet-standards/templates/stylecop.json +37 -0
- package/skills/git-worktrees/SKILL.md +255 -0
- package/skills/implementation-planning/SKILL.md +233 -0
- package/skills/implementation-planning/references/plan-document-template.md +42 -0
- package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
- package/skills/implementation-planning/references/task-template.md +43 -0
- package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
- package/skills/quality-review/SKILL.md +278 -0
- package/skills/quality-review/references/code-quality-checklist.md +159 -0
- package/skills/quality-review/references/review-report-template.md +65 -0
- package/skills/quality-review/references/security-checklist.md +79 -0
- package/skills/quality-review/references/typescript-standards.md +24 -0
- package/skills/refactor/COMMAND.md +67 -0
- package/skills/refactor/SKILL.md +198 -0
- package/skills/refactor/phases/auto-chain.md +262 -0
- package/skills/refactor/phases/brief.md +176 -0
- package/skills/refactor/phases/explore.md +132 -0
- package/skills/refactor/phases/overhaul-delegate.md +136 -0
- package/skills/refactor/phases/overhaul-plan.md +312 -0
- package/skills/refactor/phases/overhaul-review.md +304 -0
- package/skills/refactor/phases/polish-implement.md +349 -0
- package/skills/refactor/phases/polish-validate.md +218 -0
- package/skills/refactor/phases/update-docs.md +234 -0
- package/skills/refactor/references/brief-template.md +81 -0
- package/skills/refactor/references/doc-update-checklist.md +110 -0
- package/skills/refactor/references/explore-checklist.md +73 -0
- package/skills/refactor/references/overhaul-track.md +215 -0
- package/skills/refactor/references/polish-track.md +170 -0
- package/skills/shared/prompts/context-reading.md +58 -0
- package/skills/shared/prompts/report-format.md +54 -0
- package/skills/shared/prompts/tdd-requirements.md +39 -0
- package/skills/shepherd/SKILL.md +264 -0
- package/skills/shepherd/references/assess-checklist.md +124 -0
- package/skills/shepherd/references/fix-strategies.md +191 -0
- package/skills/spec-review/SKILL.md +229 -0
- package/skills/spec-review/references/review-checklist.md +60 -0
- package/skills/sync-schemas/SKILL.md +114 -0
- package/skills/sync-schemas/references/configuration.md +73 -0
- package/skills/synthesis/SKILL.md +129 -0
- package/skills/synthesis/references/pr-descriptions.md +87 -0
- package/skills/synthesis/references/synthesis-steps.md +109 -0
- package/skills/synthesis/references/troubleshooting.md +115 -0
- package/skills/validate-all-skills.sh +57 -0
- package/skills/validate-frontmatter.sh +237 -0
- package/skills/workflow-state/SKILL.md +210 -0
- package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
- package/skills/workflow-state/references/phase-transitions.md +141 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dotnet-standards
|
|
3
|
+
description: ".NET and C# coding standards, conventions, and project configuration. Use when working with .cs files, .NET projects, C# codebases, or the user says \"check .NET standards\". Provides SOLID constraints, naming conventions, error handling patterns, and project structure guidelines specific to the .NET ecosystem. Do NOT use for TypeScript or non-.NET projects."
|
|
4
|
+
metadata:
|
|
5
|
+
author: exarchos
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
category: standards
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# .NET Standards Skill
|
|
11
|
+
|
|
12
|
+
Validates and enforces Levelup Software C# project standards across repositories. For detailed C# coding conventions (naming, file organization, patterns), see `references/csharp-standards.md`.
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
### `/dotnet-standards validate [path]`
|
|
17
|
+
|
|
18
|
+
Check project compliance against standards.
|
|
19
|
+
|
|
20
|
+
**Usage:**
|
|
21
|
+
```bash
|
|
22
|
+
/dotnet-standards validate # Validate current directory
|
|
23
|
+
/dotnet-standards validate ./my-project # Validate specific path
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Reports:**
|
|
27
|
+
- Missing or outdated configuration files
|
|
28
|
+
- Directory structure violations
|
|
29
|
+
- Package version drift
|
|
30
|
+
- Analyzer configuration issues
|
|
31
|
+
|
|
32
|
+
### `/dotnet-standards sync [path]`
|
|
33
|
+
|
|
34
|
+
Interactive sync of configuration files.
|
|
35
|
+
|
|
36
|
+
**Usage:**
|
|
37
|
+
```bash
|
|
38
|
+
/dotnet-standards sync # Sync current directory
|
|
39
|
+
/dotnet-standards sync ./my-project # Sync specific path
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Behavior:**
|
|
43
|
+
- Shows diff before applying changes
|
|
44
|
+
- Preserves project-local overrides (content below `=== PROJECT-LOCAL` markers)
|
|
45
|
+
- Updates to latest template versions
|
|
46
|
+
- Creates backup of modified files
|
|
47
|
+
|
|
48
|
+
### `/dotnet-standards scaffold <name> [--namespace <ns>] [--company <name>]`
|
|
49
|
+
|
|
50
|
+
Create new project with standard structure.
|
|
51
|
+
|
|
52
|
+
**Usage:**
|
|
53
|
+
```bash
|
|
54
|
+
/dotnet-standards scaffold MyProject
|
|
55
|
+
/dotnet-standards scaffold MyProject --namespace Lvlup.MyProject
|
|
56
|
+
/dotnet-standards scaffold MyProject --company "Ares Elite Sports Vision"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Creates:**
|
|
60
|
+
- Standard directory layout (src/, docs/, .github/, scripts/)
|
|
61
|
+
- Configuration files from templates
|
|
62
|
+
- Solution file (.sln) and initial project structure
|
|
63
|
+
- README.md and LICENSE files
|
|
64
|
+
|
|
65
|
+
**Defaults:**
|
|
66
|
+
- Namespace: `{ProjectName}`
|
|
67
|
+
- Company: "Levelup Software"
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Project Structure Validation
|
|
72
|
+
|
|
73
|
+
Run .NET standards compliance check:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
scripts/validate-dotnet-standards.sh --project-root <path>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**On exit 0:** Project is compliant.
|
|
80
|
+
**On exit 1:** Violations found — fix before proceeding.
|
|
81
|
+
**On exit 2:** Usage or dependency error — fix inputs before retrying.
|
|
82
|
+
|
|
83
|
+
### What It Checks
|
|
84
|
+
|
|
85
|
+
- `Directory.Build.props` exists in `src/`
|
|
86
|
+
- `Directory.Packages.props` exists with `<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>`
|
|
87
|
+
- `.editorconfig` exists in `src/`
|
|
88
|
+
- `global.json` exists with SDK version specified
|
|
89
|
+
- No individual `<PackageReference>` with `Version` attribute in `.csproj` files (CPM requires versions in `Directory.Packages.props`)
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Templates
|
|
94
|
+
|
|
95
|
+
Templates are stored in `~/.claude/skills/dotnet-standards/templates/`
|
|
96
|
+
|
|
97
|
+
### Placeholder Substitution
|
|
98
|
+
|
|
99
|
+
| Placeholder | Description | Example |
|
|
100
|
+
|-------------|-------------|---------|
|
|
101
|
+
| `{{PROJECT_NAME}}` | Project name | `MyProject` |
|
|
102
|
+
| `{{NAMESPACE}}` | Root namespace | `Lvlup.MyProject` |
|
|
103
|
+
| `{{COMPANY_NAME}}` | Company for copyright | `Levelup Software` |
|
|
104
|
+
|
|
105
|
+
### Override Markers
|
|
106
|
+
|
|
107
|
+
Templates contain markers for project-local customization:
|
|
108
|
+
|
|
109
|
+
```xml
|
|
110
|
+
<!-- === PROJECT-LOCAL OVERRIDES BELOW === -->
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Content below these markers is preserved during sync operations.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Standard Directory Structure
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
{ProjectName}/
|
|
121
|
+
├── .github/
|
|
122
|
+
│ ├── workflows/
|
|
123
|
+
│ │ ├── ci.yml
|
|
124
|
+
│ │ └── release.yml
|
|
125
|
+
│ └── ISSUE_TEMPLATE/
|
|
126
|
+
│ ├── bug_report.md
|
|
127
|
+
│ └── feature_request.md
|
|
128
|
+
├── src/
|
|
129
|
+
│ ├── {ProjectName}.Core/
|
|
130
|
+
│ │ ├── Abstractions/
|
|
131
|
+
│ │ ├── Models/
|
|
132
|
+
│ │ └── {ProjectName}.Core.csproj
|
|
133
|
+
│ ├── {ProjectName}.Core.Tests/
|
|
134
|
+
│ │ └── {ProjectName}.Core.Tests.csproj
|
|
135
|
+
│ ├── Directory.Build.props
|
|
136
|
+
│ ├── Directory.Packages.props
|
|
137
|
+
│ ├── stylecop.json
|
|
138
|
+
│ ├── .editorconfig
|
|
139
|
+
│ ├── global.json
|
|
140
|
+
│ └── {ProjectName}.sln
|
|
141
|
+
├── docs/
|
|
142
|
+
│ ├── architecture/
|
|
143
|
+
│ ├── development/
|
|
144
|
+
│ └── adrs/
|
|
145
|
+
├── scripts/
|
|
146
|
+
├── README.md
|
|
147
|
+
├── LICENSE
|
|
148
|
+
└── .gitignore
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Validation Implementation
|
|
154
|
+
|
|
155
|
+
When `/dotnet-standards validate` is invoked:
|
|
156
|
+
|
|
157
|
+
1. **Locate src/ directory** - Find the source root (current dir or specified path)
|
|
158
|
+
|
|
159
|
+
2. **Check required files exist:**
|
|
160
|
+
```bash
|
|
161
|
+
# Files that must exist in src/
|
|
162
|
+
src/Directory.Build.props
|
|
163
|
+
src/Directory.Packages.props
|
|
164
|
+
src/stylecop.json
|
|
165
|
+
src/.editorconfig
|
|
166
|
+
src/global.json
|
|
167
|
+
src/*.sln
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
3. **Check required directories exist:**
|
|
171
|
+
```bash
|
|
172
|
+
src/
|
|
173
|
+
docs/
|
|
174
|
+
.github/workflows/
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
4. **Validate Directory.Build.props:**
|
|
178
|
+
- Contains `<PackageReference Include="Lvlup.Build"`
|
|
179
|
+
- Contains `<Nullable>enable</Nullable>`
|
|
180
|
+
|
|
181
|
+
5. **Validate Directory.Packages.props:**
|
|
182
|
+
- Contains `<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>`
|
|
183
|
+
|
|
184
|
+
6. **Validate .editorconfig:**
|
|
185
|
+
- Has `root = true`
|
|
186
|
+
- Has `end_of_line = crlf`
|
|
187
|
+
|
|
188
|
+
7. **Compare against templates:**
|
|
189
|
+
- Report differences (excluding project-local sections)
|
|
190
|
+
- Flag outdated versions
|
|
191
|
+
|
|
192
|
+
8. **Output report:**
|
|
193
|
+
```
|
|
194
|
+
=== .NET Standards Validation Report ===
|
|
195
|
+
|
|
196
|
+
Path: /path/to/project
|
|
197
|
+
|
|
198
|
+
[ERROR] Missing file: src/global.json
|
|
199
|
+
[WARN] Outdated: src/.editorconfig (template v2.0, project v1.0)
|
|
200
|
+
[INFO] Consider adding: .github/ISSUE_TEMPLATE/
|
|
201
|
+
|
|
202
|
+
Summary: 1 error, 1 warning, 1 info
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Sync Implementation
|
|
208
|
+
|
|
209
|
+
When `/dotnet-standards sync` is invoked:
|
|
210
|
+
|
|
211
|
+
1. **Run validation first** - Identify what needs syncing
|
|
212
|
+
|
|
213
|
+
2. **For each outdated/missing file:**
|
|
214
|
+
- Show diff between template and current file
|
|
215
|
+
- Preserve content below `=== PROJECT-LOCAL` markers
|
|
216
|
+
- Ask for confirmation before applying
|
|
217
|
+
|
|
218
|
+
3. **Create backups:**
|
|
219
|
+
- Save original files to `.backup/` before modifying
|
|
220
|
+
|
|
221
|
+
4. **Apply changes:**
|
|
222
|
+
- Copy template content
|
|
223
|
+
- Restore project-local sections
|
|
224
|
+
- Replace placeholders with actual values
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Scaffold Implementation
|
|
229
|
+
|
|
230
|
+
When `/dotnet-standards scaffold` is invoked:
|
|
231
|
+
|
|
232
|
+
1. **Parse arguments:**
|
|
233
|
+
- `<name>`: Required project name
|
|
234
|
+
- `--namespace`: Optional, defaults to project name
|
|
235
|
+
- `--company`: Optional, defaults to "Levelup Software"
|
|
236
|
+
|
|
237
|
+
2. **Create directory structure:**
|
|
238
|
+
```bash
|
|
239
|
+
mkdir -p {name}/.github/workflows
|
|
240
|
+
mkdir -p {name}/.github/ISSUE_TEMPLATE
|
|
241
|
+
mkdir -p {name}/src/{name}.Core/Abstractions
|
|
242
|
+
mkdir -p {name}/src/{name}.Core/Models
|
|
243
|
+
mkdir -p {name}/src/{name}.Core.Tests
|
|
244
|
+
mkdir -p {name}/docs/architecture
|
|
245
|
+
mkdir -p {name}/docs/development
|
|
246
|
+
mkdir -p {name}/docs/adrs
|
|
247
|
+
mkdir -p {name}/scripts
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
3. **Copy and process templates:**
|
|
251
|
+
- Replace `{{PROJECT_NAME}}` with project name
|
|
252
|
+
- Replace `{{NAMESPACE}}` with namespace
|
|
253
|
+
- Replace `{{COMPANY_NAME}}` with company name
|
|
254
|
+
|
|
255
|
+
4. **Create solution and projects:**
|
|
256
|
+
```bash
|
|
257
|
+
cd {name}/src
|
|
258
|
+
dotnet new sln -n {name}
|
|
259
|
+
dotnet new classlib -n {name}.Core -o {name}.Core
|
|
260
|
+
dotnet new classlib -n {name}.Core.Tests -o {name}.Core.Tests
|
|
261
|
+
dotnet sln add {name}.Core/{name}.Core.csproj
|
|
262
|
+
dotnet sln add {name}.Core.Tests/{name}.Core.Tests.csproj
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
5. **Initialize git:**
|
|
266
|
+
```bash
|
|
267
|
+
cd {name}
|
|
268
|
+
git init
|
|
269
|
+
```
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# C# Standards
|
|
2
|
+
|
|
3
|
+
## File Organization
|
|
4
|
+
|
|
5
|
+
- **One public type per file**: File name matches type name (e.g., `MyClass.cs`)
|
|
6
|
+
- **Nested types exempt**: Internal/private nested types can remain in parent file
|
|
7
|
+
|
|
8
|
+
## Class Design
|
|
9
|
+
|
|
10
|
+
| Rule | Rationale |
|
|
11
|
+
|------|-----------|
|
|
12
|
+
| `sealed` by default | Explicitly design for inheritance or seal |
|
|
13
|
+
| Inheritance depth <= 2 | Deeper hierarchies -> refactor to composition |
|
|
14
|
+
| Composition over inheritance | Prefer delegation for code reuse |
|
|
15
|
+
|
|
16
|
+
## Naming Conventions
|
|
17
|
+
|
|
18
|
+
| Element | Convention | Example |
|
|
19
|
+
|---------|------------|---------|
|
|
20
|
+
| Classes/Records | PascalCase | `OrderService`, `OrderCreatedEvent` |
|
|
21
|
+
| Interfaces | `I` prefix + PascalCase | `IOrderRepository` |
|
|
22
|
+
| Methods | PascalCase | `ProcessOrderAsync` |
|
|
23
|
+
| Properties | PascalCase | `OrderId`, `IsValid` |
|
|
24
|
+
| Private fields | `_camelCase` | `_repository`, `_logger` |
|
|
25
|
+
| Static fields | `s_camelCase` | `s_sharedInstance` |
|
|
26
|
+
| Constants | PascalCase | `MaxRetryCount` |
|
|
27
|
+
| Parameters/locals | camelCase | `orderId`, `isValid` |
|
|
28
|
+
| Type parameters | `T` prefix | `TEntity`, `TResult` |
|
|
29
|
+
| Async methods | `Async` suffix | `GetOrderAsync` |
|
|
30
|
+
| Files | Match type name | `OrderService.cs` |
|
|
31
|
+
| Test files | `*.Tests.cs` | `OrderService.Tests.cs` |
|
|
32
|
+
|
|
33
|
+
## File Headers (Required)
|
|
34
|
+
|
|
35
|
+
```csharp
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// <copyright file="FileName.cs" company="Levelup Software">
|
|
38
|
+
// Copyright (c) Levelup Software. All rights reserved.
|
|
39
|
+
// </copyright>
|
|
40
|
+
// =============================================================================
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Member Ordering
|
|
44
|
+
|
|
45
|
+
1. Constants and static readonly fields
|
|
46
|
+
2. Private readonly fields
|
|
47
|
+
3. Properties (public, then private)
|
|
48
|
+
4. Constructors
|
|
49
|
+
5. Public methods
|
|
50
|
+
6. Private methods
|
|
51
|
+
7. Nested types
|
|
52
|
+
|
|
53
|
+
## Using Statements
|
|
54
|
+
|
|
55
|
+
- File-scoped namespaces: `namespace Agentic.Core;`
|
|
56
|
+
- Global usings in `GlobalUsings.cs` for common imports
|
|
57
|
+
- Group: System -> Third-party -> Application
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
| Requirement | Standard |
|
|
62
|
+
|-------------|----------|
|
|
63
|
+
| XML docs | Required for all `public` members |
|
|
64
|
+
| Tags | `<summary>`, `<param>`, `<returns>` mandatory |
|
|
65
|
+
| Exceptions | `<exception cref="...">` for thrown exceptions |
|
|
66
|
+
|
|
67
|
+
## Async/Await
|
|
68
|
+
|
|
69
|
+
| Rule | Standard |
|
|
70
|
+
|------|----------|
|
|
71
|
+
| Suffix | All async methods end with `Async` |
|
|
72
|
+
| ConfigureAwait | `.ConfigureAwait(false)` in library code |
|
|
73
|
+
| CancellationToken | Accept as final optional parameter with `default` value |
|
|
74
|
+
| Return types | `Task<T>`, `Task`, or `IAsyncEnumerable<T>` |
|
|
75
|
+
| Avoid async void | Only for event handlers |
|
|
76
|
+
|
|
77
|
+
## Nullable Reference Types
|
|
78
|
+
|
|
79
|
+
| Rule | Standard |
|
|
80
|
+
|------|----------|
|
|
81
|
+
| Project setting | `<Nullable>enable</Nullable>` required |
|
|
82
|
+
| Non-nullable default | Reference types without `?` are non-nullable |
|
|
83
|
+
| Explicit nullability | Use `?` suffix for nullable types |
|
|
84
|
+
| Runtime guards | `ArgumentNullException.ThrowIfNull()` |
|
|
85
|
+
| No `!` abuse | Avoid null-forgiving operator except rare cases |
|
|
86
|
+
|
|
87
|
+
## Modern C# Features
|
|
88
|
+
|
|
89
|
+
- **Primary constructors** (C# 12): Only for simple cases without validation
|
|
90
|
+
- **Collection expressions** (C# 12): `int[] numbers = [1, 2, 3];` with spread `[..first, ..second]`
|
|
91
|
+
- **Required members** (C# 11): `public required string Name { get; init; }`
|
|
92
|
+
- **Pattern matching**: Property patterns, switch expressions, type patterns
|
|
93
|
+
|
|
94
|
+
## Result Pattern
|
|
95
|
+
|
|
96
|
+
```csharp
|
|
97
|
+
public async Task<Result<Order>> PlaceOrderAsync(OrderRequest request)
|
|
98
|
+
{
|
|
99
|
+
if (!request.IsValid)
|
|
100
|
+
return Error.Create(ErrorType.Validation, "INVALID_ORDER", "Order validation failed");
|
|
101
|
+
var order = await _repository.SaveAsync(request);
|
|
102
|
+
return order;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var result = await service.PlaceOrderAsync(request);
|
|
106
|
+
return result.Match(
|
|
107
|
+
onSuccess: order => Ok(order),
|
|
108
|
+
onFailure: error => BadRequest(error.Message));
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Dependency Injection
|
|
112
|
+
|
|
113
|
+
- Extension method naming: `Add{Layer}Services`
|
|
114
|
+
- Options pattern with `ValidateDataAnnotations` + `ValidateOnStart`
|
|
115
|
+
- Central Package Management: versions in `Directory.Packages.props`
|
|
116
|
+
- Reference `Lvlup.Build` meta-package for analyzers and defaults
|
|
117
|
+
|
|
118
|
+
## /dotnet-standards Skill
|
|
119
|
+
|
|
120
|
+
Use `/dotnet-standards` for project configuration validation and scaffolding.
|