Index of every page on this site: llms.txt
All skills
chelis-lang avatar

/example-corpus

@f7af876
Run it yourself

Use when adding, moving, or validating Chelis example programs, and before writing any Surf (`.ch`) source, including fixtures and probes. Carries the Surf style rules, the parse-breaking spellings, and the Deep AST contract; preserves the executable-vs-illustrative split and keeps example-related tests honest.

  • 1 file
  • 6.3 KB
  • Updated 2 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/chelis-lang/chelis/example-corpus

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈82 tokens for metadata: the name and description. ≈1.5k when used: this file.

Description uses 4.1% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈329 characters, or 4.1%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Example Corpus

Use this skill whenever touching examples/ or tests/docs that reference examples.

Policy

  • examples/ is the executable corpus.
  • examples/illustrative/ is for syntax/design examples that are not on the executable phase path.
  • Make this split explicit early in the phase instead of retrofitting it after examples have already been used as proof.

Rules

  • If an example is used as phase proof, it belongs in examples/.
  • If it intentionally uses unsupported or future-phase constructs, move it to examples/illustrative/.
  • Update tests when moving examples so executable-corpus tests do not silently become parse-only.

Verification

For executable examples:

  • parse succeeds
  • chelis fmt --inplace preserves validity
  • chelis check returns score 1.0 with no errors

For illustrative examples:

  • parsing/round-trip expectations may still apply
  • docs and tests must not imply they are executable phase proof

Writing Surf

These rules apply to every .ch you write in this repository: examples, fixtures, and probes alike. The authority is spec/02-surf-syntax.md §0.1 (canonical forms and the bidirectional contract); §P10-P12 define the wider set of input spellings the parser still accepts but the formatter rewrites. spec/01-nomenclature.md is the rule spec behind chelis lint, and crates/chelis-lint/src/rules/ is its executable enforcement; the canonical formatter is chelis_surf::format for .ch and chelis_deep::printer for .dp. Run chelis fmt --inplace <file> and chelis lint --check before pushing.

Spellings that are hard errors, not style:

  • A nullary definition needs (): def name() -> T, not def name -> T. This is the highest-frequency breakage; expect it on any branch predating chelis#1031 (expected function parameter list (), found Arrow).
  • Applying a returned value needs explicit grouping: (f(x))(y). Ungrouped f(x)(y) is rejected; Chelis has flat multi-argument application and no implicit currying, and juxtaposition stays rejected.
  • The unit value is (), the unit type is unit, and a singleton tuple is (x,); that comma is semantic.
  • Effects carry exact casing: Diff, Accum, IO, Test, Resource(...).
  • Randomness has no effect and no handler: a draw takes an explicit key, dropout(key_from_seed(42i64), x, 0.5f32). with seed(...) and ! { Random } are the typed RetiredRandomness parse error.
  • Non-primary transform arguments are named: grad(f, wrt=x), vmap(f, axis=n); axis zero is bare vmap(f).
  • sum, cumsum, trace, and einsum over i8 or i16 return i32 (spec/04 §5.7.1); declare the result as i32, pass accumulator=i64 to sum or einsum, or narrow it with an explicit cast.
  • Pipe stages use first-argument insertion: x |> f(y) means f(x, y). Use x |> (fn (v) -> f(y, v)) when the piped value belongs in a later position.

Style the lint rules enforce:

  • prefer def ... -> T = ... over def ... : T = ... (surf-def-arrow-form, §3.5)
  • type identifiers are PascalCase (surf-type-pascal-case, §3.1); function/value identifiers are snake_case (surf-value-snake-case, §3.2)
  • functions carrying the Test effect are named test_* or example_* (surf-test-name-prefix, §10.1)
  • zero-arity decoration is dropped in types and kept in expressions: Ctor() is a Deep app, bare Ctor is a Deep var, and a zero-field record keeps {}. ! {} is a declared-pure upper bound, distinct from an omitted effect clause.
  • canonical output omits trailing separators and prints the canonical literal spelling (shortest round-trippable float, no digit separators or redundant zeroes)

Style the formatter does not enforce:

  • put types on function parameters, not on load-style top-level bindings
  • use symbolic dimensions such as batch and seq for runtime-varying axes; keep fixed architecture dimensions concrete
  • do not annotate intermediate expressions when inference already determines the type; keep meaningful intermediates like h1, logits, probs, and loss
  • combine short tensor operations when the composed expression is clearer than over-decomposed single-op bindings
  • treat decompiler-generated verbose load chains and checker-inserted ascriptions as debug output, not example style
  • user code typically writes neither explicit & nor explicit copy() for fan-out into read-only primitives; auto-borrow handles it. Write &x when an exported API or dense signature benefits from clarity, and copy(x) only when forking ownership for downstream consumption. Existing fixtures and migration baselines may keep explicit copy() or drop() calls when they prove compatibility or preserve baseline evidence.
  • lowered IR carries compiler-inserted Copy and Drop nodes for implicit linearity. If auto-copy/auto-drop produces unexpected IR, treat it as a structural blocker and escalate against spec/design/implicit_linearity.md rather than papering over it as a routine fixture bug.

Deep AST

  • Every Deep node is a 3-tuple: (tag {} children...), with the metadata map always present at element 1. The vocabulary is a closed set of 62 tags; see spec/03-deep-syntax.md. Function application is app, names are var, literals are lit, and RISC primitives are built-in functions, not tags.
  • Decompilation routes through a typed Deep-to-Surf resugaring boundary (chelis#1031) with a total disposition for every public Deep tag, printed by the shared Surf printer. It fails closed on malformed Deep, invalid surface identifiers, unknown surf_* metadata, incompatible literal metadata, and non-finite constructed values; a resugaring failure is a real defect, not output to work around. Canonical Deep and canonical Surf are two representations of one public language, bound by the three executable laws in spec/02-surf-syntax.md §0.1 (desugar(resugar(·)), formatter idempotence, and the semantic retraction). If you change either printer or the desugarer, those laws are the oracle.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at f7af876. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 2 months ago

README badge

README badge for chelis-lang/chelis/example-corpus