- Home
- Skills
- Code Quality & Review
- Claude Pattern Advisor
Claude Pattern Advisor
Architecture advisor that selects idiomatic design patterns only when they earn their place in your code.
$7
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
| Component | Description |
|---|---|
| Chosen Pattern | Strategy (implemented as a record of functions) |
| Forces Resolved | High cyclomatic complexity in calculateTotal; violating Open-Closed principle when adding types. |
| House Style | Matches the PricingRule naming convention found in src/services/billing/. |
| Threshold | Refactor 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
- Create
discountStrategies.tsand migrate existing 'Standard' and 'Member' logic. - Update the
CheckoutEngineto inject the strategy based on the user profile. - Add a unit test specifically for the
Studentstrategy 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
- Classify the task as a new feature, bug fix, or refactor to set the appropriate architectural stance.
- Identify smells in the current code such as tangled conditionals or duplicated switch statements.
- Compare candidates using the "earns its place" test to ensure the pattern reduces complexity.
- 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
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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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: 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.
What's inside
Frequently Asked Questions
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.