AI SummaryRead it before changing a file. It is a map of the language and its build, not a replacement for the two reference documents: declarations, and the binding index.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to install the "cicili" skill in my project. Please run this command in my terminal: # Install skill into your project mkdir -p .claude/skills/cicili && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/cicili/SKILL.md "https://raw.githubusercontent.com/saman-pasha/cicili/master/SKILL.md" Then restart Claude Code (or reload the window in Cursor) so the skill is picked up.
Description
Use when writing, reading, debugging, reviewing, or porting Cicili code (C/C++ in S-expressions), including its clauses, macros, targets, type descriptors, ownership, standard library, and C/C++ bindings. Start here and follow the linked reference docs for exact emitted C.
SKILL — working in Cicili
This file is for every agent that writes, reads, debugs, or reviews Cicili code. Read it before changing a .cicili file. It is a map of the language and its build, not a replacement for the two reference documents: • doc/DOC-C.md — the complete C core, clause by clause, with the generated C. • doc/DOC-CPP.md — the C++ additions; read DOC-C first. • lib/README.md — the standard library, the C/POSIX declarations, and the binding index. • CLAUDE.md — the repository's build and change rules. When this summary and the docs disagree, the docs are the reference and the generated C is the ground truth. Version at the time of writing: 3.2.0. ---
1. The one-sentence model
Cicili is C in S-expressions: a form is a list whose head decides its meaning. A known clause head (func, let, struct, if, …) emits C; a head that is not a clause is an ordinary function call. Common Lisp macros run at compile time and emit more Cicili forms. The result is compiled by the configured C/C++ compiler. ` your.cicili → reader → forms → specify (types) → macro expansion → generated C → C compiler → object/link ` There is no runtime and no garbage collector. A Cicili program is a C program; ownership, defer, and standard-library cells are compile-time and C-level mechanisms. ---
2. Invocation and targets
A .cicili file contains one or more targets: `cicili (source "hello.c" (make :std #t :compile #t :link #t) (main (printf "hello\n") (return 0))) (header "thing.h" () (guard THING_H (struct Thing (member int value)))) ` • source PATH FEATURES BODY… writes, compiles, and optionally links PATH. • header PATH FEATURES BODY… writes a header; it is never compiled by the target itself. • (make :std #t :compile #t :link #t) is the usual feature macro. A raw feature list may also be written: (:std #t :compile #t :link #t). • :std #t emits the standard C includes; with :cpp #t it emits <string> and <iostream> instead. • :cpp #t selects the C++ compiler and enables the C++ clauses. • :compile defaults to -c TARGET; a custom value must contain -c or --compile. :link has no default and runs only after a successful compile listed before it. • {$CWD} and {$CCL} are substituted in :compile/:link arguments. • main and main* are macros for the two usual C main shapes. Build: `sh sbcl --script cicili.lisp FILE.cicili # debug (-g -O0) sbcl --script cicili.lisp --release FILE.cicili # release (-O3) sbcl --script cicili.lisp --version # bare version on stdout ` Useful flags: --debug, --macroexpand, --macros, --separate, --only-link, --syslog, --info/--warn/--debug/--no-debug. After changing the compiler or standard library, run the whole suite: `sh sh test/run.sh # must end red: 0 ` ---
3. The reading rules that prevent most mistakes
• A type is one token. Write size_t, ubyte_t, Employee, or a typedef. (cast unsigned char x) is invalid; use a typedef or mask. • Pointer casts are parenthesised: (cast (void **) p), (cast (ubyte_t ) p). A return type is (out T ), not (out (T *)). • Initializer markers: . value is an atom, .' { … } is a brace list, .#' ( … ) is an expression, .'(lambda …) is a lambda value. • Arrays at most two dimensions. [], [N], [N][M]; no more. • let declares locals; block does not. A declaration inside block is not a binding. • nth is index-first: (nth i array) is array[i]. • Member access: ($ obj member) is obj.member and chains; (-> ptr member) is ptr->member; (=> obj member args…) calls a function stored in a member. • Bitwise operators are words: bitand, bitor, xor; break and continue are bare symbols. • for takes a binding list, a test, a parenthesised list of steps: (for ((int i . 0)) (< i n) ((++ i)) body). • if branches are exactly one form each; use block for several. cond, while, for, do, and switch bodies may hold several. • do's last form is the condition, not a body statement. • switch does not insert break. Cases fall through exactly as in C. • Strings are raw C strings. "\n" reaches C as backslash-n. A literal may not contain a real newline or end in a backslash. • A float literal is a C double, all its digits. A macro computing a float must use a double (sqrt 2.0, not sqrt 2). • #\Space, #\Newline, #\Null, … are character literals; an arbitrary character is written as itself (#\A). • A macro must emit one form unless it expands with ($$$ …) to splice several. A macro is read with case preserved; Lisp forms in macro files are conventionally uppercase. • #define is invisible to Cicili. Constants from headers are declared as (typedef int NAME); a number you need in a form should be written out or exposed through a binding. (@define (code "NAME C-TEXT")) is the escape for a C typedef/constant that Cicili cannot spell. • nil is C NULL. Prefer nil in Cicili forms.
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster