Parsing and Mutating Strings
About
This skill provides utilities for parsing and manipulating strings at both runtime and design-time, with two main approaches for different needs. Use the "Simple" utilities for basic substring operations, stripping content, or ensuring prefixes/suffixes. Use "Structured" utilities when you need language-aware parsing with different rules for different string segments, while maintaining narrow result types.
Quick Install
Claude Code
Recommended/plugin add https://github.com/inocan-group/inferred-typesgit clone https://github.com/inocan-group/inferred-types.git ~/.claude/skills/Parsing and Mutating StringsCopy and paste this command in Claude Code to install this skill
Documentation
Parsing and Mutating Strings
Instructions
-
Identify which of the two best describe your needs:
Simple- finding a sub-string inside a string variable
- stripping or retaining content UNTIL a certain delimiter is found
- ensuring that the string starts or ends with a certain sub-string
Structured- you need to parse a string for language features
- different parts of the string will have different parsing rules based on the characters which preceded it.
-
If your need fits the
Simpledescription then ...You will likely want to use one of the following type or runtime utilities found in this repo. Every utility's source will have a description above the symbol and many also may include a simple example.
Type Utilities
you can import all of these utilities from
inferred-types/types- Trim whitespace
- Strip a subsection of content
StripAfter<TStr,TBreak>[ source, examples ] - stripTStripafter first instance ofTBreakStripAfterLast<TStr,TBreak>[ source, examples ] - stripTStripafter last instance ofTBreakStripBefore<TStr,TBreak>[ source, examples ] - stripTStrbefore the substringTBreakis found; retain the restStripFirst<T,U>[ source, examples ]StripLeading<T,U>[ source, examples ]StripSurround<T,U>[ source, examples ]StripTrailing<T,U>[ source, examples ]StripUntil<T,U>[ source, examples ]
- Retain a subsection of content (the inverse of "strip")
- String Interpolation (aka, injecting content into sections of a corpus of text)
- TODO
-
If your need fits the
Structuredneed then ...
Notes:
- there is often (but not always) a 1:1 relationship between a type utility and a runtime function.
- The runtime function (often but not always) will leverage the corresponding type utility to produce narrow types.
- many example links are to test files; these test files use both runtime and type tests. For more about type tests you can read type testing document.
GitHub Repository
Related Skills
content-collections
MetaThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
creating-opencode-plugins
MetaThis skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.
polymarket
MetaThis skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.
langchain
MetaLangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.
