AI skill file
Download nyra-skill.md — the complete Nyra reference for AI assistants: syntax, all built-in methods, ownership, PGO, escape analysis, FFI, Result/error-handling MVP rules, and toolchain.
This skill file is the authoritative reference for AI-assisted coding. Nyra ships async/await, ?, spawn, traits, and serde on Core + Stable Extended — prebuilt Linux, macOS, and Windows releases. Multi-trait dyn A + B ships on Stable Extended; a few exotic generic serde edge cases are still maturing. See Roadmap and status.md.
What’s inside nyra-skill.md
Single markdown file with fenced ```ny code blocks. Use it as the sole Nyra reference — do not invent syntax.
Compiler pipeline (how Nyra works)
Source (.ny) → parse → monomorph → auto-borrow → typecheck → borrow + lifetimes → escape analysis → drop plan → LLVM IR → opt → clang + Nyra runtime → binary
Early exit: nyra check . · Ownership snapshot: nyra inspect name --at main.ny:42 · Verbose escape report: nyra build --verbose . · Ownership inspect
Built-ins at a glance (no import)
| Category | API |
|---|---|
| I/O | print, write, println, flush, input, color: |
| Date | date() → .year, .month, .day, … |
| String | .len(), .split(), .trim(), .contains(), .replace(), … |
| Arrays | [1,2,3], .sort(), for x in arr, for i in 0..n |
| Timing | time_start / time_end, mem_start / mem_end |
| Net / HTTPS | get(url), fetch, post — auto-prelude; backend from nyra.mod tls |
| Concurrency | spawn { } (Extended) |
Full tables + examples: stdlib → Built-ins · examples/builtins/
Performance
nyra build --release .
nyra build --pgo . # profile-guided (host only)
nyra build --verbose . # escape analysis report
Details: PGO guide · Escape analysis · Performance toolchain
Result & error handling
With real Result payloads (enum Result_i32_i32 { Ok(i32), Err(i32) } or import "stdlib/option.ny"), use the ? operator for fallible steps or explicit match when you need custom control flow.
enum Result_i32_i32 { Ok(i32), Err(i32) }
fn main() {
let v1 = match Result_i32_i32.Ok(1) {
Result_i32_i32.Ok(x) => x
Result_i32_i32.Err(_e) => 0
}
let v2 = match Result_i32_i32.Ok(v1 + 1) {
Result_i32_i32.Ok(x) => x
Result_i32_i32.Err(_e) => 0
}
print(v2)
}
| Shipped (Stable Extended) | Still maturing |
|---|---|
Payload Ok / Err, ? operator, explicit match | Exotic generic serde edge cases |
Traits + dyn Trait and multi-trait dyn A + B | See status.md production gates |
tests/nyra/result_propagate_test.ny · nyra run examples/result_propagate_verbose.ny |
Production use: ready for CLI tools and servers on Core + Stable Extended. Full rules in nyra-skill.md § Enums & payloads · Conformance CONF-ADT-003.
How to use with AI tools
Cursor
Add to Project Rules or attach @nyra-skill.md / @webDocs/nyra-skill.md in chat. Repo copy: skills/skill.md (synced from this file).
ChatGPT / Claude
Upload to Project Knowledge or paste into Custom Instructions.
System prompt
Follow nyra-skill.md as the sole Nyra reference.
Use ```ny fenced blocks for Nyra code.
Do not invent syntax, enum payloads, or GC.
Nyra is production-ready on Core + Stable Extended (async, ?, spawn, traits, serde).Follow nyra-skill.md as the sole Nyra reference.
Use ```ny fenced blocks for Nyra code.
Do not invent syntax, enum payloads, or GC.
Nyra is production-ready on Core + Stable Extended (async, ?, spawn, traits, serde).