rust-patterns

A Rust code-analysis workflow that detects design patterns and anti-patterns, suggests improvements, and evaluates how well patterns are implemented. Rust is a programming language that emphasizes memory safety and performance.

In plain words
What is it for?
Use it to scan Rust files for existing patterns, find risky or awkward practices, get pattern suggestions for code smells, and evaluate a selected pattern.
Why use it?
It gives a structured way to review the design of a Rust codebase instead of relying only on general code review. The separate modes help distinguish finding problems from choosing or judging solutions.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/florianbruniaux/ccboard/rust-patterns
Any agent
npx skills add FlorianBruniaux/ccboard --skill rust-patterns
Clone the repo
git clone --depth 1 https://github.com/FlorianBruniaux/ccboard

Made for: Claude Code, Codex.

Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,222 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00051 $0.03222
Opus 5 $0.00026 $0.01611
Sonnet 5 $0.00010 $0.00644
Haiku 4.5 $0.00005 $0.00322

Measured 3d ago against content hash 5951b351eed8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rust-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/rust-patterns/SKILL.md · 508 lines

How it starts

The opening of the file, as written. The whole thing — 508 lines — stays where its author put it; the contents beside it link to each section on GitHub.

rust-patterns Skill

Comprehensive Rust pattern analysis tool for detecting, suggesting, and evaluating design patterns in Rust codebases.

Overview

This skill provides three complementary modes for Rust pattern analysis:

  1. Detection Mode: Scan codebase to identify existing patterns and anti-patterns
  2. Suggestion Mode: Recommend patterns to address code smells and improve design
  3. Evaluation Mode: Score pattern implementation quality against best practices

Complementary to: @RUST_PATTERNS.md (always-active rules) - this skill provides optional deep analysis.

Invocation

# Detection - scan codebase for patterns
/rust-patterns detect [path]

# Suggestion - recommend patterns for code smells
/rust-patterns suggest [path]

# Evaluation - score pattern implementation quality
/rust-patterns evaluate [path] [--pattern=<name>]

# Help
/rust-patterns --help

Mode 1: Detection

Purpose: Identify patterns and anti-patterns currently in the codebase.

Workflow:

1. Scan → Glob for *.rs files in target path
2. Search → Grep for pattern signatures (ownership, newtype, builder, etc.)
3. Detect Anti-patterns → Grep for .clone(), .unwrap(), Arc<Mutex>, blocking ops
4. Classify → Categorize as idiom/pattern/anti-pattern
5. Score Confidence → 0.0-1.0 based on signature strength
6. Report → JSON output with file locations and recommendations

Example:

/rust-patterns detect src/

Output Format:

{
  "scan_summary": {
    "files_scanned": 42,
    "patterns_found": 15,
    "anti_patterns_found": 8,
    "confidence_avg": 0.87
  },
  "patterns": {
    "newtype": [
      {
        "file": "src/models/stats.rs",
        "lines": "12-15",
        "confidence": 0.92,
        "code": "struct SessionId(String);",
        "note": "✅ Good: Zero-cost type safety"
      }
    ],
    "builder": [
      {
        "file": "src/store.rs",
        "lines": "45-78",
        "confidence": 0.88,
        "code": "impl DataStoreBuilder { ... }",
        "note": "✅ Good: Type-state builder pattern"
      }
    ],
    "raii": [
      {
        "file": "src/guard.rs",
        "lines": "23-35",
        "confidence": 0.95,
        "code": "impl Drop for FileGuard { ... }",
        "note": "✅ Good: Automatic cleanup"
      }
    ]
  },
  "anti_patterns": {
    "excessive_clone": [
      {
        "file": "src/app.rs",
        "lines": "45",
        "severity": "high",
        "code": ".clone().process().clone()",
        "suggestion": "Use &DataStore instead of cloning",
        "impact": "Performance: Multiple heap allocations"
      }
    ],
    "unwrap_in_production": [
      {
        "file": "src/parsers/session.rs",
        "lines": "89",
        "severity": "critical",
        "code": "serde_json::from_str(&content).unwrap()",
        "suggestion": "Use ? operator with .context()",
        "impact": "Safety: Will panic on malformed input"
      }
    ],
    "blocking_in_async": [
      {
        "file": "src/api/handlers.rs",
        "lines": "123",
        "severity": "high",
        "code": "std::fs::read(path)",
        "suggestion": "Use tokio::fs::read() or spawn_blocking",
        "impact": "Performance: Blocks async executor"
      }
    ]
  },
  "recommendations": [
    "Fix 3 critical anti-patterns before merge",
    "Consider extracting builder pattern in src/config.rs",
    "Review clone usage in src/app.rs (8 occurrences)"
  ]
}

Read the full file on GitHub · 508 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 508 lines · 51 tokens per session scan A 5951b351eed8

Subscribe to this mod's changes

rust-patterns is a skill published in the GitHub repository FlorianBruniaux/ccboard (94 stars, last pushed 23d ago), licensed MIT. It adds 51 tokens to every session and 3,222 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories