Parsing and Mutating Strings

Parse and mutate TypeScript strings with narrow type utilities.

18|Updated Apr 5, 2021
One-click install
npx skills add https://github.com/inocan-group/inferred-types --skill parsing-and-mutating-strings
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Parsing and Mutating Strings
Source: https://github.com/inocan-group/inferred-types/tree/main/.claude/skills/parsing
Command: npx skills add https://github.com/inocan-group/inferred-types --skill parsing-and-mutating-strings

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires inferred-types.

What problem does it solve?

This Skill provides a powerful set of utilities to parse and mutate string values and types with high precision, ensuring that the resulting TypeScript types are as narrow and accurate as possible. It simplifies complex string manipulations at both runtime and design-time, reducing manual effort and potential errors.

Core Features & Use Cases

  • Simple String Operations: Offers utilities for trimming whitespace, stripping content before/after delimiters, retaining specific sections, and ensuring leading/trailing substrings.
  • Type-Safe String Transformations: Leverages inferred-types to provide compile-time guarantees for string mutations, ensuring type narrowing and correctness.
  • Use Case: Automatically clean user input by stripping unwanted characters, ensuring specific prefixes/suffixes, or extracting data between known delimiters, all while maintaining strong type inference.

Quick Start

Use the parsing skill to explain how to use the StripLeading<T, U> type utility to remove a specific prefix from a string literal type.

Frequently Asked Questions about Parsing and Mutating Strings

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove a prefix or suffix from a string while preserving TypeScript types?

String parsing utilities like StripLeading and StripTrailing remove prefixes and suffixes while maintaining narrow type inference. They transform both the runtime value and its TypeScript type, ensuring the result type reflects the actual content after removal.

Can I extract content between delimiters and keep strong type safety?

Yes. Functions like RetainBetween and RetainAfter extract substring sections based on delimiter positions while preserving narrow typing. Type utilities guarantee the extracted portion's type matches its constrained content, reducing runtime errors.

What's the best way to clean user input by stripping unwanted characters?

Use string mutation utilities to strip content before or after known delimiters, trim whitespace, or ensure required prefixes and suffixes. Runtime functions and type utilities work together so cleaned input maintains correct TypeScript types automatically.

How do type-safe string transformations differ from standard string methods?

Type-safe transformations narrow TypeScript types to match actual string content after mutation. Standard methods return generic strings; these utilities guarantee the type system reflects the transformation, catching type mismatches at compile time rather than runtime.

Can I handle both simple trimming and structured parsing in one approach?

Yes. The Skill provides simple utilities for whitespace trimming and delimiter-based stripping, plus structured parsing where different sections follow different extraction rules. All maintain type precision throughout the transformation pipeline.

Do I need external dependencies to use these string parsing utilities?

The Skill depends on inferred-types to enable compile-time type narrowing. This dependency provides the type inference engine that makes string transformations preserve and refine TypeScript types during parsing and mutation operations.