# ban-type-assertions

ban-type-assertions is a Claude Code skill that blocks TypeScript as assertions and guides their replacement with compiler-checked code. It runs when a package adopts the ban or needs existing lint violations fixed.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 151 installs · ★ 129 repo stars
- Author: Factory-AI
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Factory-AI/factory-plugins/tree/HEAD/plugins/typescript/skills/ban-type-assertions/SKILL.md
- Updated: 2026-10-25
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/ban-type-assertions

## What it does

The skill configures `@typescript-eslint/consistent-type-assertions` with `assertionStyle: 'never'`, then helps locate violations and replace casts. For data from outside the program, it points to Zod schema parsing; for union types, it uses control-flow narrowing. A justified lint exception is reserved for cases such as gaps in library typings.

It also covers duplicate schemas and types, test fixtures that fail validation, and parsing inside error handling. The suggested checks are `npm run lint`, `npm run typecheck`, `npm run test`, and `npm run knip`. Add the lint rule to the `.eslintrc.js` file for each affected package.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill ban-type-assertions -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/ban-type-assertions/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/ban-type-assertions/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill ban-type-assertions -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/ban-type-assertions/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill ban-type-assertions -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/ban-type-assertions/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Factory-AI/factory-plugins plugins/typescript/skills/ban-type-assertions
```

2. **Manually: put the files in place**
- File: `.github/skills/ban-type-assertions/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill ban-type-assertions -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Factory-AI/factory-plugins --path plugins/typescript/skills/ban-type-assertions
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/ban-type-assertions/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill ban-type-assertions -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Factory-AI/factory-plugins/tree/HEAD/plugins/typescript/skills/ban-type-assertions/SKILL.md

## When to use it
- block `as` casts in a package
- replace unchecked casts with Zod parsing
- narrow union types through control flow
- repair test fixtures without disabling the lint rule

## Example prompts
- Enable the ban on `as` in this package and fix the lint violations.
- Replace casts on external input with schema validation.
- Find test fixtures that need changes after the rule is enabled.

## Similar
- [principle-type-system-discipline](https://affpapa.org/en/nevibecode/skills/principle-type-system-discipline.md) — skill · 10300 installs
- [1-type-honesty](https://affpapa.org/en/nevibecode/rules/1-type-honesty.md) — rule · ★ 571 repo stars
- [python-type-safety](https://affpapa.org/en/nevibecode/skills/python-type-safety.md) — skill · 12643 installs
- [add-path-type-assertions-or-realpath-resolve-calls-in-path-joini](https://affpapa.org/en/nevibecode/skills/add-path-type-assertions-or-realpath-resolve-calls-in-path-joini.md) — skill · ★ 539 repo stars
- [typescript-best-practices](https://affpapa.org/en/nevibecode/skills/typescript-best-practices.md) — skill · 11200 installs
- [typescript-variables](https://affpapa.org/en/nevibecode/skills/typescript-variables.md) — skill · 4200 installs

From the same set: [factory-ai/factory-plugins](https://affpapa.org/en/nevibecode/by/factory-ai/factory-plugins.md) — 17 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
