code-patterns

Generate standardized C# code patterns for AutoMapper, UnitOfWork, exceptions, and constants.

Updated Nov 13, 2025
One-click install
npx skills add https://github.com/changjian-wang/dawning --skill code-patterns-changjian-wang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-patterns
Source: https://github.com/changjian-wang/dawning/tree/main/.github/skills/code-patterns
Command: npx skills add https://github.com/changjian-wang/dawning --skill code-patterns-changjian-wang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces consistent coding practices in C# projects, ensuring maintainability and reducing boilerplate code by providing standardized patterns for mapping, service implementation, exception handling, and constants.

Core Features & Use Cases

  • Static AutoMapper Profiles: Generates standard AutoMapper profiles for DTOs and entities.
  • Service Layer Pattern: Implements the Unit of Work pattern for service classes, abstracting repository access.
  • Exception Handling: Defines custom exception types with appropriate HTTP status codes and error code prefixes.
  • Constants Definition: Provides templates for defining constants, especially for cache keys.
  • Use Case: When creating a new feature that involves user management, use this Skill to generate the necessary mapping profiles, service interfaces and implementations, and define relevant exceptions and constants according to project conventions.

Quick Start

Use the code-patterns skill to implement the static mapper pattern for the 'Product' entity.

Frequently Asked Questions about code-patterns

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

FAQPage Schema
How do I implement the Unit of Work pattern in a C# service layer?

You can generate static AutoMapper profiles for your C# DTOs and entities by defining mapping configurations in a static structure. This standardizes object mapping across your application, reducing boilerplate code and ensuring consistency.

How do I create custom exceptions with HTTP status codes in C#?

You create custom exception types in C# by defining classes that include appropriate HTTP status codes and error code prefixes. This standardizes exception handling and error reporting across your service layer.

What is the best way to define constant cache keys in C# enterprise applications?

The best way to define constant cache keys in C# enterprise applications is to use standardized constant definition templates. This ensures consistent naming conventions for cache keys and audit logs across the entire project.

Does this C# code pattern generation enforce Domain-Driven Design principles?

Yes, generating C# code patterns with these templates enforces Domain-Driven Design principles and best practices. It provides standardized structures for your service layer, mappings, and exceptions for scalable enterprise applications.