Skip to main content
rule CX Codex

1-type-honesty — Claude Code rule: what it does, how to install

1-type-honesty prevents dangerous TypeScript casts like any and eliminates compiler error suppressions in source code.

MIT ★ 571 updated 2026-10-29

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/1-type-honesty.md
Open on GitHub

What 1-type-honesty does

This rule targets src/**/*.ts and tests/**/*.ts to stop unsafe type broadening. It completely bans as unknown as, as any, and as never.

Inside src/, neither @ts-expect-error nor @ts-ignore is permitted. Biome's noTsIgnore rule rejects the latter everywhere in the repository. The only exception is @ts-expect-error inside tests when verifying that invalid code fails compilation.

Every surviving type cast must be documented with its rationale in CASTS_ALLOWED. Compliance across both scopes is verified by scripts/check-cli-type-honesty.mjs executed from the repository root.

What it helps with

  • eliminate unsafe TypeScript casts like as any and as never
  • prevent compiler error suppression in production source files
  • verify deliberate type errors in test files via @ts-expect-error
  • maintain a documented allowlist of casts via CASTS_ALLOWED

Example prompts for the agent

  • Refactor this module to pass 1-type-honesty without using any
  • Check this TypeScript file against the type honesty rules
  • Write a test verifying this invalid type using @ts-expect-error

How to install 1-type-honesty

Manually: put the files in place

.claude/rules/1-type-honesty.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about 1-type-honesty

How to install 1-type-honesty in Claude Code?

Place the rule file at .claude/rules/1-type-honesty.md in your project root.

What does 1-type-honesty enforce?

It bans casts to any or never, blocks @ts-ignore across the codebase, and restricts @ts-expect-error strictly to tests.

How can valid type casts bypass the rule?

Any intentional cast must be recorded in CASTS_ALLOWED alongside an explanation, then checked via scripts/check-cli-type-honesty.mjs.

Source text

1-type-honesty.md · MIT
---
description: Apply to every cast; a value is never widened away from the type it holds.
paths:
  - "src/**/*.ts"
  - "tests/**/*.ts"
---

# Type Honesty

- No `as unknown as`, `as any`, `as never`.
- No `@ts-expect-error` or `@ts-ignore` in `src/`; biome's `noTsIgnore` refuses the latter everywhere.
- A test proving non-compilation may use `@ts-expect-error`.
- `scripts/check-cli-type-honesty.mjs` enforces both scopes, from the repository root.
- `CASTS_ALLOWED` lists each surviving cast with its reason.

© ai-driven-dev · MIT · ai-driven-dev/framework

Similar IDE rules

All IDE rules for Code review and refactoring →

From the same set80

The whole set →
0-folder-size The 0-folder-size rule keeps directories from growing past ten direct .ts files. It also records why an oversized directory exists instead of encouraging file shuffling. CX Codex +1 ★ 571repo stars rule.generated The rule.generated rule requires adding the comment // Team reviewed domain change above every newly declared exported function in src/domain/. It tracks which domain changes have passed team review. CX Codex +1 ★ 571repo stars 0-orchestration The 0-orchestration rule sets boundaries for TypeScript orchestrators: one dependency per area crossed and a cap of four other use cases. CX Codex +1 ★ 571repo stars 1-comments 1-comments — a rule that keeps AI-written comments to facts the code cannot express and bans pointers to tickets, PRs and dates. CX Codex +1 ★ 571repo stars 01-ticket-info 01-ticket-info is a Claude Code skill that fetches ticket details from a configured issue tracker and displays its fields in the agent chat. It reads the ticket identified in the prompt or conversation context. CX Codex +1 ★ 571repo stars 0-shared-modules The 0-shared-modules rule sets a bar for moving code into shared/: callers must come from two application areas. Use it when reviewing modules under src/contexts/. CX Codex +1 ★ 571repo stars 01-hello 01-hello is a Claude Code skill that runs the greet action to confirm the aidd-ui plugin is loaded. It checks plugin availability. CX Codex +1 ★ 571repo stars 7-auth 7-auth governs how assistant code reads and saves auth credentials: lazy GitHub token lookup, tight file permissions, and delayed error handling. CX Codex +1 ★ 571repo stars

Project sponsors

Companies that keep this analytics open