Skip to content
Back to search

pattern-advisor

MarketplaceWorks with Claude CodeGitHub

Claude Code plugin: picks the right design pattern (or deliberately none) when Claude adds a feature, fixes a bug or refactors.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/abderrahmannjeh--pattern-advisor/badge.svg)](/listings/abderrahmannjeh--pattern-advisor)

HTML

<a href="/listings/abderrahmannjeh--pattern-advisor"><img src="/api/listings/abderrahmannjeh--pattern-advisor/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

In Claude Code:

/plugin marketplace add abderrahmannjeh/pattern-advisor
/plugin install pattern-advisor@pattern-advisor

Or from a terminal:

claude plugin marketplace add abderrahmannjeh/pattern-advisor
claude plugin install pattern-advisor@pattern-advisor

Try it locally without installing:

claude --plugin-dir ./pattern-advisor

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 19 lines
  1. {
  2. "name": "pattern-advisor",
  3. "owner": {
  4. "name": "Abderrahman Njeh"
  5. },
  6. "metadata": {
  7. "description": "Design-pattern guidance for Claude Code."
  8. },
  9. "plugins": [
  10. {
  11. "name": "pattern-advisor",
  12. "source": "./",
  13. "description": "Makes Claude pick the right design pattern (or deliberately none) when it adds a feature, fixes a bug or refactors.",
  14. "version": "0.2.0",
  15. "category": "development",
  16. "keywords": ["design-patterns", "architecture", "refactoring", "code-quality"]
  17. }
  18. ]
  19. }
README.md · README · 120 lines
  1. # pattern-advisor
  2. A Claude Code plugin that makes Claude **think about design patterns before it writes code** —
  3. and, just as important, **refuse patterns that aren't needed**.
  4. When Claude adds a feature, fixes a bug or refactors, the plugin makes it:
  5. 1. **Read the house style first** — which patterns your codebase already uses for this kind of problem, so new code stays consistent.
  6. 2. **Name the forces** — what varies, how many variants really exist, what must stay stable.
  7. 3. **Map symptoms to patterns** — repeated `switch` on a type → Strategy / sealed types; constructor with 9 params → Builder or options object; vendor SDK leaking everywhere → Adapter; invalid status transitions → State machine…
  8. 4. **Apply the "earns its place" test** — rule of three, local next change, idiomatic in *your* language, cheaper to read than before.
  9. 5. **Use the idiomatic form** — a dict of functions in Python, a discriminated union in TypeScript, a sealed class in Kotlin, an enum + `match` in Rust — not Java-style class hierarchies everywhere.
  10. 6. **Keep bug fixes minimal** — fix first, propose the refactor separately.
  11. 7. **Tell you what it chose and why** in a two-line note — and, when a pattern isn't worth it *yet*, the threshold at which it would be ("if a 3rd provider arrives, extract a Strategy").
  12. ## What's inside
  13. | Component | Name | What it does |
  14. |---|---|---|
  15. | Skill (auto) | `design-patterns` | Loaded automatically when Claude is about to add a feature, fix a structural bug or refactor. |
  16. | Command | `/pattern-advisor:suggest <feature \| file \| bug>` | Advice only: recommended pattern, sketch in your codebase's style, rejected alternatives. |
  17. | Command | `/pattern-advisor:review [file \| ref] [--apply]` | Reviews the diff (or a path) for missing patterns, misused patterns and over-engineering (up to 5 findings + a "leave alone" list). `--apply` applies the low/medium-risk ones in small, tested steps. |
  18. | Agent | `pattern-scout` | Fast read-only agent that maps the conventions and extension points of an area of the repo. |
  19. | Hook | `SessionStart` | Adds a ~100-token reminder at session start so Claude reliably loads the skill before feature/fix/refactor edits (in tests, without it Claude often skipped the skill and copy-pasted the new case into every branch). |
  20. Reference material the skill reads on demand:
  21. - `smell-to-pattern.md` — symptom → candidate patterns (incl. bug-fix signals and UI patterns)
  22. - `catalog.md` — GoF + modern patterns (Repository, DI, Value Object, Use Case, MVVM/MVI, Outbox, Circuit Breaker, Specification, hooks…) with *use when / avoid when / lightest form*
  23. - `languages/` — code examples of the idiomatic form in **TypeScript/JavaScript, Python, Kotlin/Java (Android), C#/.NET, PHP, Dart/Flutter**
  24. - `language-idioms.md` — one-table overview across languages, including Go and Rust
  25. - `refactoring.md` — smell → refactoring, patterns to *remove*, safe small steps, report format
  26. - `anti-patterns.md` — over-engineering checklist run after writing code
  27. ## Install
  28. In Claude Code:
  29. ```
  30. /plugin marketplace add abderrahmannjeh/pattern-advisor
  31. /plugin install pattern-advisor@pattern-advisor
  32. ```
  33. Or from a terminal:
  34. ```bash
  35. claude plugin marketplace add abderrahmannjeh/pattern-advisor
  36. claude plugin install pattern-advisor@pattern-advisor
  37. ```
  38. Try it locally without installing:
  39. ```bash
  40. claude --plugin-dir ./pattern-advisor
  41. ```
  42. ## Examples
  43. ```
  44. > Add a "student" pricing mode to checkout
  45. ```
  46. Claude surveys `pricing/`, sees three modes in an `if/else` chain duplicated in two files,
  47. turns them into a map of pricing functions, adds `student` as one entry, and ends with:
  48. > **Pattern:** Strategy (map of pricing functions) — 3 modes already branched in 2 places; new modes are now one entry.
  49. > **Considered:** State — rejected, mode doesn't change during an order's life.
  50. ```
  51. > /pattern-advisor:suggest we need to send notifications by email, SMS and Slack, urgent or digest
  52. ```
  53. → recommends Bridge-like separation of *channel* × *delivery policy* instead of 6 classes.
  54. ```
  55. > Fix: orders in "cancelled" can still be shipped
  56. ```
  57. → minimal guard fix now; proposes an explicit transition table as a follow-up instead of bundling a refactor into the fix.
  58. ## Philosophy
  59. - Patterns answer forces; no forces, no pattern.
  60. - Consistency with the existing codebase beats textbook optimality.
  61. - Architecture-level patterns (hexagonal, CQRS, event sourcing, sagas) are surfaced as proposals, never slipped into a feature.
  62. ## Does it actually work? — evals
  63. `evals/` holds 5 scenarios run **with and without** the plugin (`claude plugin eval`), each graded by file checks plus an LLM judge:
  64. | Scenario | What a pass means | With plugin | Without |
  65. |---|---|---|---|
  66. | `feature-duplicated-branches` (TS) | new pricing mode added by consolidating 3 duplicated branches into one table | 2/2 | 0/2 |
  67. | `feature-python-channels` (Python) | new notification channel added without a 3rd `elif` in 3 files | 2/2 | 0/2 |
  68. | `trivial-label-change` | one-line edit, no refactor | 2/2 | 2/2 |
  69. | `simple-param-no-pattern` | optional CC param, no Builder/class | 2/2 | 2/2 |
  70. | `bugfix-stays-minimal` | minimal guard, no State-pattern rewrite inside a fix | 2/2 | 2/2 |
  71. Measured on 2026-11-19 with Sonnet, 2 runs per arm. The plugin changes behaviour exactly where a pattern is due and leaves the other cases alone. Cost: about +0.03 USD per feature task (the skill is read before coding).
  72. Reproduce:
  73. ```bash
  74. claude plugin eval . --scaffold --allow-tools Edit Write --model sonnet -j 4
  75. ```
  76. ## Credits
  77. v0.2 merges ideas and the per-language reference files from *pattern-pilot*, an earlier take on the same plugin by the same author.
  78. ## Contributing
  79. Issues and PRs welcome — especially new smell → pattern rows, language idioms, and counter-examples where the plugin over-engineers.
  80. Validate before opening a PR:
  81. ```bash
  82. claude plugin validate . --strict
  83. ```
  84. ## License
  85. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.