Claude Pattern Advisor

    by abderrahman Njeh

    1

    Architecture advisor that selects idiomatic design patterns only when they earn their place in your code.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude Pattern Advisor

    Example session with this skill installed

    I need to add a 'Student' discount type to our checkout logic. Currently, it's a switch statement handling 'Standard' and 'Member' types. Should I refactor this?

    • Read your context and instructions
    • Compiled the claude pattern advisor

    I have analyzed the forces in your checkout logic. Since you now have three distinct variants (Standard, Member, and Student), this meets the "rule of three" threshold for a Strategy pattern.

    Design Pattern Recommendation

    ComponentDescription
    Chosen PatternStrategy (implemented as a record of functions)
    Forces ResolvedHigh cyclomatic complexity in calculateTotal; violating Open-Closed principle when adding types.
    House StyleMatches the PricingRule naming convention found in src/services/billing/.
    ThresholdRefactor now; any future discount types (e.g., 'Seasonal') will require zero changes to the core engine.
    // src/services/checkout/discountStrategies.ts
    
    export type DiscountContext = {
      subtotal: number;
      userId: string;
    };
    
    export const DiscountStrategies: Record<string, (ctx: DiscountContext) => number> = {
      Standard: ({ subtotal }) => subtotal,
      Member: ({ subtotal }) => subtotal * 0.9,
      Student: ({ subtotal }) => subtotal * 0.85,
    };
    
    // Usage in CheckoutEngine
    const strategy = DiscountStrategies[userType] ?? DiscountStrategies.Standard;
    const total = strategy({ subtotal, userId });
    

    Pattern: Strategy (Map of functions) — Moved from a 3-case switch to a registry. Adding the 4th type is now a local addition to the map.
    Considered: Factory Class — Rejected as over-engineered for simple math transformations in TypeScript.

    Next steps

    1. Create discountStrategies.ts and migrate existing 'Standard' and 'Member' logic.
    2. Update the CheckoutEngine to inject the strategy based on the user profile.
    3. Add a unit test specifically for the Student strategy function.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Stop guessing whether to use a Factory, Strategy, or simple conditional. This skill forces a disciplined evaluation of code forces before you write a single line, ensuring every architectural choice earns its place. It prevents over-engineering by defaulting to the simplest structure that works while identifying exactly when a pattern becomes necessary.

    What it does

    • Analyze forces by identifying what varies, what must stay stable, and where the current logic is failing.
    • Select idiomatic patterns based on language-specific constraints across TypeScript, Python, Go, Rust, and more.
    • Enforce house style by surveying existing files to ensure new structures match your project's established conventions.
    • Evaluate thresholds to determine if a pattern is premature, providing clear markers for when to refactor in the future.
    • Prevent anti-patterns by checking against common pitfalls like "God Objects" or unnecessary abstractions.

    How it works

    1. Classify the task as a new feature, bug fix, or refactor to set the appropriate architectural stance.
    2. Identify smells in the current code such as tangled conditionals or duplicated switch statements.
    3. Compare candidates using the "earns its place" test to ensure the pattern reduces complexity.
    4. Implement minimal forms focusing on composition and domain-first naming rather than boilerplate.

    Frameworks & tools

    Works with any codebase including React/NestJS, Django/FastAPI, Spring/Android, Laravel, and Flutter. It provides specialized guidance for TypeScript, Python, Kotlin, Java, C#, PHP, and Rust.

    Why this beats prompting it yourself

    Generic LLM prompts often hallucinate complex patterns where a simple function would suffice, leading to "Enterprise Hello World" syndrome. This skill uses a rigorous "rule of three" and force-analysis framework to ensure patterns are only applied when they actually make the code easier to read and maintain.

    Use cases

    • Adding new providers like a third payment gateway or notification service without bloating existing logic.
    • Refactoring legacy switches that have grown too large to manage or test reliably.
    • Structuring new modules to ensure they follow SOLID principles and maintainable boundaries.
    • Reviewing PRs to catch over-engineered abstractions before they are merged.

    Known limitations

    Does not perform architecture-level changes like migrating to microservices or CQRS. Requires 2-5 neighbouring files to effectively match existing house style.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 9 days ago

    Permissions

    Read Files
    Write Files

    Read Files: the agent reads neighbouring files to follow your codebase's existing conventions. Write Files: only the code changes you asked for. No network, no shell, no API keys.

    Listed9 days ago
    Updated6 days ago

    What's inside

    Frequently Asked Questions

    Unlike generic prompts that often suggest over-engineered "Enterprise" solutions, this skill applies a 'Rule of Three' and force-analysis framework to ensure patterns are only suggested if they truly reduce complexity rather than adding boilerplate.

    It works with any AI agent that supports SKILL.md skills (Claude Code, Cursor, GitHub Copilot, Codex CLI, Gemini CLI and more). It includes full code examples for TypeScript/JavaScript, Python, Kotlin/Java, C#/.NET, PHP and Dart/Flutter, plus a cross-language overview table that also covers Go and Rust.

    Yes, the skill includes a specific 'house style' survey feature that analyzes 2-5 of your existing files to ensure any suggested patterns or naming conventions align with your project's established structure.

    Adding a new case, mode, type or provider to logic that already branches (a growing switch or if/else chain), integrating a new service provider such as a payment gateway, fixing bugs caused by duplicated logic without turning the fix into a rewrite, and checking whether existing code is over-engineered.

    It focuses on module-level design: which pattern (or none) fits the code you are changing. Architecture-level decisions such as moving to microservices, CQRS, event sourcing or hexagonal layering are only raised as proposals for you to decide; the skill never applies them inside a feature or bug fix.

    One skill with its reference library: the force-analysis workflow and "earns its place" test, a smell-to-pattern table, a catalog of GoF and modern patterns (use when / avoid when / lightest form), idiomatic code examples for TypeScript, Python, Kotlin/Java, C#, PHP and Dart, a refactoring guide, and an over-engineering checklist the agent runs after writing code.

    New in Code Quality & Review

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.