solid-code-synthesizer
Skill2 starsChanged 18 days agoMITView on GitHub
Synthesize and verify C# 14 / .NET 10 code through a 5-stage SOLID and Categorical invariant pipeline (SRP pure domain types, ISP segregated ports, DIP Onion injection, OCP/LSP behavioral contract tests, and boundary error semantics). Use when generating, refactoring, or auditing domain models, services, repositories, or providers in GeoAssets.
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- code-gen-dagSkill
- outer-loop-dag-orchestratorSkill
- plan-gen-dagSkill
- csharp-conventionsSkill
- jira-conventionsSkill
- observability-conventionsSkill
- outer-loop-dag-orchestratorSkill
- solid-code-synthesizerSkill
- ui-ux-pro-maxSkill
- solid-code-synthesizerSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read references/csharp14-solid-categorical-matrix.md for the complete SOLID $\leftrightarrow$ Category Theory $\leftrightarrow$ …
- Very specific: line 68
Gate: Run python3 scripts/verify-solid-contracts.py (Exit 0) followed by ./scripts/verify-agent-worktree.sh (Exit 0) with zero #pragma …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SOLID & Categorical C# 14 Code Synthesizer
Enforces SOLID structural principles, Onion Architecture, and Category Theory target-code invariants across synthesized C# 14 / .NET 10 artifacts using a deterministic 5-stage synthesis and verification pipeline.
- Read
references/csharp14-solid-categorical-matrix.mdfor the complete SOLID $\leftrightarrow$ Category Theory $\leftrightarrow$ Roslyn/xUnit verification mapping. - Respect
.claude/skills/csharp-conventions/SKILL.mdas the authoritative source for GeoAssets C# idioms.
Verification Oracles
- Fast SOLID & Guardrail Verifier:
python3 scripts/verify-solid-contracts.py --target <repo-or-worktree> [--files <paths...>] - Full Solution Gatekeeper:
./scripts/verify-agent-worktree.sh <repo-or-worktree>
5-Stage Progressive Code Synthesis Pipeline
Execute or audit code synthesis across these five ordered stages so each stage's postconditions satisfy the next stage's preconditions ($g \circ f$):
Stage 1 — SRP & Category Objects (Pure Domain Types)
- Synthesize:
readonly record structfor small immutable value objects, strongly-typed IDs, coordinates, and bounding boxes.sealed recordfor immutable commands, domain events, and REST DTOs.- Focused
classentities/services with a single axis of mutation (keep methods cohesive, cyclomatic complexity $< 10$). - Preserve GeoAssets' geometry invariant: RFC 7946
[longitude, latitude]coordinate arrays (SRID 4326) are the serialized source of truth;NtsGeometryis lazily derived.
- Gate: Zero
Microsoft.EntityFrameworkCore,Npgsql,HttpClient, orGeoAssets.Provider.*references insidecore/.
Stage 2 — ISP & Categorical Projections (Segregated Role Ports)
- Synthesize:
- Fine-grained, consumer-specific interfaces (
<= 5cohesive methods per new role port; split read queries from mutations, e.g.,IServiceOrderReadervs.IServiceOrderWriter). - Minimal DTO projections (
JsonSerializerContextsource generation where high-throughput) for REST/messaging boundaries. - UI components split strictly into markup-only
.razor+.razor.cscode-behind partial class (exceptMauiLogin.razor).
- Fine-grained, consumer-specific interfaces (
- Gate: Zero fat "god interfaces" and zero dummy/no-op interface implementations.
Stage 3 — DIP & Natural Transformations (Inversion & DI Lifetimes)
- Synthesize:
- Constructor injection exclusively over domain abstractions (
IAssetProvider,IGeoAuthorizationService,System.TimeProvider). - Forward
CancellationTokenacross all async morphisms (ConfigureAwait(false)in non-UI libraries:core/,providers/,workflow/). - Match DI lifetimes carefully (
Transientstateless,Scopedper-request/DbContext,Singletonthread-safe only — never capture aScopedservice inside aSingleton).
- Constructor injection exclusively over domain abstractions (
- Gate: Zero
new *DbContext(...),new HttpClient(...), orDateTime.Now/UtcNow(RS0030) inside domain services.
Stage 4 — OCP & LSP (Extensible Strategies & Behavioral Contract Suites)
- Synthesize:
- Extend behavior via open extension points (
IServiceOrderRulechains,IProviderPlugin,IExternalProviderFactory,[ExportGeoCommand], event-preserving decorators likeActiveAssetProvider) instead of modifying stable core dispatchers. - Guarantee Liskov Substitution: every concrete adapter (
EF*,Postgres*,Rest*,Shapefile*,InMemory*) must honor base preconditions/postconditions and event propagation (FeatureAdded/Updated/Deleted/CollectionChanged) with zeroNotImplementedExceptionstubs. - Pair multi-backend interfaces with shared abstract contract test suites (following
ServiceOrderRepositoryContractTestsinGeoAssets.Workflow.TestKit).
- Extend behavior via open extension points (
- Gate: Shared contract tests + 100% branch coverage xUnit
[Fact]/[Theory]suites pass.
Stage 5 — Categorical Effect & Boundary Error Semantics
- Follow GeoAssets' Boundary Rule (
error-handling-and-result-pattern.md):- Expected Absence / Inline Branching: Return explicit nullable types (
T?with<Nullable>enable</Nullable>),Try*methods, or narrow validation/ruleResultobjects — never throw exceptions for routine "not found" reads (GetByIdAsync$\to$null/ HTTP404). - Invariant Violations Across Process Boundaries: Throw specific typed domain exceptions on invalid writes/transitions (
InvalidServiceOrderTransitionException,ServiceOrderConcurrencyException, etc.) and implement bidirectional HTTP translation (Map*Apistructured400/409/404$\leftrightarrow$Rest*Repositoryexception reconstruction) so remote REST adapters remain Liskov-substitutable for in-process EF Core adapters.
- Expected Absence / Inline Branching: Return explicit nullable types (
- Gate: Run
python3 scripts/verify-solid-contracts.py(Exit 0) followed by./scripts/verify-agent-worktree.sh(Exit 0) with zero#pragma warning disable,[SuppressMessage], or<NoWarn>.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

