L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Développement · SKILL.md

module-authoring

module-authoring

Author and debug custom Sonnet modules, lazy variables, composition wrappers, and module build contracts.

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: module-authoring description: "Author and debug custom Sonnet modules, lazy variables, composition wrappers, and module build contracts." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

Sonnet Module Authoring

Use this sub-skill for custom snt.Module classes, @snt.once lazy variable creation, variable and submodule inspection, name scopes, snt.Sequential, snt.Deferred, snt.BatchApply, and snt.build shape checks.

Start here

  1. Read references/module-patterns.md for concrete authoring patterns.
  2. Read references/api-reference.md for verified signatures and contracts.
  3. Read references/troubleshooting.md for construction, first-call, and composition failures.
  4. Run scripts/module_contract_smoke.py for a tiny executable lazy-variable and optional BatchApply check.

Boundaries

Minimum module contract

  • Subclass snt.Module and call super().__init__(name=name) in __init__.
  • Put input-dependent variable creation in a side-effect-only @snt.once method that returns None.
  • Call/build the module before inspecting variables or trainable_variables.
  • Use explicit subclasses for branching or extra call arguments; use Sequential only for plain chains.
  • Use Deferred when one module's constructor depends on another module after first call, and BatchApply for applying a 2-D module over extra leading dimensions.
Skills enregistrées