$npx skillfedfor your agent

design-patterns

This skill covers seven Rust design patterns applied to RTK's CLI filter architecture, from type-safe wrappers and configuration builders to stateful parsers and resource management. Each pattern includes practical examples showing when to use it, when to skip it, and how it fits RTK's single-threaded, zero-overhead design philosophy.

design-patterns teaches Rust patterns like Newtype, Builder, and State Machine for structuring RTK's CLI filter modules.

AI-generated summary based on this skill's SKILL.md

★ 73,568  4,597 Apache-2.0updated by rtk-ai

Decision gist · record as of 2026-07-27

design-patterns teaches Rust patterns like Newtype, Builder, and State Machine for structuring RTK's CLI filter modules. This skill covers seven Rust design patterns applied to RTK's CLI filter architecture, from type-safe wrappers and configuration builders to stateful parsers and resource management. Each pattern includes practical examples showing when to use it, when to skip it, and how it fits RTK's single-threaded, zero-overhead design philosophy.

manual: git clone https://github.com/rtk-ai/rtk → cp -r rtk/.claude/skills/design-patterns ~/.claude/skills/design-patterns
.claude/skills/design-patterns/SKILL.md · version dfa65b7d

Use it when

  • design-patterns helps you select appropriate patterns by showing real use cases within RTK's codebase.
  • design-patterns explains that Newtype provides type-safe wrappers without runtime overhead.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

rtk-ai/rtk/design-patterns · repository language: Rust

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What rust design patterns for CLI tools does design-patterns cover?

design-patterns teaches seven Rust design patterns applied to RTK's CLI filter architecture. It covers type-safe wrappers, configuration builders, stateful parsers, and resource management patterns. Each pattern includes practical examples showing when to use it, when to skip it, and how it fits RTK's single-threaded, zero-overhead design philosophy.

How do I choose the right pattern for a new module or refactoring task?

design-patterns helps you select appropriate patterns by showing real use cases within RTK's codebase. The skill explains when to apply Newtype for type safety, Builder for complex configuration, State Machine for parsing workflows, and other patterns. It also covers anti-patterns to avoid and over-engineering risks specific to RTK's architecture.

When should I use the Newtype pattern in Rust?

design-patterns explains that Newtype provides type-safe wrappers without runtime overhead. Use it when you need to distinguish semantically different values of the same underlying type—for example, wrapping a String as a FilterName to prevent accidental mixing with other strings. It's zero-cost and catches errors at compile time.

What is the builder pattern and when does design-patterns recommend it?

design-patterns covers Builder pattern for constructing complex objects with many optional fields. It's ideal for CLI filter configuration where you want fluent, readable setup code. The skill shows when Builder adds clarity versus when simpler constructors suffice, helping you avoid over-engineering in RTK's single-threaded context.

How does design-patterns explain state machine pattern for parsing?

design-patterns demonstrates state machine patterns for stateful parsing workflows common in CLI filters. It shows how to model parser states as enum variants and transitions as method calls, making parsing logic explicit and type-safe. Examples illustrate resource cleanup and error handling within state transitions.

What RAII and resource management patterns does design-patterns teach?

design-patterns covers RAII (Resource Acquisition Is Initialization) for safe resource cleanup in Rust. It explains how Drop traits and scope-based cleanup eliminate manual resource management bugs. The skill shows practical examples of file handles, buffers, and temporary allocations in RTK's filter modules, emphasizing zero-overhead resource safety.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

RTK Rust Design Patterns

Patterns that apply to RTK's filter module architecture. Focused on CLI tool patterns, not web/service patterns.

Pattern 1: Newtype (Type Safety)

Use when: wrapping primitive types to prevent misuse (command names, paths, token counts).

// Without Newtype — easy to mix up
fn track(input_tokens: usize, output_tokens: usize) { ... }
track(output_tokens, input_tokens);  // Silent bug!

// With Newtype — compile error on swap
pub struct InputTokens(pub usize);
pub struct OutputTokens(pub usize);
fn track(input: InputTokens, output: OutputTokens) { ... }
track(OutputTokens(100), InputTokens(400));  // Compile error ✅

```rust // Practical RTK example: command name validation pub struct

(truncated - see the full file via the links below)

File tree — 1 file
.claude/skills/design-patterns/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Learn Rust design patterns for CLI filter module architecture”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

parser-development
by biomejs · biomejs/biome

This skill teaches you how to add parsing support for new languages to Biome by authoring grammars in ungrammar format, implementing lexers and token sources, and writing parse rules with robust error recovery. It covers list parsing patterns, conditional syntax handling, and testing workflows for the Biome codebase.

Apache-2.0for claude-codeupdated Jul 2026
★ 25,418repo stars
Performance
by rtk-ai · rtk-ai/rtk

This skill provides systematic performance analysis for the RTK CLI tool, measuring startup time against a <10ms target, memory usage under 5MB, and token savings between 60–90%. It includes baseline capture, regression detection with flamegraph profiling, and common optimization techniques like LazyLock initialization and zero-copy string processing.

Apache-2.0for claude-codeupdated Jul 2026
★ 73,568repo stars
phx-mix-compression
by oliver-kriska · oliver-kriska/claude-elixir-phoenix

Install rtk filters to compress verbose mix command output before it consumes context. The skill preserves critical signals like compile errors and test failures while short-circuiting successful runs to single lines, delivering 5-15% token savings on mix-heavy workflows.

MITfor amp, codex, opencodeupdated Jul 2026
★ 507repo stars
rtk-tdd
by rtk-ai · rtk-ai/rtk

rtk-tdd enforces the red-green-refactor cycle for Rust development, automatically guiding you through failing tests, minimal implementations, and refactoring phases. It provides Rust-idiomatic testing patterns using anyhow/thiserror, cfg(test) modules, and Arrange-Act-Assert workflows, with pre-commit gates ensuring code quality.

Apache-2.0for claude-codeupdated Jul 2026
★ 73,568repo stars
tdd-rust
by rtk-ai · rtk-ai/rtk

tdd-rust guides you through test-driven filter implementation for RTK using the Red-Green-Refactor cycle. Start with real command output fixtures, write failing tests that verify both output format and ≥60% token reduction, then implement the minimum code to pass. Lock output format with snapshot tests and integrate into your CLI.

Apache-2.0for claude-codeupdated Jul 2026
★ 73,568repo stars
code-quality
by tursodatabase · tursodatabase/turso

code-quality establishes standards for writing reliable database code in Rust, prioritizing data integrity over silent failures. It covers error handling discipline, exhaustive pattern matching, and invariant checking to prevent corruption. The guide emphasizes crashing on invalid state rather than continuing in undefined conditions, and avoiding premature abstractions or workarounds.

MITfor claude-codeupdated Jul 2026
★ 23,479repo stars

More skills Ship (Apache-2.0) · diagnostics-development (Apache-2.0) · type-inference (Apache-2.0)

Tags
type-safetymodule-architectureparser-designresource-cleanupdispatch-strategyconfiguration-buildingcli-patternscode-refactoring