jac-core-cheatsheet

Reference Jac language syntax for imports, control flow, match statements, lambdas, and error handling.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/PMN123/trapdoor --skill jac-core-cheatsheet-pmn123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jac-core-cheatsheet
Source: https://github.com/PMN123/trapdoor/tree/main/.agents/skills/jac-core-cheatsheet
Command: npx skills add https://github.com/PMN123/trapdoor --skill jac-core-cheatsheet-pmn123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Jac code requires knowing its strict typing rules, Python-flavored but brace-delimited syntax, and non-obvious pitfalls like indentation-sensitive match statements and reserved keywords. This Skill provides a baseline syntax reference so you avoid common parse and type errors when writing or reviewing Jac code. ## Core Features & Use Cases - Core Syntax Reference: Covers imports, control flow, match statements, enums, lambdas, glob declarations, entry points, null-safe operators, string formatting, and error handling with runnable code examples. - Pitfall Catalog: Documents concrete failure modes such as brace imports taking no semicolon, the missing pass statement, capitalized True/False/None, reserved keyword escaping, and unused-name warnings (W2003). - Import Semantics: Explains project-root absolute imports versus dotted relative imports, client/server codespace inference, and with entry versus with entry:__main__ behavior. - Use Case: When jac check fails with E0001 on a match statement, consult this Skill to learn that case arms require a colon and indented body rather than braces. ## Quick Start Ask the AI to load the jac-core-cheatsheet skill and explain how to write a typed lambda with a match statement in Jac.

Frequently Asked Questions about jac-core-cheatsheet

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

FAQPage Schema
How do I write a match statement in Jac?

Jac match statements use colon plus indented case bodies, not braces. Write `case 0:` followed by an indented block; guards like `case int() as n if n < 0:` and destructuring patterns for lists, dicts, and classes are supported.

How do Jac imports work compared to Python?

Jac supports `import os;` with a semicolon, selective `import from math { pi }` with no semicolon, and project-root absolute imports like `import from engine.math.vec3 { Vec3 }` that resolve from any depth. Dotted relative imports are mainly for client code resolved by the bundler.

Why does my Jac code fail with E0001 on a match case?

E0001 occurs because `case` arms require a colon and indented body, not braces. Writing `case 0 { ... }` is a parse error; match is the one indentation-sensitive construct in an otherwise brace-delimited language.

Can I use Python reserved words as variable names in Jac?

Python reserved words cannot name `has` fields or parameters even when backtick-escaped, failing with E0067. Jac-only keywords like `visit` or `node` can be escaped with a single leading backtick, such as `` `visit ``.

What are common Jac syntax pitfalls for Python developers?

Common pitfalls include lowercase `false` (use `False`), missing `pass` statement (use empty braces `{}`), C-style ternaries (use `A if cond else B`), and `&&`/`||` operators (use `and`/`or`). Python stdlib modules also require explicit imports.