Agent skill

Type Hints for ML Code

Apply appropriate type hints for ML/PyTorch code. Use when adding type annotations to ML code or addressing mypy errors.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill ml-type-hints-apassuello-multimodal-insight-e --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 10 KB
Bundled scripts: none
Path: skills/ai-ml/ml-type-hints-apassuello-multimodal-insight-e/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Type Hints for ML Code - Constitutional AI ## When to Apply Automatically activate when: - Adding type hints to ML code - Addressing mypy type errors - Working with PyTorch tensors, models, or optimizers - Dealing with HuggingFace transformers types ## Project Type Checking Status **Current mypy status:** - **41 errors remaining** (documented in MYPY_ANALYSIS_REPORT.md) - **Status**: Accepted as reasonable for ML research code - **CI behavior**: `continue-on-error: true` (doesn't fail builds) **Key insight**: Perfect type coverage is not the goal for ML code. Prioritize correctness and readability over type perfection. ## When to Use Type Hints ### ✅ Do Use Type Hints For 1. **Public API functions** ```python def load_model(model_name: str) -> tuple[AutoModelForCausalLM, AutoTokenizer]: """Load model and tokenizer.""" pass ``` 2. **Configuration dataclasses** ```python @dataclass class TrainingConfig: learning_rate: float batch_size: int num_epochs: int ``` 3. **Clear input/output types** ```python def evaluate_text(text: str, framework: ConstitutionalFramework) -> dict[str, Any]: """Evaluate text against principles.""" pass ``` 4. **Helper functions with simple types** ```python

What's inside
Steps it walks through
  1. When to Apply
  2. Project Type Checking Status
  3. When to Use Type Hints
  4. ✅ Do Use Type Hints For
  5. ❌ Don't Force Type Hints For
  6. PyTorch Type Patterns
  7. Tensor Types
  8. Model and Optimizer Types
  9. Device Types
  10. Handling "Any" Type
  11. When Any is Acceptable
  12. Prefer Specific Types When Possible
  13. Optional and Union Types
  14. Common ML Type Patterns
Ships with 1 file
  • metadata.json
Commands it runs
Run mypy on all source code
mypy constitutional_ai/ --ignore-missing-imports
Run on specific module
mypy constitutional_ai/framework.py
Show error codes (useful for targeted ignores)
mypy constitutional_ai/ --show-error-codes
Strict mode (educational, will fail)
mypy constitutional_ai/ --strict
More from claude-skill-registry
All skills →
About this skill
What does the Type Hints for ML Code skill do?

Apply appropriate type hints for ML/PyTorch code. Use when adding type annotations to ML code or addressing mypy errors.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill ml-type-hints-apassuello-multimodal-insight-e --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going