skills-catalog/ln-773-cors-configurator/SKILL.md
Configures CORS policy for development and production environments. Use when setting up cross-origin access for APIs.
npx skillsauth add levnikolaevich/claude-code-skills ln-773-cors-configuratorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Type: L3 Worker Category: 7XX Project Bootstrap
Configures Cross-Origin Resource Sharing (CORS) policy with security-first approach.
| Aspect | Details | |--------|---------| | Input | Context Store from ln-770 | | Output | CORS configuration with environment-specific policies | | Stacks | .NET (ASP.NET Core CORS), Python (FastAPI CORSMiddleware) |
Accept Context Store from coordinator.
Required Context:
STACK: .NET or PythonPROJECT_ROOT: Project directory pathENVIRONMENT: Development or ProductionIdempotency Check:
AddCors or UseCorsCORSMiddleware{ "status": "skipped" }Determine frontend configuration.
Detection Steps:
/frontend, /client, /web).env or appsettings.json for CORS_ORIGINSDetected Frontend Origins:
| Framework | Default Port | Origin | |-----------|--------------|--------| | React (CRA) | 3000 | http://localhost:3000 | | Vite | 5173 | http://localhost:5173 | | Angular | 4200 | http://localhost:4200 | | Next.js | 3000 | http://localhost:3000 |
| Environment | Strategy | |-------------|----------| | Development | Allow localhost origins (configurable) | | Production | Explicit origins from environment variables only |
Security Warning: Never use * (wildcard) with credentials.
| Method | Default | Notes | |--------|---------|-------| | GET | ✓ Yes | Read operations | | POST | ✓ Yes | Create operations | | PUT | ✓ Yes | Update operations | | DELETE | ✓ Yes | Delete operations | | PATCH | Optional | Partial updates | | OPTIONS | ✓ Yes | Preflight requests (automatic) |
| Scenario | AllowCredentials | Notes | |----------|------------------|-------| | Cookie-based auth | ✓ Yes | Required for cookies | | JWT in header | ✗ No | Not needed | | OAuth2 | Depends | Check documentation |
Warning: AllowCredentials = true prohibits * origin.
| Environment | MaxAge | Rationale | |-------------|--------|-----------| | Development | 0 | Immediate config changes | | Production | 86400 (24h) | Reduce preflight requests |
| File | Purpose |
|------|---------|
| Extensions/CorsExtensions.cs | CORS service registration |
| appsettings.json (update) | Origins configuration |
| appsettings.Development.json (update) | Dev origins |
Generation Process:
Registration Code:
builder.Services.AddCorsPolicy(builder.Configuration);
// ...
app.UseCors(builder.Environment.IsDevelopment() ? "Development" : "Production");
| File | Purpose |
|------|---------|
| middleware/cors_config.py | CORS middleware configuration |
| .env (update) | CORS_ORIGINS variable |
Generation Process:
Registration Code:
from middleware.cors_config import configure_cors
configure_cors(app)
Validation Steps:
Syntax check:
dotnet build --no-restorepython -m py_compile middleware/cors_config.pyCORS test:
# Test preflight request
curl -X OPTIONS http://localhost:5000/api/test \
-H "Origin: http://localhost:3000" \
-H "Access-Control-Request-Method: POST" \
-v
Verify headers:
Access-Control-Allow-Origin: Should match request originAccess-Control-Allow-Methods: Should list allowed methodsAccess-Control-Allow-Credentials: true (if enabled)Access-Control-Max-Age: Cache durationBefore completing, verify:
* origin in productionAllowAnyMethod in prod){
"status": "success",
"files_created": [
"Extensions/CorsExtensions.cs"
],
"packages_added": [],
"registration_code": "builder.Services.AddCorsPolicy(configuration);",
"message": "Configured CORS with Development and Production policies"
}
* origin with credentials — security violation per CORS specAddCors/UseCors or CORSMiddleware exists, return status: "skipped"dotnet build or py_compile)Version: 2.0.0 Last Updated: 2026-01-10
testing
Drafts and publishes fact-checked GitHub Discussions announcements. Use for releases, updates, or project news; not for release creation or issue responses.
testing
Prepares and publishes a tagged GitHub release from repository evidence. Use for an explicit release request; not for ordinary commits, packages, or community news.
testing
Validates, commits, pushes, and remotely verifies approved repository changes. Use when publication is requested; not for releases, package publishing, or announcements.
development
Reviews standalone skills and their configured distribution surfaces before publication. Use for skill release readiness; not for product code or implementation-plan review.