at-language-expert
Essential procedural knowledge and constraints for writing, debugging, and understanding the `at` programming language.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Essential procedural knowledge and constraints for writing, debugging, and understanding the `at` programming language.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | at-language-expert |
| description | Essential procedural knowledge and constraints for writing, debugging, and understanding the `at` programming language. |
at Language Agent SkillThis skill provides the mandatory procedural knowledge required to successfully write and debug at code. at is a fast, strictly-typed language built specifically for AI agents.
at is designed around what makes agents succeed, informed by A Language For Agents:
at uses { } delimiters, not significant whitespace. This avoids the token-efficiency and surgical-edit problems that LLMs have with indentation-sensitive languages.Result<T, E> and ? propagation. try/catch/finally exists as an escape hatch but Result is the idiomatic error-handling pattern. Agents should default to returning Result types.needs { ... } blocks. This makes mocking trivial in tests and gives agents clear signals about what a function touches.import "x" as y;). Every symbol use is prefixed with its module name (like Go's context.Context), making code searchable with basic tools like grep or sed.at has no macro system. Code generation is unnecessary when the cost of writing code is low.using time.fixed; using rand.seeded;), eliminating flakiness by design.at check type-checks and lints in one pass. Code either passes or fails — there is no "compiles but has type errors" state. at test runs all tests. Two commands, zero ambiguity.fn name() -> type {.import "./utils.at" as utils;). There are no global imports, no re-exports.needs { ... } block.let x = 5; instead of let x: int = 5; to save tokens.set: Variables are immutable by default. Use set x = newValue; to mutate (not let mut).;., (not newlines).Result over try/catch: Use Result<T, E> and ? for error handling. Avoid try/catch unless wrapping FFI or legacy code.let immutable = 10;
let mutable = 20;
set mutable = 30; // `set` for mutation, not `let mut`
// Type inference handles these automatically
let array = [1, 2, 3];
let empty = []; // empty array literal
let m = map {}; // empty map literal
let m2 = map { "key": "value" };
Tests are colocated and execute at highly-optimized speeds with at test.
fn add(a: int, b: int) -> int {
return a + b;
}
test "adds numbers" {
assert(add(1, 2) == 3);
}
if a > b {
// ...
} else {
// ...
}
for item in array {
// ...
}
while condition {
// ...
}
Use Result<T, E> and ? for early returns. This is the idiomatic pattern — agents should default to this over try/catch.
fn divide(a: int, b: int) -> Result<int, string> {
if b == 0 {
return Err("Division by zero");
}
return Ok(a / b);
}
fn calculate() -> Result<int, string> {
let result = divide(10, 2)?;
return Ok(result + 1);
}
enum Shape {
Circle(float),
Rect(float, float), // multi-field variants supported
Point, // no-payload variant
}
fn area(s: Shape) -> float {
return match s {
Shape::Circle(r) => 3.14159 * r * r,
Shape::Rect(w, h) => w * h,
Shape::Point => 0.0,
};
}
map, filter, and reduce are compiler-inlined (not regular builtins):
let nums = [1, 2, 3, 4, 5];
let doubled = map(nums, |x| x * 2);
let evens = filter(nums, |x| x % 2 == 0);
let total = reduce(nums, 0, |acc, x| acc + x);
print(value), assert(condition), assert_eq(a, b), len(collection), type_of(value)
abs(n), min(a, b), max(a, b), floor(f), ceil(f), round(f), pow(base, exp), sqrt(f), sum(array)
contains(haystack, needle) (works on arrays and strings), slice(arr, start, end), split(str, delim), trim(str), to_upper(str), to_lower(str), substring(str, start, end), join(array, sep), replace(str, old, new), starts_with(str, prefix), ends_with(str, suffix), repeat(str, n), parse_int(str), parse_float(str), to_string(value)
char_code(str), from_char_code(n), is_digit(str), is_alpha(str), is_upper(str), is_lower(str)
append(arr, value), sort(arr), reverse(arr), index_of(arr, value), count(arr, value), range(start, end)
keys(map), values(map)
regex_match(str, pattern) -> bool, regex_find(str, pattern) -> array<string>, regex_replace(str, pattern, replacement) -> string
Note: Use {{ to escape literal { in regex patterns inside string literals (e.g., "[0-9]{{3}}" for the regex [0-9]{3}).
some(v), none(), is_some(opt), is_none(opt), ok(v), err(v), is_ok(res), is_err(res)
Agents execute in a secure sandbox. You cannot perform side-effects without declaring them statically.
needs { network, fs } // MUST be declared if you fetch or read files
import "std/http.at" as http;
fn fetch_data() -> Result<string, string> {
return http.get("https://example.com");
}
For test determinism, declare deterministic environments:
using time.fixed;
using rand.seeded;
Before modifying or generating at code, verify:
set x = value; to mutate, not let mut.Result<T, E> and ?, not try/catch.import "x" as y;)needs { ... } at the top of the file if accessing external systems?test "name" { assert(...); } blocks for your functions?let x = ...?;.,.int and float can be mixed freely (int is promoted to float).As an agent, you can use these tools to iteratively validate your code:
at check - Type-check and lint in one pass (instant, catches all errors before runtime)at test <file|dir> - Run tests in a file or recursively in a directory (aggressively cached, very fast feedback loop)at run <file> - Execute a scriptat fix - Auto-formats code and fixes lintsThese are things at intentionally does not support or has not yet implemented:
Rc-shared). set creates new copies.print. No read_line, no file I/O builtins (would require fs capability and corresponding builtins which do not exist yet).option (some/none) instead.return keyword (though block expressions have implicit tail values).max_frames limit exists for sandboxed execution.{expr}. Use {{ to write a literal { in strings (relevant for regex patterns with quantifiers like {3}).