collection-codebase-patterns

Enforces layered architecture rules for .NET collection app export, session, and DAL changes.

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/D1ssolve/craft-agents --skill collection-codebase-patterns-d1ssolve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: collection-codebase-patterns
Source: https://github.com/D1ssolve/craft-agents/tree/main/skills/collection-codebase-patterns
Command: npx skills add https://github.com/D1ssolve/craft-agents --skill collection-codebase-patterns-d1ssolve

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Changing a layered .NET application (Backend, BLL, DAL, Contracts) often introduces review mistakes such as layer boundary violations, wrong exception types, racy duplicate checks, and in-memory file buffering. This Skill provides a pre-flight checklist and concrete rules that prevent those mistakes before implementation. ## Core Features & Use Cases - Layer Boundary Enforcement: Keeps dependencies flowing Frontend/Backend -> Contracts + BLL -> DAL, ensuring DAL never references Contracts or Frontend. - Exception and Constraint Strategy: Mandates BllException in BLL, transport exceptions only at edges, and DB unique filtered indexes with CommitResult handling instead of racy pre-checks. - Export and Streaming Conventions: Standardizes a generic export endpoint with keyed plugin DI resolution, JsonDocument/jsonb filter storage, and temp-file streaming to S3 instead of MemoryStream buffering. - Use Case: When adding a new export type to the collection app, follow the checklist to register a keyed IPlugin, store filters as jsonb, enforce duplicate prevention via a unique index, and stream records to a temp file for S3 upload. ## Quick Start Review my planned changes to the collection app's export feature against the codebase patterns checklist before I start coding.

Frequently Asked Questions about collection-codebase-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce layer boundaries in a layered .NET application?

Keep dependencies flowing Frontend/Backend to Contracts and BLL to DAL, and never let DAL reference Contracts or Frontend. Backend handles authentication and transport parsing only, BLL orchestrates business flow, and DAL owns persistence, EF configurations, and migrations.

How do I prevent duplicate exports in a .NET backend?

Enforce duplicates with a unique filtered database index, such as (CreatedById, TypeId) where status is pending or exporting. Do not rely on pre-check repository methods since they race; instead handle CommitResult constraint violations in BLL and throw a domain exception like DuplicateExportException.

Should I store JSON filters as string or jsonb in PostgreSQL with EF Core?

Store filters as System.Text.Json.JsonDocument and configure the EF column as PostgreSQL jsonb using HasColumnType("jsonb"). Parse JSON at the Backend edge and deserialize concrete DTOs in BLL plugins rather than storing plain string or text.

Why should export files avoid MemoryStream before S3 upload?

MemoryStream materializes the entire export in memory, which does not scale for large datasets. Stream records to a temp file with a writer returning the row count, delete it in a finally block, and reopen it for S3 upload only when the count is greater than zero.

When should BLL throw RpcException versus BllException?

BLL managers and plugins should throw BllException or domain subclasses, never RpcException. Transport exceptions belong only at the transport edge, and middleware or the host maps domain exceptions to the appropriate response.