ln-722-backend-generator by levnikolaevich/claude-code-skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-722-backend-generatorPaths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
类型: L3 工作者 类别: 7XX 项目引导 父级: ln-720-结构迁移器
遵循整洁架构原则,生成完整的 .NET 后端结构。
| 方面 | 描述 |
|---|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 项目名称、实体列表、配置选项 |
| 输出 | 具有分层架构的完整 .NET 解决方案 |
| 目标 | .NET 10+, ASP.NET Core |
范围边界:
| 阶段 | 名称 | 操作 | 输出 |
|---|---|---|---|
| 1 | 接收上下文 | 从协调器获取项目名称、实体、选项 | 配置 |
| 2 | 创建解决方案 | 创建 .sln 和 .csproj 文件 | 空的解决方案结构 |
| 3 | 生成领域层 | 创建实体、枚举、基类 | 领域层项目文件 |
| 4 | 生成 API 层 | 创建控制器、DTO、中间件 | API 项目文件 |
| 5 | 验证 | 构建解决方案,检查引用 | 构建成功 |
接受来自 ln-720-结构迁移器的委托。
| 输入 | 类型 | 必需 | 描述 |
|---|---|---|---|
projectName | string | 是 | 解决方案和项目名称前缀 |
targetPath | string | 是 | 生成解决方案的目录 |
targetFramework | string | 是 | .NET 版本 (例如,net10.0) |
entities | list | 是 | 要生成的实体名称 |
features | list | 是 | 用于 MockData 的功能分组 |
选项:
| 选项 | 默认值 | 效果 |
|---|---|---|
useSwagger | true | 添加 Swashbuckle 用于 API 文档 |
useSerilog | true | 添加结构化日志记录 |
useHealthChecks | true | 添加健康检查端点 |
createMockData | true | 生成模拟数据类 |
生成解决方案文件和项目结构。
| 步骤 | 操作 | 参考 |
|---|---|---|
| 2.1 | 创建解决方案目录 | — |
| 2.2 | 生成 .sln 文件 | — |
| 2.3 | 创建项目目录 | layer_structure.md |
| 2.4 | 为每个层生成 .csproj 文件 | layer_structure.md |
| 2.5 | 添加项目引用 | layer_structure.md |
生成的项目:
| 项目 | 目的 |
|---|---|
{Project}.Api | HTTP 端点、中间件 |
{Project}.Domain | 实体、枚举 |
{Project}.Services | 业务逻辑接口 |
{Project}.Repositories | 数据访问接口 |
{Project}.Shared | 横切关注点工具类 |
创建领域层文件。
| 步骤 | 操作 | 参考 |
|---|---|---|
| 3.1 | 创建 BaseEntity 类 | entity_patterns.md |
| 3.2 | 根据输入生成实体类 | entity_patterns.md |
| 3.3 | 生成状态枚举 | entity_patterns.md |
| 3.4 | 创建文件夹结构 | layer_structure.md |
实体生成规则:
| 实体属性 | 生成形式 |
|---|---|
| 主键 | public Guid Id { get; set; } |
| 字符串字段 | public string Name { get; set; } = string.Empty; |
| 状态字段 | public {Entity}Status Status { get; set; } |
| 时间戳 | 继承自 BaseEntity 的 CreatedAt, UpdatedAt |
创建 API 层文件。
| 步骤 | 操作 | 参考 |
|---|---|---|
| 4.1 | 生成 Program.cs | program_sections.md |
| 4.2 | 为每个实体生成控制器 | controller_patterns.md |
| 4.3 | 为每个实体生成 DTO | controller_patterns.md |
| 4.4 | 生成中间件类 | layer_structure.md |
| 4.5 | 生成扩展方法 | program_sections.md |
| 4.6 | 生成 MockData 类 (如果启用) | layer_structure.md |
| 4.7 | 添加 NuGet 包 | nuget_packages.md |
每个实体的控制器端点:
| 端点 | 方法 | 路由 |
|---|---|---|
| GetAll | GET | /api/{entities} |
| GetById | GET | /api/{entities}/{id} |
| Create | POST | /api/{entities} |
| Update | PUT | /api/{entities}/{id} |
| Delete | DELETE | /api/{entities}/{id} |
验证生成的解决方案。
| 检查项 | 命令 | 预期结果 |
|---|---|---|
| 解决方案构建 | dotnet build | 成功,无错误 |
| 项目引用 | 检查 .csproj | 所有引用有效 |
| 文件已创建 | 目录列表 | 所有预期文件存在 |
| 层 | 文件夹 | 每个实体的文件 |
|---|---|---|
| Api | Controllers/, DTOs/, Middleware/, MockData/, Extensions/ | 控制器, DTO |
| Domain | Entities/, Enums/, Common/ | 实体, 状态枚举 |
| Services | Interfaces/ | 接口 (存根) |
| Repositories | Interfaces/ | 接口 (存根) |
| Shared | — | 工具类 |
dotnet build 通过dotnet build 成功通过| 风险 | 检测 | 缓解措施 |
|---|---|---|
| 构建失败 | dotnet build 失败 | 检查 .csproj 引用,验证 SDK 版本 |
| 缺少引用 | CS0246 错误 | 添加缺失的项目引用 |
| 无效的实体名称 | 构建或运行时错误 | 在生成前验证实体名称 |
| 路径冲突 | 文件已存在错误 | 检查目标路径,覆盖前提示 |
| 包还原失败 | NuGet 错误 | 验证网络连接,检查包名称 |
| 文件 | 目的 |
|---|---|
references/layer_structure.md | 项目组织、文件夹结构、依赖关系 |
references/entity_patterns.md | 实体生成规则、属性模式 |
references/controller_patterns.md | 控制器和 DTO 生成规则 |
references/program_sections.md | Program.cs 结构和服务注册 |
references/nuget_packages.md | 必需和可选的 NuGet 包 |
版本: 2.0.0 最后更新: 2026-01-10
每周安装
146
仓库
GitHub 星标
245
首次出现
2026年1月24日
安全审计
安装于
claude-code135
gemini-cli131
codex131
opencode131
cursor130
github-copilot126
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-720-structure-migrator
Generates complete .NET backend structure following Clean Architecture principles.
| Aspect | Description |
|---|---|
| Input | Project name, entity list, configuration options |
| Output | Complete .NET solution with layered architecture |
| Target | .NET 10+, ASP.NET Core |
Scope boundaries:
| Phase | Name | Actions | Output |
|---|---|---|---|
| 1 | Receive Context | Get project name, entities, options from coordinator | Configuration |
| 2 | Create Solution | Create .sln and .csproj files | Empty solution structure |
| 3 | Generate Domain | Create entities, enums, base classes | Domain project files |
| 4 | Generate API | Create controllers, DTOs, middleware | API project files |
| 5 | Verify | Build solution, check references | Build success |
Accept delegation from ln-720-structure-migrator.
| Input | Type | Required | Description |
|---|---|---|---|
projectName | string | Yes | Solution and project name prefix |
targetPath | string | Yes | Directory for generated solution |
targetFramework | string | Yes | .NET version (e.g., net10.0) |
entities | list | Yes | Entity names to generate |
Options:
| Option | Default | Effect |
|---|---|---|
useSwagger | true | Add Swashbuckle for API docs |
useSerilog | true | Add structured logging |
useHealthChecks | true | Add health endpoints |
createMockData | true | Generate mock data classes |
Generate solution file and project structure.
| Step | Action | Reference |
|---|---|---|
| 2.1 | Create solution directory | — |
| 2.2 | Generate .sln file | — |
| 2.3 | Create project directories | layer_structure.md |
| 2.4 | Generate .csproj files per layer | layer_structure.md |
| 2.5 | Add project references | layer_structure.md |
Generated projects:
| Project | Purpose |
|---|---|
{Project}.Api | HTTP endpoints, middleware |
{Project}.Domain | Entities, enums |
{Project}.Services | Business logic interfaces |
{Project}.Repositories | Data access interfaces |
{Project}.Shared | Cross-cutting utilities |
Create domain layer files.
| Step | Action | Reference |
|---|---|---|
| 3.1 | Create BaseEntity class | entity_patterns.md |
| 3.2 | Generate entity classes per input | entity_patterns.md |
| 3.3 | Generate status enums | entity_patterns.md |
| 3.4 | Create folder structure | layer_structure.md |
Entity generation rules:
| Entity Property | Generated As |
|---|---|
| Primary key | public Guid Id { get; set; } |
| String field | public string Name { get; set; } = string.Empty; |
| Status field | public {Entity}Status Status { get; set; } |
| Timestamps | CreatedAt, UpdatedAt from BaseEntity |
Create API layer files.
| Step | Action | Reference |
|---|---|---|
| 4.1 | Generate Program.cs | program_sections.md |
| 4.2 | Generate controllers per entity | controller_patterns.md |
| 4.3 | Generate DTOs per entity | controller_patterns.md |
| 4.4 | Generate middleware classes | layer_structure.md |
| 4.5 | Generate extension methods | program_sections.md |
Controller endpoints per entity:
| Endpoint | Method | Route |
|---|---|---|
| GetAll | GET | /api/{entities} |
| GetById | GET | /api/{entities}/{id} |
| Create | POST | /api/{entities} |
| Update | PUT | /api/{entities}/{id} |
| Delete | DELETE | /api/{entities}/{id} |
Validate generated solution.
| Check | Command | Expected |
|---|---|---|
| Solution builds | dotnet build | Success, no errors |
| Project references | Check .csproj | All references valid |
| Files created | Directory listing | All expected files present |
| Layer | Folders | Files per Entity |
|---|---|---|
| Api | Controllers/, DTOs/, Middleware/, MockData/, Extensions/ | Controller, DTO |
| Domain | Entities/, Enums/, Common/ | Entity, Status enum |
| Services | Interfaces/ | Interface (stub) |
| Repositories | Interfaces/ | Interface (stub) |
| Shared | — | Utility classes |
dotnet build passesdotnet build passes successfully| Risk | Detection | Mitigation |
|---|---|---|
| Build failure | dotnet build fails | Check .csproj references, verify SDK version |
| Missing references | CS0246 errors | Add missing project references |
| Invalid entity names | Build or runtime errors | Validate entity names before generation |
| Path conflicts | File exists errors | Check target path, prompt before overwrite |
| Package restore failure | NuGet errors | Verify network, check package names |
| File | Purpose |
|---|---|
references/layer_structure.md | Project organization, folder structure, dependencies |
references/entity_patterns.md | Entity generation rules, property patterns |
references/controller_patterns.md | Controller and DTO generation rules |
references/program_sections.md | Program.cs structure and service registration |
references/nuget_packages.md | Required and optional NuGet packages |
Version: 2.0.0 Last Updated: 2026-01-10
Weekly Installs
146
Repository
GitHub Stars
245
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code135
gemini-cli131
codex131
opencode131
cursor130
github-copilot126
NestJS Drizzle CRUD 生成器 - 自动生成类型安全的 NestJS 后端模块
254 周安装
features| list |
| Yes |
| Feature groupings for MockData |
| 4.6 | Generate MockData classes (if enabled) | layer_structure.md |
| 4.7 | Add NuGet packages | nuget_packages.md |