Skip to content

Guide · Agent skill

How to use the No Bare Casts agent skill (no-bare-casts)

Updated · written with AI from the project's own documentation and checked against our catalogue data

The no-bare-casts skill is a set of written instructions (a SKILL.md file) that tells an AI coding agent to avoid plain TypeScript 'as' type casts in production code. It is aimed at TypeScript teams and maintainers who want type escapes handled in a consistent, reviewable way. After this guide you will know what the skill changes in the agent's behaviour, how to install it, how to trigger it, and where it does not fit.

No Bare Casts Guideprisma/orm · Apache-2.0

Quick start

  1. 1Download the ZIP. Download the no-bare-casts skill ZIP from this page.
  2. 2Unzip the skill folder. Unzip the archive so that SKILL.md sits inside a no-bare-casts folder.
  3. 3Choose a location. Move the folder to ~/.claude/skills/ for personal use or to a project's .claude/skills/ for a shared repository.
  4. 4Or upload in the Claude apps. In the Claude apps, open Settings, go to Capabilities, and upload the skill under Skills.
  5. 5Check your project. Confirm you have a TypeScript codebase and the '@internal/utils/casts' module if you want the helper forms to work.
  6. 6Ask for a cast-free fix. Describe a type error or a file with 'as' casts in plain words and let the agent work through the decision tree.

What is an agent skill, and what does this one make the agent do?

An agent skill is a folder with a SKILL.md file that an AI agent reads when a request matches the skill's description. This one, named no-bare-casts, applies when the agent writes or edits TypeScript or TSX production code, modifies a file that already contains a bare 'as' cast, meets 'as unknown as', or reviews a cast site.

When it applies, the agent works through a six-step decision tree in order before keeping a cast: tighten the input type, add a runtime check such as a type predicate, restructure a generic, use 'satisfies', use castAs<T>(value) when the value already satisfies T, and only as a last resort use blindCast<T, "Reason">(value) with a specific written reason. Test files (*.test.ts, *.test-d.ts, test/**/*.ts) are exempt.

  • Blind casts require a Reason literal that a reviewer can evaluate; vague reasons like 'trust me' are rejected by the skill's guidance.
  • When touching a file with a bare 'as' cast, the agent should convert it to an accepted form or remove it.

Install the skill from the ZIP

Download the ZIP for the skill from this page and unzip it. The skill is a folder containing SKILL.md. Place that folder in one of two locations: ~/.claude/skills/ to make it available across your projects, or a project's .claude/skills/ folder to share it with one repository.

Alternatively, in the Claude apps, open Settings, go to Capabilities, and upload the skill under Skills.

  • Personal install: ~/.claude/skills/no-bare-casts/
  • Project install: .claude/skills/no-bare-casts/ inside your repository

Trigger the skill with natural requests

You do not need a special command. The agent loads the skill when your request touches the situations in its description. Plain requests work well, for example asking the agent to fix a type error without a cast, or to review a file for 'as' casts.

Name the situation in your request so the match is obvious, especially when working on a file that already has casts.

  • "This type error is fixed with an as cast. Can you find a way to type it properly instead?"
  • "Review src/ for bare as casts and convert them using the no-bare-casts rules."
  • "I'm editing this file that has an as unknown as. What should it become?"

What the skill needs from your project

The skill assumes a TypeScript codebase. Its helper forms import from '@internal/utils/casts', which provides blindCast and castAs. Without that module the helper suggestions point at imports that do not exist, so the skill is a poor fit for projects outside Prisma's internal layout unless you adapt those paths yourself.

The cast-count check refers to the pnpm lint:ratchets CI script. The skill also says this CI ratchet rejects per-PR increases in cast count.

  • TypeScript codebase
  • '@internal/utils/casts' module exposing blindCast and castAs for the helper forms
  • pnpm lint:ratchets script for the cast-count check referenced in the skill
import { blindCast, castAs } from '@internal/utils/casts';

Safety notes: scripts and network

According to the item's listing, this skill runs no scripts and uses no network. It consists of a single file, SKILL.md, containing instructions for the agent. Review the file yourself before installing any skill, since it changes how the agent writes code.

  • Runs scripts: no
  • Uses network: no
  • Files: SKILL.md only

Tips for getting good results

Expect the agent to try type tightening and runtime predicates before reaching for a helper. If it proposes blindCast, check that the Reason names a concrete constraint. A weak reason is a sign the type design needs another look.

Use the skill on refactors of cast-heavy files, because the convert-when-you-touch rule means each edit reduces the total over time.

  • Give the agent the file and the type error together so it can work through the decision tree.
  • For throwaway prototypes, consider turning the skill off, since it may slow work that does not need strict types.

What people use it for

  • Replacing an 'as unknown as' cast with a type predicate in a deserialization path.
  • Reviewing a TypeScript module for bare 'as' casts and converting them one file at a time.
  • Using 'satisfies' to check an object literal's type without coercing it.
  • Documenting an unavoidable type escape with a blindCast call that has a specific Reason.

Frequently asked questions

How do I install the no-bare-casts skill?

Download the ZIP from this page and unzip it so SKILL.md sits in a no-bare-casts folder. Put that folder in ~/.claude/skills/ for personal use or in a project's .claude/skills/ folder. You can also upload it in the Claude apps under Settings, then Capabilities, then Skills.

Do I need anything special to use this skill?

You need a TypeScript codebase. The helper forms import blindCast and castAs from '@internal/utils/casts', and the cast-count check refers to the pnpm lint:ratchets CI script. Without those, the helper suggestions will not match your project.

Is the no-bare-casts skill free?

The item is listed under the Apache-2.0 licence. This page does not list any price, so check the licence file in the repository for the terms that apply to your use.

Does the skill run scripts or access the network?

According to the listing, it runs no scripts and uses no network. It is a single SKILL.md file of instructions for the agent.

Does the skill apply to test files?

No. Test files, including *.test.ts, *.test-d.ts and test/**/*.ts, are exempt, because tests use 'as' for stubbing and type assertions.

What should I use instead if my project is not Prisma's codebase?

The skill's helper forms depend on Prisma's internal '@internal/utils/casts' module, so it suits TypeScript teams with a similar layout. If your project lacks that module, you can adapt the import paths or look for a different approach to type escapes; this listing does not name specific alternatives.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you maintain a strict TypeScript codebase, especially one with many existing 'as' casts, and want a consistent, auditable process for type escapes. Skip it for quick prototypes, test-only work, non-TypeScript projects, or any repository without the '@internal/utils/casts' helpers.

Download the skill