Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

adversarial-ts-patterns

БесплатноБез исполняемых скриптовНе проверен

Use this skill to gate TypeScript and React application code with a pass/fail adversarial review of design-pattern usage — a single blind reviewer subagent…

pproencaот pproenca★ 231 звезда на GitHub

Об этом скилле

Adversarial TS Patterns Gate

A design-pattern usage gate for TypeScript and React application code — a pass/fail gate: a single blind reviewer subagent judges the work against this gate's rules with an adversarial mandate, and the work passes only when every rule is PASS or N/A. This skill renders verdicts; it never fixes the work.

The gate judges in both directions. Over-abstraction — Gang of Four and enterprise machinery ported from Java/C# where idiomatic TypeScript reaches for a function, a module, or a tagged union. Under-modeling — implicit state machines whose impossible states compile: boolean-flag lifecycles, effect chains, hand-synced derived state, silent default branches.

When to Apply

  • A TypeScript/React diff or feature is about to merge and needs an objective PASS/FAIL on pattern usage, not advisory feedback.
  • An agent (Claude, Codex) authored the code and you want an independent check that it is not reproducing Java/C# training-data idioms — Singleton classes, factory hierarchies, repository wrappers, JavaBean accessors.
  • A migration from another stack (Java, C#, Angular-style DI) claims completion and the ported architecture needs auditing for layers that lost their justification in TypeScript.
  • Component or store state grew organically and you want the implicit-state-machine failure modes (contradictory booleans, effect chains, non-exhaustive matches) caught before they ship.

Do not apply to non-TypeScript codebases (the reviewer prompt's precondition aborts with "GATE NOT APPLICABLE"), or when the user wants explanations and refactors rather than a verdict — that is the job of the curated implementation-design-patterns and implementation-functional-patterns skills. React-specific rules go N/A in non-React TypeScript projects; the rest of the gate works in any TypeScript application.

Review Protocol

Follow these steps exactly — the gate's value is that every review runs the same way.

  1. Identify the target. Pin down exactly what is under review (a diff, a set of files, a PR) and note the ref/paths so the review runs against an unambiguous, fixed target. Include the repo root in the target description — the layer-no-single-impl-interface and layer-no-di-container-in-app rules require searching beyond the diff for second implementations and registrations.
  2. Load the rules. Read references/_sections.md and every rule file in references/ (all state-*.md, create-*.md, behave-*.md, layer-*.md, react-*.md, oo-*.md files).
  3. Compose the reviewer prompt. Fill references/reviewer-prompt.md with the rules and the target. The composed prompt must be fully self-contained — a reviewer sees no conversation history, so nothing may refer to context outside the prompt.
  4. Dispatch one blind reviewer. Launch a single Task subagent whose entire input is the composed prompt — no conversation context, no commentary alongside it.
  5. Render fail-closed. The reviewer's structured output is the verdict — there is no merge step. Overall verdict is PASS only when every rule is PASS or N/A; any single FAIL fails the gate. Never average, weigh severity, or waive a rule — a "minor" FAIL is a FAIL. If the reviewer returns "GATE NOT APPLICABLE" (not a TypeScript target), stop and report that instead of a verdict.
  6. Render the verdict. Fill assets/templates/verdict.md. On FAIL, aggregate the reviewer's "missing for PASS" suggestions into the fix list, each with its location, ordered by category importance. Every rule whose final result is FAIL must appear in the fix list with a change concrete enough to apply as written — if the reviewer's suggestion only restates the violation, derive the fix from the rule's Correct example before rendering.

If the same rule flips verdicts across re-reviews of an unchanged target, or a human reads the evidence and overrides the verdict, that is a decidability bug in the rule — record it in gotchas.md and sharpen the rule; do not override the gate.

Verdict Format

The reviewer returns, per rule: PASS | FAIL | N/A, evidence (file:line or a quote — required for PASS as well as FAIL), and for every FAIL, the fix that flips the rule to PASS once applied — the named change plus its location, never a restatement of the violation. The final report follows assets/templates/verdict.md.

Rule Categories

# Category Prefix Covers
1 State Modeling & Machines state- Discriminated unions over boolean flags, no effect chains, no stored derived state, exhaustive matches with never
2 Creational Ports create- No getInstance() singletons, no factory-class hierarchies, no builders for option bags
3 Behavioral Ports behave- Functions over single-method classes, unions over State/Visitor hierarchies, no even
Полный SKILL.md на GitHub

Установить adversarial-ts-patterns в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

assets/templates/verdict.mdgotchas.mdmetadata.jsonreferences/_sections.mdreferences/behave-no-event-bus-in-tree.mdreferences/behave-no-single-method-class.mdreferences/behave-union-over-state-visitor-classes.mdreferences/create-no-builder-for-optional-bag.mdreferences/create-no-factory-class-hierarchy.mdreferences/create-no-getinstance-singleton.mdreferences/layer-no-di-container-in-app.mdreferences/layer-no-passthrough-repository.mdreferences/layer-no-single-impl-interface.mdreferences/oo-no-static-only-class.mdreferences/oo-no-trivial-accessors.mdreferences/react-no-component-inheritance.mdreferences/react-no-hoc-for-logic-reuse.mdreferences/react-no-imperative-handle-data-flow.mdreferences/reviewer-prompt.mdreferences/state-exhaustive-match-on-unions.mdreferences/state-no-effect-chains.mdreferences/state-no-stored-derived-state.mdreferences/state-union-over-boolean-flags.md

FAQ

Что делает скилл adversarial-ts-patterns?

Use this skill to gate TypeScript and React application code with a pass/fail adversarial review of design-pattern usage — a single blind reviewer subagent judges a diff or file set against 18 decidable rules covering implicit state machines (boolean-flag lifecycles, useEffect chains, stored derived state, non-exhaustive union matches) and over-engineered OO/enterprise ports (getInstance singletons, factory and builder classes, single-method strategy classes, State/Visitor hierarchies, event buses inside a React tree, pass-through repositories, DI containers, single-implementation interfaces, component inheritance, logic-only HOCs, static-only classes, trivial accessors). Trigger it before merging TS/React work, when asked to gate or pass/fail pattern usage, or as a check that agent-authored code is not porting Java/C# idioms. It renders verdicts only; for teaching-style guidance use implementation-design-patterns or implementation-functional-patterns.

Как установить скилл adversarial-ts-patterns?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл adversarial-ts-patterns запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить adversarial-ts-patterns с