Mug
A small Java 8 library (string manipulation, BiStream, Structured Concurrency, SQL Templates)
Install / Use
/learn @google/MugREADME
/isclaimer: This is not an official Google product.
Mug (
)
A small Java 8+ string processing and streams library (javadoc), widely used in Google's internal Java codebase, with 0 deps (Proto, BigQuery, Guava addons are in separate artifacts).
Highlights
- ✅
Substring– composable substring extraction & manipulation
→Substring.between("(", ")").from("call(foo)") → "foo" - ✅
StringFormat– compile-time-safe bidirectional parsing/formatting
→new StringFormat("/home/{user}/{date}").parse(filePath, (user, date) -> ...) - ✅
Parser– easier and faster than regex
→zeroOrMore(noneOf("\\'")).immediatelyBetween("'", "'").parse(input); - ✅
BiStream– streamsMapand pair-wise collections
→BiStream.zip(keys, values).toMap() - ✅
SafeSql– library-enforced safe, composable SQL template
→SafeSql.of("select id, `{col}` from Users where id = {id}", col, id)
DateTimeFormats– parse datetimes by example
→DateTimeFormatter format = formatOf("2024-03-14 10:00:00.123 America/New_York")Iteration- implement lazy stream with recursive codeBinarySearch- solve LeetCode binary search problems
→BinarySearch.inSortedArrayWithTolerance(doubleArray, 0.0001).find(target)StructuredConcurrency- simple structured concurrency on virtual threads
→concurrently(() -> fetchArm(), () -> fetchLeg(), (arm, leg) -> makeRobot(arm, leg))MoreStreams
→whileNotNull(queue::poll).filter(...).map(...)Optionals
→return optionally(obj.hasFoo(), obj::getFoo);
Maven
Add the following to pom.xml:
<dependency>
<groupId>com.google.mug</groupId>
<artifactId>mug</artifactId>
<version>9.9.8</version>
</dependency>
Add mug-errorprone to your annotationProcessorPaths:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.23.0</version>
</path>
<path>
<groupId>com.google.mug</groupId>
<artifactId>mug-errorprone</artifactId>
<version>9.9.8</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
SafeSql (javadoc):
<dependency>
<groupId>com.google.mug</groupId>
<artifactId>mug-safesql</artifactId>
<version>9.9.8</version>
</dependency>
Dot Parse Combinators (javadoc):
<dependency>
<groupId>com.google.mug</groupId>
<artifactId>dot-parse</artifactId>
<version>9.9.8</version>
</dependency>
Protobuf utils (javadoc):
<dependency>
<groupId>com.google.mug</groupId>
<artifactId>mug-protobuf</artifactId>
<version>9.9.8</version>
</dependency>
Gradle
Add to build.gradle:
implementation 'com.google.mug:mug:9.9.8'
implementation 'com.google.mug:mug-safesql:9.9.8'
implementation 'com.google.mug:dot-parse:9.9.8'
implementation 'com.google.mug:mug-guava:9.9.8'
implementation 'com.google.mug:mug-protobuf:9.9.8'
</details>Related Skills
oracle
339.5kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
prose
339.5kOpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.
Command Development
83.9kThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
Plugin Structure
83.9kThis skill should be used when the user asks to "create a plugin", "scaffold a plugin", "understand plugin structure", "organize plugin components", "set up plugin.json", "use ${CLAUDE_PLUGIN_ROOT}", "add commands/agents/skills/hooks", "configure auto-discovery", or needs guidance on plugin directory layout, manifest configuration, component organization, file naming conventions, or Claude Code plugin architecture best practices.
