add-or-fix-type-checking

add-or-fix-type-checking is a skill for Claude Code, Codex from huggingface/transformers. It costs 41 tokens per session (2,516 once invoked), scanned A, original, Apache-2.0.

A workflow for repairing Python type-checking errors found by ty, a type-checking tool, or by project and continuous-integration checks.

In plain words
What is it for?
Use it to identify the affected files, run a narrow type check, group errors, and correct issues such as missing annotations, unsafe None values, union types, and incomplete library type information.
Why use it?
It helps turn scattered type errors from local runs, CI, or pull-request logs into a focused set of fixes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/huggingface/transformers/add-or-fix-type-checking
Any agent
npx skills add huggingface/transformers --skill add-or-fix-type-checking
Clone the repo
git clone --depth 1 https://github.com/huggingface/transformers

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-or-fix-type-checking

README.md
[![agentmods](https://agentmods.dev/badge/skills/huggingface/transformers/add-or-fix-type-checking.svg)](https://agentmods.dev/skills/huggingface/transformers/add-or-fix-type-checking)
Your own site
<a href="https://agentmods.dev/skills/huggingface/transformers/add-or-fix-type-checking"><img src="https://agentmods.dev/badge/skills/huggingface/transformers/add-or-fix-type-checking.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,516 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.02516
Opus 5 $0.00020 $0.01258
Sonnet 5 $0.00008 $0.00503
Haiku 4.5 $0.00004 $0.00252

Measured 4d ago against content hash f39fc4b05630, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-or-fix-type-checking scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.ai/skills/add-or-fix-type-checking/SKILL.md · 216 lines

How it starts

The opening of the file, as written. The whole thing — 216 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add Or Fix Type Checking

Input

  • <target>: module or directory to type-check (if known).
  • Optional make typing or CI output showing typing failures.

Workflow

  1. Identify scope from the failing run:

    • If you already have make typing or CI output, extract the failing file/module paths.
    • If not, run:
      make typing
      
    • Choose the narrowest target that covers the failures.
  2. Run ty check for the target to get a focused baseline:

    ty check --respect-ignore-files --exclude '**/*_pb*' <target>
    
  3. Triage errors by category before fixing anything:

    • Wrong/missing type annotations on signatures
    • Attribute access on union types (for example X | None)
    • Functions returning broad unions (for example str | list | BatchEncoding)
    • Mixin/protocol self-type issues
    • Dynamic attributes on objects or modules
    • Third-party stub gaps (missing kwargs, missing __version__, etc.)
  4. Apply fixes using this priority order (simplest first):

    a. Narrow unions with isinstance() / if x is None / hasattr(). This is the primary tool for resolving union-type errors. ty narrows through all of these patterns, including the negative forms:

    # Narrow X | None — use `if ...: raise`, never `assert`
    if x is None:
        raise ValueError("x must not be None")
    x.method()  # ty knows x is X here
    
    # Narrow str | UploadFile
    if isinstance(field, str):
        raise TypeError("Expected file upload, got string")
    await field.read()  # ty knows field is UploadFile here
    
    # Narrow broad union parameters early in a function body
    # (common for methods accepting e.g. list | dict | BatchEncoding)
    if isinstance(encoded_inputs, (list, tuple)):
        raise TypeError("Expected a mapping, got sequence")
    encoded_inputs.keys()  # ty sees only the dict/mapping types now
    

    b. Use local variables to help ty track narrowing across closures. When self.x is X | None and you need to pass it to nested functions or closures, ty cannot track that self.x stays non-None. Copy to a local variable and narrow the local:

    manager = self.batching_manager
    if manager is None:
        raise RuntimeError("Manager not initialized")
    # Use `manager` (not `self.batching_manager`) in nested functions
    

Read the full file on GitHub · 216 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 216 lines · 41 tokens per session scan A f39fc4b05630

Subscribe to this mod's changes

add-or-fix-type-checking is a skill published in the GitHub repository huggingface/transformers (164,637 stars, last pushed 4d ago), licensed Apache-2.0. It adds 41 tokens to every session and 2,516 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.