ln-770-crosscutting-setup by levnikolaevich/claude-code-skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-770-crosscutting-setup路径说明: 文件路径(
shared/、references/、../ln-*)是相对于技能仓库根目录的。如果在当前工作目录未找到,请定位此 SKILL.md 文件所在的目录,然后向上返回一级以找到仓库根目录。如果缺少shared/目录,请通过 WebFetch 从https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}获取文件。
类型: L2 领域协调器 类别: 7XX 项目引导 父级: ln-700-项目引导
协调 .NET 和 Python 项目的横切关注点配置。
| 方面 | 详情 |
|---|---|
| 输入 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 项目根目录 |
| 输出 | 配置好的日志记录、错误处理、CORS、健康检查、API 文档 |
| 工作单元 | ln-771 至 ln-775 |
| 技术栈 | .NET (ASP.NET Core), Python (FastAPI) |
通过扫描项目文件来确定技术栈。
检测规则:
| 文件模式 | 技术栈 | 框架 |
|---|---|---|
*.csproj | .NET | ASP.NET Core |
pyproject.toml 或 requirements.txt + FastAPI | Python | FastAPI |
操作:
*.csproj 文件pyproject.toml 或 requirements.txt初始上下文存储:
{
"STACK": ".NET" | "Python",
"FRAMEWORK": "ASP.NET Core" | "FastAPI",
"PROJECT_ROOT": "/path/to/project",
"FRAMEWORK_VERSION": "8.0" | "0.109.0"
}
扫描已配置的横切关注点。
检测模式:
| 关注点 | .NET 模式 | Python 模式 |
|---|---|---|
| 日志记录 | *.csproj 中的 Serilog,Program.cs 中的 UseSerilog | requirements 中的 structlog,日志配置 |
| 错误处理 | GlobalExceptionMiddleware, UseExceptionHandler | @app.exception_handler, exception_handlers.py |
| CORS | AddCors, UseCors | CORSMiddleware |
| 健康检查 | AddHealthChecks, MapHealthChecks | /health 路由 |
| API 文档 | AddSwaggerGen, UseSwagger | FastAPI 自动生成 |
操作:
skip: true更新后的上下文存储:
{
"concerns": {
"logging": { "configured": false },
"errorHandling": { "configured": false },
"cors": { "configured": true, "skip": true },
"healthChecks": { "configured": false },
"apiDocs": { "configured": false }
}
}
仅将未配置的关注点委托给相应的工作单元。
工作单元调用顺序:
| 顺序 | 工作单元 | 条件 | 技能调用 |
|---|---|---|---|
| 1 | ln-771-日志配置器 | logging.configured == false | /skill ln-771-logging-configurator |
| 2 | ln-772-错误处理程序设置 | errorHandling.configured == false | /skill ln-772-error-handler-setup |
| 3 | ln-773-CORS配置器 | cors.configured == false | /skill ln-773-cors-configurator |
| 4 | ln-774-健康检查设置 | healthChecks.configured == false | /skill ln-774-healthcheck-setup |
| 5 | ln-775-API文档生成器 | apiDocs.configured == false | /skill ln-775-api-docs-generator |
调用(条件性 — 如果关注点已配置则跳过):
Skill(skill: "ln-771-logging-configurator", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-772-error-handler-setup", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-773-cors-configurator", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-774-healthcheck-setup", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-775-api-docs-generator", args: "{STACK} {FRAMEWORK}")
将上下文存储传递给每个工作单元。
工作单元响应格式:
{
"status": "success" | "skipped" | "error",
"files_created": ["path/to/file.cs"],
"packages_added": ["Serilog.AspNetCore"],
"message": "Configured structured logging with Serilog"
}
为所有横切服务创建一个单一的入口点。
根据已配置的工作单元生成:
// Structure only - actual code generated via MCP ref
public static class ServiceExtensions
{
public static IServiceCollection AddCrosscuttingServices(
this IServiceCollection services,
IConfiguration configuration)
{
// Calls added based on configured workers:
// services.AddLogging(configuration); // if ln-771 ran
// services.AddCorsPolicy(configuration); // if ln-773 ran
// services.AddHealthChecks(); // if ln-774 ran
// services.AddSwaggerServices(); // if ln-775 ran
return services;
}
}
根据已配置的工作单元生成:
# Structure only - actual code generated via MCP ref
def configure_middleware(app):
# Middleware added based on configured workers:
# configure_logging(app) # if ln-771 ran
# configure_error_handlers(app) # if ln-772 ran
# configure_cors(app) # if ln-773 ran
# configure_health_routes(app) # if ln-774 ran
pass
显示所有已配置关注点的摘要。
输出格式:
横切关注点设置完成
============================
技术栈: .NET (ASP.NET Core 8.0)
已配置:
✓ 日志记录 (Serilog) - Extensions/LoggingExtensions.cs
✓ 错误处理 - Middleware/GlobalExceptionMiddleware.cs
✓ CORS - Extensions/CorsExtensions.cs
✓ 健康检查 - Extensions/HealthCheckExtensions.cs
✓ API 文档 (Swagger) - Extensions/SwaggerExtensions.cs
已跳过(已配置):
- 无
入口点: Extensions/ServiceExtensions.cs
添加到 Program.cs: builder.Services.AddCrosscuttingServices(builder.Configuration);
待安装的包:
dotnet add package Serilog.AspNetCore
dotnet add package Swashbuckle.AspNetCore
| 工作单元 | 目的 | 技术栈 |
|---|---|---|
| ln-771-日志配置器 | 结构化日志记录 | .NET (Serilog), Python (structlog) |
| ln-772-错误处理程序设置 | 全局异常中间件 | .NET, Python |
| ln-773-CORS配置器 | CORS 策略配置 | .NET, Python |
| ln-774-健康检查设置 | /health 端点 | .NET, Python |
| ln-775-API文档生成器 | Swagger/OpenAPI | .NET (Swashbuckle), Python (FastAPI 内置) |
工作单元通过上下文存储接收和返回数据:
传递给工作单元的输入:
{
"STACK": ".NET",
"FRAMEWORK": "ASP.NET Core",
"FRAMEWORK_VERSION": "8.0",
"PROJECT_ROOT": "/path/to/project",
"ENVIRONMENT": "Development"
}
来自工作单元的输出:
{
"status": "success",
"files_created": [],
"packages_added": [],
"registration_code": "services.AddLogging(configuration);"
}
此技能是幂等的:
skip: true)STACK、FRAMEWORK、PROJECT_ROOT*.csproj 或 pyproject.toml/requirements.txt + FastAPI 检测TodoWrite 格式(强制要求):
- Detect project stack (in_progress)
- Check existing configuration (pending)
- Invoke ln-771-logging-configurator (pending)
- Invoke ln-772-error-handler-setup (pending)
- Invoke ln-773-cors-configurator (pending)
- Invoke ln-774-healthcheck-setup (pending)
- Invoke ln-775-api-docs-generator (pending)
- Generate aggregation file (pending)
- Summary report (pending)
| 阶段 | 工作单元 | 上下文 |
|---|---|---|
| 3 | ln-771-日志配置器 | 共享(技能工具)— 结构化日志记录设置 |
| 3 | ln-772-错误处理程序设置 | 共享(技能工具)— 全局异常中间件 |
| 3 | ln-773-CORS配置器 | 共享(技能工具)— CORS 策略配置 |
| 3 | ln-774-健康检查设置 | 共享(技能工具)— /health 端点 |
| 3 | ln-775-API文档生成器 | 共享(技能工具)— Swagger/OpenAPI 文档 |
所有工作单元: 通过技能工具调用 — 工作单元可以看到协调器的上下文。
ServiceExtensions.cs 或 middleware/__init__.py)ln-771-logging-configurator/SKILL.md 至 ln-775-api-docs-generator/SKILL.mdreferences/logging_patterns.md — 各技术栈的结构化日志记录模式(传递给 ln-771)references/error_handling_patterns.md — 全局异常处理模式(传递给 ln-772)references/cors_configuration.md — 各技术栈的开发/生产环境 CORS 策略(传递给 ln-773)强制阅读: 加载 shared/references/meta_analysis_protocol.md
技能类型:execution-orchestrator。在所有阶段完成后运行。使用 execution-orchestrator 格式输出到聊天。
版本: 2.0.0 最后更新: 2026-01-10
每周安装量
151
仓库
GitHub 星标数
245
首次出现
2026年1月24日
安全审计
安装于
claude-code140
codex136
opencode136
gemini-cli135
cursor135
github-copilot130
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: L2 Domain Coordinator Category: 7XX Project Bootstrap Parent: ln-700-project-bootstrap
Coordinates cross-cutting concerns configuration for .NET and Python projects.
| Aspect | Details |
|---|---|
| Input | Project root directory |
| Output | Configured logging, error handling, CORS, health checks, API docs |
| Workers | ln-771 to ln-775 |
| Stacks | .NET (ASP.NET Core), Python (FastAPI) |
Determine the technology stack by scanning project files.
Detection Rules:
| File Pattern | Stack | Framework |
|---|---|---|
*.csproj | .NET | ASP.NET Core |
pyproject.toml or requirements.txt + FastAPI | Python | FastAPI |
Actions:
*.csproj filespyproject.toml or requirements.txtContext Store Initial:
{
"STACK": ".NET" | "Python",
"FRAMEWORK": "ASP.NET Core" | "FastAPI",
"PROJECT_ROOT": "/path/to/project",
"FRAMEWORK_VERSION": "8.0" | "0.109.0"
}
Scan for already configured cross-cutting concerns.
Detection Patterns:
| Concern | .NET Pattern | Python Pattern |
|---|---|---|
| Logging | Serilog in *.csproj, UseSerilog in Program.cs | structlog in requirements, logging config |
| Error Handling | GlobalExceptionMiddleware, UseExceptionHandler | @app.exception_handler, exception_handlers.py |
| CORS | AddCors, |
Actions:
skip: trueContext Store Updated:
{
"concerns": {
"logging": { "configured": false },
"errorHandling": { "configured": false },
"cors": { "configured": true, "skip": true },
"healthChecks": { "configured": false },
"apiDocs": { "configured": false }
}
}
Delegate to workers only for unconfigured concerns.
Worker Invocation Order:
| Order | Worker | Condition | Skill Call |
|---|---|---|---|
| 1 | ln-771-logging-configurator | logging.configured == false | /skill ln-771-logging-configurator |
| 2 | ln-772-error-handler-setup | errorHandling.configured == false | /skill ln-772-error-handler-setup |
| 3 | ln-773-cors-configurator | cors.configured == false |
Invocations (conditional — skip if concern already configured):
Skill(skill: "ln-771-logging-configurator", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-772-error-handler-setup", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-773-cors-configurator", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-774-healthcheck-setup", args: "{STACK} {FRAMEWORK}")
Skill(skill: "ln-775-api-docs-generator", args: "{STACK} {FRAMEWORK}")
Pass Context Store to each worker.
Worker Response Format:
{
"status": "success" | "skipped" | "error",
"files_created": ["path/to/file.cs"],
"packages_added": ["Serilog.AspNetCore"],
"message": "Configured structured logging with Serilog"
}
Create a single entry point for all cross-cutting services.
Generate based on configured workers:
// Structure only - actual code generated via MCP ref
public static class ServiceExtensions
{
public static IServiceCollection AddCrosscuttingServices(
this IServiceCollection services,
IConfiguration configuration)
{
// Calls added based on configured workers:
// services.AddLogging(configuration); // if ln-771 ran
// services.AddCorsPolicy(configuration); // if ln-773 ran
// services.AddHealthChecks(); // if ln-774 ran
// services.AddSwaggerServices(); // if ln-775 ran
return services;
}
}
Generate based on configured workers:
# Structure only - actual code generated via MCP ref
def configure_middleware(app):
# Middleware added based on configured workers:
# configure_logging(app) # if ln-771 ran
# configure_error_handlers(app) # if ln-772 ran
# configure_cors(app) # if ln-773 ran
# configure_health_routes(app) # if ln-774 ran
pass
Display summary of all configured concerns.
Output Format:
Cross-cutting Setup Complete
============================
Stack: .NET (ASP.NET Core 8.0)
Configured:
✓ Logging (Serilog) - Extensions/LoggingExtensions.cs
✓ Error Handling - Middleware/GlobalExceptionMiddleware.cs
✓ CORS - Extensions/CorsExtensions.cs
✓ Health Checks - Extensions/HealthCheckExtensions.cs
✓ API Docs (Swagger) - Extensions/SwaggerExtensions.cs
Skipped (already configured):
- None
Entry Point: Extensions/ServiceExtensions.cs
Add to Program.cs: builder.Services.AddCrosscuttingServices(builder.Configuration);
Packages to Install:
dotnet add package Serilog.AspNetCore
dotnet add package Swashbuckle.AspNetCore
| Worker | Purpose | Stacks |
|---|---|---|
| ln-771-logging-configurator | Structured logging | .NET (Serilog), Python (structlog) |
| ln-772-error-handler-setup | Global exception middleware | .NET, Python |
| ln-773-cors-configurator | CORS policy configuration | .NET, Python |
| ln-774-healthcheck-setup | /health endpoints | .NET, Python |
| ln-775-api-docs-generator | Swagger/OpenAPI | .NET (Swashbuckle), Python (FastAPI built-in) |
Workers receive and return via Context Store:
Input to Workers:
{
"STACK": ".NET",
"FRAMEWORK": "ASP.NET Core",
"FRAMEWORK_VERSION": "8.0",
"PROJECT_ROOT": "/path/to/project",
"ENVIRONMENT": "Development"
}
Output from Workers:
{
"status": "success",
"files_created": [],
"packages_added": [],
"registration_code": "services.AddLogging(configuration);"
}
This skill is idempotent:
skip: true)STACK, FRAMEWORK, PROJECT_ROOT*.csproj or pyproject.toml/requirements.txt + FastAPITodoWrite format (mandatory):
- Detect project stack (in_progress)
- Check existing configuration (pending)
- Invoke ln-771-logging-configurator (pending)
- Invoke ln-772-error-handler-setup (pending)
- Invoke ln-773-cors-configurator (pending)
- Invoke ln-774-healthcheck-setup (pending)
- Invoke ln-775-api-docs-generator (pending)
- Generate aggregation file (pending)
- Summary report (pending)
| Phase | Worker | Context |
|---|---|---|
| 3 | ln-771-logging-configurator | Shared (Skill tool) — structured logging setup |
| 3 | ln-772-error-handler-setup | Shared (Skill tool) — global exception middleware |
| 3 | ln-773-cors-configurator | Shared (Skill tool) — CORS policy configuration |
| 3 | ln-774-healthcheck-setup | Shared (Skill tool) — /health endpoints |
| 3 | ln-775-api-docs-generator | Shared (Skill tool) — Swagger/OpenAPI docs |
All workers: Invoke via Skill tool — workers see coordinator context.
ServiceExtensions.cs or middleware/__init__.py)ln-771-logging-configurator/SKILL.md through ln-775-api-docs-generator/SKILL.mdreferences/logging_patterns.md — structured logging patterns per stack (passed to ln-771)references/error_handling_patterns.md — global exception handling patterns (passed to ln-772)references/cors_configuration.md — CORS dev/prod policies per stack (passed to ln-773)MANDATORY READ: Load shared/references/meta_analysis_protocol.md
Skill type: execution-orchestrator. Run after all phases complete. Output to chat using the execution-orchestrator format.
Version: 2.0.0 Last Updated: 2026-01-10
Weekly Installs
151
Repository
GitHub Stars
245
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code140
codex136
opencode136
gemini-cli135
cursor135
github-copilot130
PPTX 文件处理全攻略:Python 脚本创建、编辑、分析 .pptx 文件内容与结构
891 周安装
UseCorsCORSMiddleware |
| Health Checks | AddHealthChecks, MapHealthChecks | /health routes |
| API Docs | AddSwaggerGen, UseSwagger | FastAPI auto-generates |
/skill ln-773-cors-configurator| 4 | ln-774-healthcheck-setup | healthChecks.configured == false | /skill ln-774-healthcheck-setup |
| 5 | ln-775-api-docs-generator | apiDocs.configured == false | /skill ln-775-api-docs-generator |