machinajs
v1.4.2
Published
Machina.js — JavaScript/TypeScript operations as fluent, English-like sentences, for AIs and humans alike
Downloads
7,201
Maintainers
Readme
Machina.js
Machina.js - The coding language designed exclusive for AI

Machina.js is a Javascript / Typescript library for AI Language Framework designed exclusively to make it easier for LLMs to produce, understand, and maintain accurate code. It is a collection of packages that provide a set of functions and classes that can be used to perform common tasks without the human coding complexity. The framework is (ironically) written in near English structure, and is optimized for LLMs trained in both coding and natural human language.
Installation
tl;dr;
npm install machinajs
npx machinajs init # wires AGENTS.md/CLAUDE.md pointers, the Claude Code
# migration skill, and the ESLint enforcement layerThen follow instructions in the sections below to use individual packages. However, this library is expected to be read and used by LLMs, so it's best to simply use this library with specialized agents that are designed to read and understand this library.
Claude Code plugin
This repository is a Claude Code plugin marketplace. Install the Machina skills once and they are available in every session:
claude plugin marketplace add create-flow-ai/machina
claude plugin install machina@machinaThat gives you two commands:
/machina-init— wire the current repository for Machina: install the package, add the AGENTS.md/CLAUDE.md instructions, turn on the ESLint enforcement layer, and report how much existing code could become Machina sentences./machina-migrate— run the guided migration: scan, plan, and convert native JS/TS to Machina's English sentences one family at a time, with tests between batches.
(npx machinajs init installs the same two skills into the project's
.claude/skills/ instead — checked into the repo, so every collaborator and
CI session gets them without installing the plugin. Codex CLI users are
covered by the AGENTS.md block that init writes.)
The migration knowledge itself lives in
docs/MIGRATION.md — the canonical native→Machina
mapping guide, written for AI agents, shipped inside the npm package at
node_modules/machinajs/docs/MIGRATION.md.
Philosophy & Contributing
Read docs/philosophy.md before adding or changing code — it defines what this library is and the rules for extending it. New vocabulary is discovered through discourse experiments — whole programs written in Machina sentences whose gaps become the backlog.
Packages
Math Package
Arithmetic (+ - * / %), rounding, powers, logarithms, trigonometry, aggregates, and random numbers in an English-like form.
Sort Package
Sorts and arranges arrays — by number, text, natural/case-insensitive order, dates, or an object attribute — in an English-like form.
Array Package
Array questions (some/every/find), transforms (map/filter/forEach), positions (indexOf/findIndex), slicing, splicing, joining, flattening, filling, combining, reversing, counting, and end operations (push/pop/shift/unshift) in an English-like form.
Containment Package
Containment checks for both arrays and strings (includes) under one does(...) entry.
Dates Package
Reads and writes Date components, moves dates by durations, measures the time between dates, compares them, finds calendar boundaries, and describes how long ago a date was ('3 days ago') — all in an English-like form.
Web Package
Browser APIs in an English-like form — HTTP requests (fetch), geolocation, localStorage/sessionStorage, and the clipboard.
Timer Package
Schedules and cancels work with setTimeout / setInterval in an English-like form.
Promise Package
Waits for many promises at once (Promise.all / Promise.race / Promise.allSettled / Promise.any) as English wait sentences.
URL Package
Encodes text so it is safe to drop inside a URL (encodeURIComponent).
Set Package
Adds, checks, and removes values in a Set in an English-like form.
Map Package
Gets, sets, checks, and removes entries in a Map in an English-like form.
JSON Package
Converts values to and from JSON text (JSON.stringify / JSON.parse) in an English-like form.
Object Package
Lists keys/values/entries, copies properties, freezes/seals, and defines properties via the native Object.* statics in an English-like form.
Text Package
Case, slicing, search, replace, split, padding, length, and other String operations in an English-like form.
Pattern Package
Builds regular expressions (the RegExp constructor) as English sentences that plug directly into native methods and the Text package.
Number Package
Parses, formats, and tests numbers (parseInt/parseFloat/toFixed/isInteger/isNaN) in an English-like form.
Comparison Package
Compares values (>, <, ===, type and membership checks) as English yes/no questions.
Conditional Package
Expresses if / else if / else branching (with AND/OR conditions) in an English-like form.
Loop Package
Repeats work — for, while, do…while — as English repetition sentences.
Attempt Package
Recovers from failures — try/catch/finally and Promise.catch/finally — in an English-like form.
Console Package
Prints, asserts, counts, times, and tabulates via console.* in an English-like form.
Function Package
Wraps function utilities with no native equivalent — throttle, debounce, run-once, and memoization — in an English-like form.
Utilities with no native JavaScript counterpart (chunking, deep equality, object deep paths, clamping, case conversion, number ranges, …) live inside the feature packages above — arrays, comparisons, objects, numbers, text, and math — and delegate to the installed lodash dependency under the hood. Packages are named for what they do, never for the library that implements them.
(c) 2025 Create Flow, Inc. All rights reserved.
