Get the FREE Ultimate OpenClaw Setup Guide →

ln-770-crosscutting-setup

npx machina-cli add skill levnikolaevich/claude-code-skills/ln-770-crosscutting-setup --openclaw
Files (1)
SKILL.md
7.8 KB

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.

ln-770-crosscutting-setup

Type: L2 Domain Coordinator Category: 7XX Project Bootstrap Parent: ln-700-project-bootstrap

Coordinates cross-cutting concerns configuration for .NET and Python projects.


Overview

AspectDetails
InputProject root directory
OutputConfigured logging, error handling, CORS, health checks, API docs
Workersln-771 to ln-775
Stacks.NET (ASP.NET Core), Python (FastAPI)

Phase 1: Detect Project Stack

Determine the technology stack by scanning project files.

Detection Rules:

File PatternStackFramework
*.csproj.NETASP.NET Core
pyproject.toml or requirements.txt + FastAPIPythonFastAPI

Actions:

  1. Glob for *.csproj files
  2. If not found, Glob for pyproject.toml or requirements.txt
  3. If Python, check for FastAPI in dependencies
  4. Store detected stack in Context Store

Context Store Initial:

{
  "STACK": ".NET" | "Python",
  "FRAMEWORK": "ASP.NET Core" | "FastAPI",
  "PROJECT_ROOT": "/path/to/project",
  "FRAMEWORK_VERSION": "8.0" | "0.109.0"
}

Phase 2: Check Existing Configuration

Scan for already configured cross-cutting concerns.

Detection Patterns:

Concern.NET PatternPython Pattern
LoggingSerilog in *.csproj, UseSerilog in Program.csstructlog in requirements, logging config
Error HandlingGlobalExceptionMiddleware, UseExceptionHandler@app.exception_handler, exception_handlers.py
CORSAddCors, UseCorsCORSMiddleware
Health ChecksAddHealthChecks, MapHealthChecks/health routes
API DocsAddSwaggerGen, UseSwaggerFastAPI auto-generates

Actions:

  1. Grep for each pattern
  2. Mark configured concerns as skip: true
  3. Update Context Store with findings

Context Store Updated:

{
  "concerns": {
    "logging": { "configured": false },
    "errorHandling": { "configured": false },
    "cors": { "configured": true, "skip": true },
    "healthChecks": { "configured": false },
    "apiDocs": { "configured": false }
  }
}

Phase 3: Invoke Workers (Conditional)

Delegate to workers only for unconfigured concerns.

Worker Invocation Order:

OrderWorkerConditionSkill Call
1ln-771-logging-configuratorlogging.configured == false/skill ln-771-logging-configurator
2ln-772-error-handler-setuperrorHandling.configured == false/skill ln-772-error-handler-setup
3ln-773-cors-configuratorcors.configured == false/skill ln-773-cors-configurator
4ln-774-healthcheck-setuphealthChecks.configured == false/skill ln-774-healthcheck-setup
5ln-775-api-docs-generatorapiDocs.configured == false/skill ln-775-api-docs-generator

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"
}

Phase 4: Generate Aggregation File

Create a single entry point for all cross-cutting services.

.NET: Extensions/ServiceExtensions.cs

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;
    }
}

Python: middleware/init.py

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

Phase 5: Summary Report

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

Workers

WorkerPurposeStacks
ln-771-logging-configuratorStructured logging.NET (Serilog), Python (structlog)
ln-772-error-handler-setupGlobal exception middleware.NET, Python
ln-773-cors-configuratorCORS policy configuration.NET, Python
ln-774-healthcheck-setup/health endpoints.NET, Python
ln-775-api-docs-generatorSwagger/OpenAPI.NET (Swashbuckle), Python (FastAPI built-in)

Context Store Interface

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);"
}

Idempotency

This skill is idempotent:

  • Phase 2 detects existing configuration
  • Workers skip if already configured
  • Aggregation file preserves existing entries

Critical Rules

  • Skip already configured concerns — Phase 2 detection must gate worker invocation (set skip: true)
  • Pass Context Store to every worker — workers depend on STACK, FRAMEWORK, PROJECT_ROOT
  • Generate aggregation file only for workers that ran — do not add registration calls for skipped concerns
  • Support only .NET and Python — detect via *.csproj or pyproject.toml/requirements.txt + FastAPI
  • Idempotent execution — re-running must not duplicate configs or break existing setup

Definition of Done

  • Project stack detected and stored in Context Store
  • Existing configurations detected (Phase 2 complete)
  • All unconfigured concerns delegated to workers (ln-771 through ln-775)
  • Aggregation entry point generated (ServiceExtensions.cs or middleware/__init__.py)
  • Summary report displayed with configured/skipped concerns and package install commands

Reference Files

  • Worker skills: ln-771-logging-configurator/SKILL.md through ln-775-api-docs-generator/SKILL.md

Version: 2.0.0 Last Updated: 2026-01-10

Source

git clone https://github.com/levnikolaevich/claude-code-skills/blob/master/ln-770-crosscutting-setup/SKILL.mdView on GitHub

Overview

ln-770-crosscutting-setup coordinates logging, error handling, CORS, health checks, and API docs across .NET (ASP.NET Core) and Python (FastAPI). It detects the project stack, audits existing configuration, delegates to specialized workers (ln-771 to ln-775) for unconfigured concerns, and generates a unified aggregation entry point for cross-cutting services.

How This Skill Works

The process runs in four phases: detect the project stack by scanning for csproj or pyproject/requirements with FastAPI, assess existing cross-cutting configurations, invoke unconfigured workers in a defined order, and generate a single aggregation file (e.g., ServiceExtensions) to expose all cross-cutting services.

When to Use It

  • Starting a new .NET or Python project and needing consistent cross-cutting setup (logging, error handling, CORS, health checks, docs).
  • Auditing an existing repo to identify which cross-cutting concerns are configured and which need work.
  • Coordinating bootstrap steps across multi-project solutions following the ln-700 series pattern.
  • Automating generation of a central aggregation entry (e.g., ServiceExtensions) for cross-cutting services.
  • When you want to skip already-configured concerns (as indicated by Phase 2) to avoid redundant changes.

Quick Start

  1. Step 1: Run ln-770-crosscutting-setup at the repository root to detect stack and start Phase 1.
  2. Step 2: Review Phase 2 findings in the Context Store to see which concerns are configured or skipped.
  3. Step 3: If unconfigured concerns exist, allow Phase 3 to invoke ln-771..ln-775 workers and generate the aggregation file.

Best Practices

  • Use Phase 1 stack detection to prevent misconfiguration between .NET and Python projects.
  • Let Phase 2 mark already configured concerns as skip: true to minimize churn.
  • Follow the explicit worker order (logging, error handling, cors, health checks, api docs) for predictable updates.
  • Generate a single aggregation/entry point to encapsulate all cross-cutting services.
  • Validate changes with a Context Store and maintain idempotent file generation.

Example Use Cases

  • Auto-configure Serilog logging and global exception handling in a mixed .NET + FastAPI repo.
  • Enable CORS and health check endpoints across services without manual edits to each project.
  • Skip CORS if already managed by an API gateway, letting Phase 2 mark it as configured.
  • Produce a .NET ServiceExtensions.AddCrosscuttingServices entry that wires logging, errors, and docs.
  • Leverage FastAPI's automatic API docs alongside .NET Swagger generation for consistent docs.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers