transformers: Skill for Claude Code

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

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 ✓ vendor

Written for no agent in particular: nothing here depends on one.

This is huggingface/transformers's own configuration. It tells Claude Code and Codex how to work on transformers itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything transformers configures →

About the project

Hugging Face Transformers is a framework that defines machine-learning models for text, vision, audio, video, and multimodal data, supporting both training and inference. Developers use it to work with pretrained models and connect them to training frameworks, inference engines, and other modeling libraries. The catalogue add-ons provide instructions and a skill for working with Transformers.

huggingface/transformers · 168,576 stars · on GitHub · huggingface.co

Reuse

Borrowing it

Nothing to install: this file belongs to huggingface/transformers. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/huggingface/transformers/main/.ai/skills/add-or-fix-type-checking/SKILL.md
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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-or-fix-type-checking

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Snyk pass 6 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00041 $0.02516
Opus 5.5 $0.00016 $0.01006
Sonnet 5.5 $0.00008 $0.00503
Haiku 4.5 $0.00004 $0.00252

Measured 2mo ago against content hash f39fc4b05630, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (168,576 stars, last pushed today), licensed Apache-2.0. It adds 41 tokens to every session and 2,516 once invoked, about $0.0002 per session on Opus 5.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.

Related

add-or-fix-type-checking compared with skills from other repositories

add-or-fix-type-checking next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
add-or-fix-type-checkinghuggingface/transformersSkill169ktodayApache-2.0A41Claude Code, Codex
python-code-qualitymicrosoft/agent-frameworkSkill15kyesterdayMITA40Claude Code, Codex
plugin-architecture-patternsxberg-io/xbergSkill9.5ktodayMITA15Claude Code
test-corpusxberg-io/xbergSkill9.5ktodayMITA15Claude Code, Codex
stack-trace-python-probeopensquilla/opensquillaSkill7.1k6d agoApache-2.0A40Claude Code
idapythonmrexodia/ida-pro-mcpSkill13k1mo agoMITA77Claude Code
memory-optimizationbenchflow-ai/skillsbenchSkill1.9k2d agoApache-2.0A60Claude Code, Codex