scalar
Scalar API documentation UI for .NET 10 applications. Covers setup, themes, authentication prefill, multiple documents, layout options, and security. A modern replacement for Swagger UI. Load this skill when setting up API documentation UI, or when the user mentions "Scalar", "MapScalarApiReference"
By codewithmukesh · 1,183 installs
npx skills add codewithmukesh/dotnet-claude-kit --skill scalar
Source repository · Upstream listing
Scalar
Core Principles
1. Scalar replaces Swagger UI — Scalar is the recommended API documentation UI for .NET 10. Faster rendering, built in dark mode, code generation for dozens of languages, and full OpenAPI 3.1 support.
2. Development only by default — Wrap MapScalarApiReference() in an IsDevelopment() check. API documentation exposes internal structure. If needed in production, add authorization.
3. Disable the proxy for sensitive APIs — Scalar's "Try It" feature routes through proxy.scalar.com by default. Disable it with .WithProxy(null) to keep auth headers local.
4. Security schemes come from OpenAPI — Scalar reads security schemes from the OpenAPI document. Configure them via document transformers, not in Scalar directly.
Patterns
Basic Setup
Customized Configuration
Authentication Prefill (Development Only)
Pre fill credentials so developers don't have to paste tokens manually. The OpenAPI document must already include the security scheme via a document transformer.
Other auth types:
Available Themes
Multiple API Documents
Or configure documents explicitly:
Custom Route Prefix
Production with Authorization
Force Dark Mode
Classic Layout (Swagger like)
Anti patterns
Don't Expose Scalar in Production Without Auth
Don't Pre fill Real Credentials
Don't Forget the Security Scheme Transformer
Don't Leave the Proxy Enabled for Sensitive APIs
Don't Use Swagger UI for New .NET 10 Projects
Decision Guide
Scenario Recommendation
API documentation UI MapScalarApiReference() with MapOpenApi()
Development environment Default setup with IsDevelopment() guard
Production API docs Add .RequireAuthorization() to both endpoints
Auth testing in dev AddHttpAuthentication() with test tokens
Dark theme preference .ForceDarkMode() or .WithTheme(ScalarTheme.Moon)
Multiple API versions Multiple AddOpenApi() calls — Scalar detects automatically
Sensitive APIs .WithProxy(null) to disable external proxy
Swagger like layout .WithClassicLayout()
Custom route app.MapScalarApiReference("/api docs")