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.
npx agentmods add commands/thebeardedbearsas/claude-craft/type-coveragegit clone --depth 1 https://github.com/TheBeardedBearSAS/claude-craftWrote 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.
[](https://agentmods.dev/commands/thebeardedbearsas/claude-craft/type-coverage)<a href="https://agentmods.dev/commands/thebeardedbearsas/claude-craft/type-coverage"><img src="https://agentmods.dev/badge/commands/thebeardedbearsas/claude-craft/type-coverage.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00008 | $0.03320 |
| Opus 5 | $0.00004 | $0.01660 |
| Sonnet 5 | $0.00002 | $0.00664 |
| Haiku 4.5 | $0.00001 | $0.00332 |
Grade A, and why
type-coverage 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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 510 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Vérification Couverture des Types Python
Tu es un expert Python. Tu dois vérifier la couverture des annotations de types dans le projet et identifier les fonctions/méthodes non typées.
Arguments
$ARGUMENTS
Arguments :
- (Optionnel) Chemin vers un module spécifique
- (Optionnel) Seuil de couverture minimum (ex:
80)
Exemple : /python:type-coverage app/ ou /python:type-coverage app/api/ 90
MISSION
Étape 1 : Configuration mypy
# pyproject.toml
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
show_error_codes = true
show_column_numbers = true
# Exclusions
exclude = [
"tests/",
"migrations/",
"alembic/",
]
# Plugins
plugins = [
"pydantic.mypy",
"sqlalchemy.ext.mypy.plugin",
]
# Configuration par module
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
[[tool.mypy.overrides]]
module = "alembic.*"
ignore_errors = true
Étape 2 : Lancer l'Analyse
# Mypy standard
mypy app/
# Avec rapport de couverture
mypy app/ --txt-report type-coverage/
# Rapport HTML
mypy app/ --html-report type-coverage-html/
# Mode strict progressif
mypy app/ --strict --warn-return-any
# Ignorer les erreurs existantes (génère baseline)
mypy app/ --strict 2>&1 | tee mypy-baseline.txt
Étape 3 : Script d'Analyse de Couverture
# scripts/type_coverage.py
"""Analyse la couverture des types dans le projet."""
import ast
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Generator
@dataclass
class FunctionInfo:
"""Informations sur une fonction."""
name: str
file: str
line: int
has_return_type: bool
params_typed: int
params_total: int
is_method: bool = False
class_name: str | None = None
@property
def fully_typed(self) -> bool:
return self.has_return_type and self.params_typed == self.params_total
@property
def coverage_percent(self) -> float:
total = self.params_total + 1 # +1 pour le return type
typed = self.params_typed + (1 if self.has_return_type else 0)
return (typed / total * 100) if total > 0 else 100.0
@dataclass
class ModuleStats:
"""Statistiques d'un module."""
path: str
functions: list[FunctionInfo] = field(default_factory=list)
@property
def total_functions(self) -> int:
return len(self.functions)
@property
def fully_typed_functions(self) -> int:
return sum(1 for f in self.functions if f.fully_typed)
@property
def coverage_percent(self) -> float:
if not self.functions:
return 100.0
return self.fully_typed_functions / self.total_functions * 100
class TypeCoverageAnalyzer(ast.NodeVisitor):
"""Analyseur de couverture des types."""
def __init__(self, file_path: str):
self.file_path = file_path
self.functions: list[FunctionInfo] = []
self._current_class: str | None = None
def visit_ClassDef(self, node: ast.ClassDef) -> None:
self._current_class = node.name
self.generic_visit(node)
self._current_class = None
def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
self._analyze_function(node)
self.generic_visit(node)
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None:
self._analyze_function(node)
self.generic_visit(node)
def _analyze_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None:
# Skip private/magic methods sauf __init__
if node.name.startswith('_') and node.name != '__init__':
return
# Compter les paramètres typés
params_total = 0
params_typed = 0
for arg in node.args.args:
# Ignorer 'self' et 'cls'
if arg.arg in ('self', 'cls'):
continue
params_total += 1
if arg.annotation is not None:
params_typed += 1
# Vérifier le type de retour
has_return_type = node.returns is not None
# Pour __init__, pas besoin de return type
if node.name == '__init__':
has_return_type = True
self.functions.append(FunctionInfo(
name=node.name,
file=self.file_path,
line=node.lineno,
has_return_type=has_return_type,
params_typed=params_typed,
params_total=params_total,
is_method=self._current_class is not None,
class_name=self._current_class,
))
def analyze_file(file_path: Path) -> ModuleStats:
"""Analyse un fichier Python."""
with open(file_path, 'r', encoding='utf-8') as f:
source = f.read()
try:
tree = ast.parse(source)
except SyntaxError:
return ModuleStats(path=str(file_path))
analyzer = TypeCoverageAnalyzer(str(file_path))
analyzer.visit(tree)
return ModuleStats(
path=str(file_path),
functions=analyzer.functions,
)
def find_python_files(directory: Path) -> Generator[Path, None, None]:
"""Trouve tous les fichiers Python."""
for path in directory.rglob('*.py'):
# Ignorer certains dossiers
if any(part.startswith('.') or part in ('__pycache__', 'venv', '.venv', 'migrations', 'alembic')
for part in path.parts):
continue
yield path
def main(target_path: str, min_coverage: float = 80.0) -> int:
"""Point d'entrée principal."""
target = Path(target_path)
if target.is_file():
files = [target]
else:
files = list(find_python_files(target))
all_stats: list[ModuleStats] = []
for file_path in files:
stats = analyze_file(file_path)
all_stats.append(stats)
# Afficher le rapport
print_report(all_stats, min_coverage)
# Calculer la couverture globale
total_functions = sum(s.total_functions for s in all_stats)
fully_typed = sum(s.fully_typed_functions for s in all_stats)
global_coverage = (fully_typed / total_functions * 100) if total_functions > 0 else 100.0
return 0 if global_coverage >= min_coverage else 1
if __name__ == '__main__':
target = sys.argv[1] if len(sys.argv) > 1 else 'app/'
threshold = float(sys.argv[2]) if len(sys.argv) > 2 else 80.0
sys.exit(main(target, threshold))
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.
- today First seen · 510 lines · 8 tokens per session scan A 44b03d58e83e
type-coverage is a command published in the GitHub repository TheBeardedBearSAS/claude-craft (105 stars, last pushed yesterday), licensed MIT. It adds 8 tokens to every session and 3,320 once invoked, about $0.0000 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-09-03.
Other commands, from other repositories
git
Git operations with intelligent commit messages and workflow optimization.
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.