writing-bend
Skill2 starsChanged 4 months agoMITView on GitHub
Write, test, prove, package or review Bend 2 code using the project's actual compiler. Covers affine types, structural recursion, exact arithmetic, generated JavaScript and native embedding. Use for Bend source and runtime work, not merely invoking an existing Bend executable.
In this repository27 other files it gives its agents.
- capture-collaboration-evidenceSkill
- clarify-before-buildingSkill
- cross-platform-project-build-archSkill
- deep-code-reviewSkill
- dispatchSkill
- erect-agent-stackSkill
- fix-zig-deps-hashSkill
- gather-project-intentionsSkill
- handoffSkill
- i18nSkill
- lean4-developmentSkill
- llvm-guided-optimizationSkill
- mechatron-ciSkill
- memoriesSkill
- mficSkill
- no-ai-slopSkill
- onboardSkill
- performance-profilingSkill
- planning-workSkill
- scaffold-zig-projectSkill
- shipSkill
- test-isolationSkill
- universal-app-frontendSkill
- walking-decisionsSkill
- writing-nixSkill
- writing-rocSkill
- zig-microbenchmarksSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use the installed compiler's language, not remembered Bend 1/HVM syntax.
- Very specific: line 17
Read project intent, the compiler pin and existing build/test scripts.
- Very specific: line 20
Do not run a network installer or bend update to make an example work.
- Distinctive: line 24
Do not patch the compiler, weaken laws, add unsafe recursion or reduce a required test matrix to get a port through.
- Distinctive: line 51
Keep that boundary explicit and use the hybrid workflow to distinguish Bend model proofs from evidence about the foreign implementation.
- Distinctive: line 63
Use independent expected results, then compare the pure implementation, generated JS, native core and public CLI/FFI as applicable.
- Distinctive: line 67
Use the existing shared CLI suite without reducing another backend's matrix.
- Distinctive: line 72
Never describe a few layout or endpoint laws as a proof of the whole algorithm.
- Distinctive: line 82
Keep verified lessons, sources and compiler versions together.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Writing Bend
Use the installed compiler's language, not remembered Bend 1/HVM syntax.
This skill records experience with Bend 2.0.37, upstream revision
4ff8545f19b09b7d2b8ca2303668100eac8efd66, checked on 2026-10-21.
Newer documentation is a discovery aid, not evidence that a pinned project
supports a feature. These lessons are not a claim that every Bend release has
the same representation, ABI or limitations.
Establish the toolchain
Read project intent, the compiler pin and existing build/test scripts. Obtain
the compiler through the project environment; run bend version, bend --help,
bend guide and the relevant bend base NAME. Check command exit statuses.
Do not run a network installer or bend update to make an example work.
Build project artifacts through nix build, invoking Bend/backend compilation
inside derivations. Follow cross-platform-project-build-arch; the pinned
devShell supports inspection/debugging, not an optional direct-build backend.
Do not patch the compiler, weaken laws, add unsafe recursion or reduce a
required test matrix to get a port through.
Route detail by the actual task:
- Language and exact arithmetic for syntax, ownership, recursion, numeric domains, arrays and large lookup tables.
- Proofs and verification for laws, the separate verdict kernel, mutation controls and the boundary of a correctness claim.
- Interop and packaging for pure effect programs, generated-JS identity, native C embedding and Nix artifacts.
- Measured implementation lessons when choosing an algorithm, interpreting performance or diagnosing statistical parity.
- Primary sources and version evidence when checking upstream behavior or changing a compiler pin.
Pure core and explicit foreign boundaries
For an independent Bend implementation, represent state transitions, validation, arithmetic, sampling and canonical output models as pure Bend functions. Return explicit errors and state after the last completed effect. An I/O edge can parse argv, obtain entropy, service byte requests, render a canonical model to terminal protocols and write buffers. Calling another language's numerical implementation from a host wrapper is not an independent Bend implementation.
An intentional mixed-language application can instead use Zig hot kernels. Keep that boundary explicit and use the hybrid workflow to distinguish Bend model proofs from evidence about the foreign implementation.
Choose reusable data deliberately. is Data permits copying; is Type retains
affine ownership. A closure cannot be reused merely because its captures are
copyable. Mark reusable binders with + only when their types permit it; erased
- parameters do not carry runtime data. Explicit ownership often reveals an
architectural mismatch that extra annotations cannot repair.
Verify separate boundaries
Use independent expected results, then compare the pure implementation, generated JS, native core and public CLI/FFI as applicable. Exact numerical ports need exact intermediates, error precedence, state/cursor consumption, failure prefixes and boundary cases, not just close-looking decimal output. Use the existing shared CLI suite without reducing another backend's matrix.
Compilation, ordinary proof checking, kernel verdict, runtime tests and statistical evidence are different receipts. State which were actually run. Backend execution and foreign/runtime code remain separate trust boundaries. Never describe a few layout or endpoint laws as a proof of the whole algorithm.
The examples include a pure limb model, separate laws, proofs, a native I/O entrypoint and an independent JS consumer. The reproduction commands and their measured verification scope are in sources.md.
Updating this skill
Keep verified lessons, sources and compiler versions together. Reproduce a new trap before generalizing it. Correct an obsolete version-specific rule instead of accumulating incompatible prescriptions. Keep large source/runtime copies out of the skill; link official sources and retain small tested examples.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

