jac-types

Explains Jac type annotations, casts, generics, and type-check error resolution.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-types-nihalnihalani
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jac-types
Source: https://github.com/nihalnihalani/jachacks-sf-2026/tree/main/plugins/jac-codex/skills/jac-types
Command: npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-types-nihalnihalani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing typed Jac code requires knowing its specific type system rules: mandatory annotations on every def parameter and has field, the as cast escape hatch, handling any values at untyped boundaries, and avoiding common checker errors like E1001, E1030, and W3037. This Skill provides the complete reference so you write type-correct Jac code the first time and can diagnose type-check failures quickly. ## Core Features & Use Cases - Type Annotation Rules: Covers required annotations on def parameters, has fields, and return types, plus union types (X | Y), optionals (T | None), and None-narrowing with isinstance guards. - Boundary Handling: Documents the 3-step playbook for landing any values from Python interop, JSON, or walker reports into typed destinations using typed sources, isinstance narrowing, or as casts. - Advanced Constructs: Explains import type for circular imports, ambient typing names (Callable, Protocol, TypeVar), type aliases, generics with declared type params, and their verified pitfalls. - Use Case: When jac check fails with E1032 (Type is Unknown) after chaining a Self-returning method, consult this Skill to learn that Self resolves to Unknown and you should return the concrete archetype name instead. ## Quick Start Load the jac-types skill and explain why my Jac function fails jac check with error E1001 when assigning a walker report to a typed list.

Frequently Asked Questions about jac-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix E1001 cannot assign type errors in Jac?▼

E1001 occurs when an any value flows into a declared non-any destination. Fix it by typing the source with a return annotation, narrowing with isinstance before assignment, or casting at the use site with value as Type.

How do I use the as cast in Jac?▼

Use value as Type to re-type a value for the checker; it is unchecked and type-erased at runtime like typing.cast. It is most useful for landing any values from walker reports or JSON into concrete types such as result.reports[0] as list[TweetView].

Does Jac support generics and type parameters?▼

Yes, Jac supports declared type params like obj Result[T, E = Exception] and def first[T](items: list[T]) -> T. However, type-param defaults do not apply at subscripted construction, and the checker treats T opaquely, so cast results back to concrete types.

Should I use Optional or Union types in Jac annotations?▼

No, use Jac-native syntax instead: write X | None instead of Optional[X] and X | Y instead of Union[X, Y]. Lowercase built-ins like list[X] and dict[K, V] replace List and Dict, and the any keyword replaces typing.Any.

Why does my Jac code fail with E1032 Type is Unknown?▼

E1032 means type inference failed, often from an unresolved import or a Self return type, which the current checker resolves to Unknown. Add an explicit annotation or return the concrete archetype name instead of Self.

When should I use import type instead of import in Jac?▼

Use import type to break circular imports between modules whose types reference each other, since it compiles to a TYPE_CHECKING-guarded import. Do not use it for names you construct, isinstance-check, or use in has field types, as those need runtime resolution.