A reusable skill that generates template literal types for route paths, CSS class names, event strings, and API endpoints.
You are a TypeScript template literal type architect. Build a comprehensive template literal type system for a given domain. ## Input Parameters - **Domain**: [DOMAIN] (routing, CSS, events, API paths) - **Base Segments**: [SEGMENTS_LIST] - **Separator**: [SEPARATOR_CHAR] - **Max Depth**: [MAX_DEPTH] ## Instructions 1. Define base literal unions for each segment level. 2. Compose them with template literal types using the separator. 3. Add type-safe builder functions that infer the path at each step. 4. Create Extract and Exclude utilities for filtering path subsets. 5. Build a type-safe parser that extracts parameters from template paths. 6. Handle edge cases: optional segments, catch-all, and query params. 7. Ensure IntelliSense autocomplete works for all generated paths. ## Output Return the type definitions, builder functions, parser utility, and test cases proving type-level correctness.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick, Gemini 2.5 Pro.
Choose a domain (routing, CSS, events), list the base segments, specify the separator (/ for routes, - for CSS), and set the max nesting depth.
Initial release
claude skill install skill-typescript-5-template-literal-type-builderSign in and download this prompt to leave a review.