Get the FREE Ultimate OpenClaw Setup Guide →

vibe-pattern-library

npx machina-cli add skill ash1794/vibe-engineering/pattern-library --openclaw
Files (1)
SKILL.md
1.9 KB

vibe-pattern-library

Three similar lines of code is fine. But when you implement the same pattern for the third time across different files, codify it.

When to Use This Skill

  • You notice implementing the same pattern again (3rd+ time)
  • You find yourself copying code structure from another file
  • After a code review suggests "we always do X this way"
  • When onboarding to a project and want to learn established patterns

When NOT to Use This Skill

  • First or second use of a pattern (too early to codify)
  • Patterns that are specific to one module (not reusable)
  • Language-standard patterns already in the style guide

Steps

  1. Detect — Notice when you're implementing something you've seen before:

    • Table-driven tests
    • Error wrapping with context
    • Retry with backoff
    • Repository pattern
    • Builder pattern
    • Event handler registration
    • Middleware chains
  2. Record the pattern:

    ### [Pattern Name]
    **Category**: [Testing | Error Handling | Concurrency | Data | API | etc.]
    **When to use**: [Specific situation]
    **Template**:
    ```[language]
    [The canonical implementation]
    

    Variations:

    • [Variation 1]: [when to use] Anti-patterns:
    • Don't [common mistake] Examples in codebase: [file:line references]
  3. Store — Save to:

    • docs/patterns.md or docs/patterns/[category].md
    • Claude memory for cross-session access
  4. Reference — When implementing the pattern again, suggest the recorded version instead of re-inventing

Output Format

Pattern: [Name]

Category: [category] Occurrences found: X files

// Canonical implementation
[code]

Saved to: [location]

Source

git clone https://github.com/ash1794/vibe-engineering/blob/master/skills/pattern-library/SKILL.mdView on GitHub

Overview

Vibe-pattern-library helps teams identify when the same pattern appears across multiple files and codify it into a reusable pattern. By capturing canonical templates and variations, it reduces duplication, accelerates onboarding, and enforces consistent implementation.

How This Skill Works

Whenever the same pattern appears a third time, you record it as a pattern entry with a canonical template. The template and variations are saved under docs/patterns (or category-based files) and cached for cross-session reference, so future implementations reuse the recorded version.

When to Use It

  • You notice implementing the same pattern again (3rd+ time).
  • You copy code structure from another file and want a centralized reference.
  • After a code review suggests 'we always do X this way' and you want to formalize it.
  • Onboarding to a project and want to learn established patterns.
  • The pattern is reusable across modules, not tied to a single module.

Quick Start

  1. Step 1: Detect the pattern in a third occurrence across files.
  2. Step 2: Record a canonical template and any variations in docs/patterns.
  3. Step 3: Store the pattern and reference it in future work; guide teammates to reuse it.

Best Practices

  • Detect patterns early by tracking repeated implementations across files.
  • Record a canonical template plus clear variations and anti-patterns.
  • Store the pattern in docs/patterns.md or docs/patterns/[category].md for easy discovery.
  • Reference the recorded version on future implementations to avoid reinvention.
  • Involve code reviewers and maintain memory across sessions to keep patterns up to date.

Example Use Cases

  • Table-driven tests patterns captured for reuse across test suites.
  • Error wrapping with context standardized into a reusable utility.
  • Retry with backoff implemented as a canonical pattern across services.
  • Repository pattern consistently used for data access layers.
  • Builder pattern usage standardized in object construction across modules.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers