Getting started
Install
# via gago-plugins marketplace /plugin marketplace add gagoar/gago-plugins /plugin install ts-patterns@gago-plugins /reload-plugins
# standalone /plugin marketplace add gagoar/typescript-patterns-enforcer /plugin install ts-patterns@ts-patterns /reload-plugins
What's included
Components
/ts-patterns:check — inline skill, always active on .ts/.tsx files
ts-patterns:review — subagent, spawn for full reviews
- /ts-patterns:checkAutomatically active while writing or editing TypeScript. Provides inline guidance on types, patterns, and anti-patterns without being invoked.
- ts-patterns:reviewSpawn via the Agent tool for PR reviews, large refactors, or converting JavaScript to TypeScript. Runs as a dedicated subagent.
Reference
Core principles
| Principle | Rule |
|---|---|
| No 'any' | Use unknown and narrow, or define precise types |
| Explicit return types | Required on all public APIs |
| readonly by default | Use readonly unless mutation is required |
| async/await only | No callbacks or .then() chains |
| Typed errors | Custom error classes or discriminated-union results |
| Composition over inheritance | Prefer interfaces and composition |
Reference
Anti-patterns
| Anti-pattern | Preferred |
|---|---|
type Foo = any | type Foo = unknown (then narrow) |
function f(): any | function f(): ConcreteType |
.then(cb).catch(cb) | async/await with try/catch |
class B extends A | interface I; class B implements I |
try { } catch(e) { e.message } | catch(e) { if (e instanceof MyError) ... } |
as SomeType | satisfies or explicit narrowing |