一键导入
ty
Use this skill for Python type checking with ty. Activated when: - Running ty check - Fixing type errors - Adding type annotations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use this skill for Python type checking with ty. Activated when: - Running ty check - Fixing type errors - Adding type annotations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this skill when working with Sahaidachny task planning. Activated when: - User mentions "task", "planning", "user stories", "design decisions" - Working in a `task-XX/` directory - Any `/saha:*` command is invoked
Use this skill when working with Sahaidachny task artifacts. Activated when: - Working with task planning documents - Reading/updating user stories, design decisions, implementation plans - Any task folder (task-XX/) operations
Comprehensive test quality and completeness analysis across 6 dimensions. Use when: - Verifying ALL needed tests exist (cross-ref user stories, code changes, test specs) - Reviewing test implementations before QA - Verifying tests actually test real behavior - Detecting over-mocking, poor assertions, missing edge cases - Identifying flaky patterns and test smells
Guidance for measuring cognitive complexity with complexipy.
Guidance for running Ruff and interpreting lint results.
Guidance for evaluating test quality and detecting hollow tests.
| name | ty |
| description | Use this skill for Python type checking with ty. Activated when: - Running ty check - Fixing type errors - Adding type annotations |
| version | 0.1.0 |
| globs | ["*.py","pyproject.toml","ty.toml"] |
ty is an extremely fast Python type checker and language server. It serves as a modern replacement for mypy and Pyright.
[tool.ty] in pyproject.toml or ty.toml config files# Using uv (recommended in projects)
uv run ty check .
# One-off usage
uvx ty check .
# Check specific file
uv run ty check src/main.py
# Check with specific Python version
uv run ty check --python-version 3.11 .
In pyproject.toml:
[tool.ty]
python-version = "3.11"
[tool.ty.rules]
# Set rule severities
unresolved-import = "error"
unresolved-attribute = "warning"
invalid-type-form = "error"
[tool.ty.environment]
# Configure virtual environment
python = ".venv/bin/python"
Or in ty.toml:
python-version = "3.11"
[rules]
unresolved-import = "error"
[environment]
python = ".venv/bin/python"
# Error: Cannot resolve import "nonexistent"
from nonexistent import foo
# Fix: Install the package or check the import path
# Error: Expected str, got int
def greet(name: str) -> str:
return f"Hello, {name}"
greet(42) # Error!
# Fix: Pass correct type
greet("Alice")
# Warning: Missing return type annotation
def add(a: int, b: int):
return a + b
# Fix: Add return type
def add(a: int, b: int) -> int:
return a + b
# Error: "None" has no attribute "strip"
def process(value: str | None) -> str:
return value.strip() # Error!
# Fix: Handle None case
def process(value: str | None) -> str:
if value is None:
return ""
return value.strip()
# Old style
from typing import List, Dict, Optional, Union
def foo(items: List[str]) -> Optional[Dict[str, int]]:
...
# Modern style
def foo(items: list[str]) -> dict[str, int] | None:
...
# Define aliases for readability
type UserId = int
type UserMap = dict[UserId, User]
def get_users() -> UserMap:
...
# Always annotate public functions
def calculate_total(
items: list[Item],
discount: float = 0.0,
) -> float:
...
When necessary, use targeted ignores:
# ty: ignore[rule-name] - Specific rule
value = some_dynamic_thing # ty: ignore[unresolved-attribute]
# Avoid blanket ignores
value = thing # ty: ignore # Bad - too broad
| mypy | ty |
|---|---|
mypy . | ty check . |
# type: ignore | # ty: ignore |
mypy.ini | ty.toml or pyproject.toml |
The agentic loop runs ty check during the Code Quality phase. Type errors will cause the iteration to fail with fix_info listing the type issues to resolve.