Reference
Every package, element, command, method and variable, as the interpreter and the editor know them. This page is made from the same descriptions that kscript's editor support shows in hover and completion.
Packages
KScript.CoreThe language itself: variables, branches, loops, functions, errors, imports and echo. Always imported.KScript.TerminalPrompts, menus, colours, Markdown, and artisan-style labels, tasks and tables for terminal scripts.KScript.MathRoots, powers, trigonometry, logarithms, random numbers and statistics.KScript.IOFiles and folders: read, write, list, move, copy and delete.KScript.NetHTTP requests (@api) and downloads.KScript.MarkdownMarkdown to HTML, with front matter.KScript.WebWeb pages run by kscript serve: layouts, components and live blocks.KScript.StyleStylesheets written in KScript (.ks.css, .ks.scss, .ks.sass), with colour, size and responsive helpers.KScript.StorageApp folders for config, data, cache, state and logs, in the right place on each platform.KScript.DocumentPapers, reports, letters and invoices with LaTeX maths, saved as PDF, LaTeX, Word, Markdown or HTML without a TeX install.KScript.DataDatabases: models, a query builder, transactions and raw SQL, on SQLite, Postgres, MySQL and MariaDB.KScript.CacheA cache of values by key, with time limits: in memory, or in files in the app's cache folder.KScript.QueueQueued jobs: job declarations, dispatch, retries with backoff, failed jobs, the worker that runs them, and the schedule of tasks that run at set times.KScript.MailEmail: @send_mail over SMTP, to the log or to a fake, now or on a queue, with HTML, text or a view, and @fake_mail for tests.KScript.HttpRoutes, controllers and middleware: <KScript.Routes> files served by kscript serve.KScript.AuthSign-in for kscript serve apps: users, sessions, the auth and guest middleware, CSRF, password resets and API tokens.KScript.TestTests run by kscript test: <test>, <describe>, <expect>, <expect_error>, <capture> and @assert().KScript.UIDesktop windows with buttons, text, inputs and timers, on macOS, Windows and Linux.KScript.AILanguage models (Claude): @llm, @chat and <llm>.
Methods by type
string79 methods. Text. A string that holds a number can use number methods too.number26 methods. Whole and decimal numbers.bool9 methods. true and false.list72 methods. Lists such as
[1, 2, 3]. Methods that change a list return a new one.map30 methods. Maps such as { name: 'Joan', age: 82 }.date15 fields, 18 methods. Dates and times, from @now(), '2026-11-19'->to_date() or ->to_date().fn9 methods. Functions: lambdas fn(x) => $x * 2 and <fn> functions.any8 methods. Methods every value has.type3 fields, 11 methods. A <type> declared by a script, such as Repo.file12 fields, 19 methods. File values, from @file(), @files() and @folders().config15 methods. $config: settings from config files, .env files and the environment.logger2 fields, 20 methods. $log: structured logging.response8 fields, 10 methods. HTTP responses returned by @api($url) in KScript.Net.chat3 fields, 10 methods. Conversations with a language model, from @chat().http_response5 fields, 16 methods. Responses made by controllers and middleware: @response(), @view(), @redirect().base641 field, 21 methods. batch10 fields, 12 methods. cache2 fields, 22 methods. card2 fields, 9 methods. chain11 methods. cidr4 fields, 21 methods. color1 field, 28 methods. country4 fields, 20 methods. cron22 methods. csv1 field, 22 methods. currency3 fields, 21 methods. database4 fields, 16 methods. date_format4 fields, 22 methods. document2 fields, 15 methods. domain2 fields, 24 methods. duration5 fields, 25 methods. email2 fields, 24 methods. error7 fields, 10 methods. error_type5 fields, 8 methods. fake_llm10 methods. fake_mail14 methods. fake_queue14 methods. file_path5 fields, 24 methods. formatted_file2 fields, 12 methods. grouped_query13 methods. handle1 field, 20 methods. hex1 field, 22 methods. iban2 fields, 21 methods. ip3 fields, 22 methods. job10 methods. job_middleware2 fields, 8 methods. jwt4 fields, 20 methods. latex2 fields, 14 methods. locale4 fields, 22 methods. loopback_json_connection9 methods. loopback_json_stream10 methods. markdown2 fields, 14 methods. mime4 fields, 22 methods. model61 methods. money2 fields, 13 methods. money[]73 methods. page_visit4 fields, 14 methods. password14 methods. password_hash10 methods. phone2 fields, 21 methods. progress_bar3 fields, 9 methods. query58 methods. queue2 fields, 15 methods. random_generator13 methods. rate_limit14 methods. record45 methods. regex2 fields, 19 methods. request12 fields, 8 methods. semver4 fields, 24 methods. semver[]73 methods. session1 field, 17 methods. set34 methods. Sets such as ['tea', 'milk'] as set: each item once, with in, + and - that stay fast however big the set gets. Methods that change a set return a new one.slash_path5 fields, 26 methods. slug1 field, 23 methods. storage3 fields, 24 methods. timezone24 methods. url7 fields, 25 methods. users16 methods. uuid2 fields, 18 methods. Built-in variables
Variables that exist without being declared, such as $args: see Built-in variables.
Types, models, errors and settings
Built-in typesstring, int, date, email, url, money, duration and every other type you can declare.Error typesEvery error KScript throws, what it extends and the HTTP status it answers with.kscript.json settingsEvery project setting, its type and its default.Models and mixinsEvery built-in mixin, such as Timestamps, SoftDeletes and Ownable, and every option a model takes.Page directivesEvery @ directive for live pages and components, such as @on-click and @bind, with handler shorthands, modifiers and the fields of $event.VS CodeEvery command and setting of the KScript extension for VS Code, with their keys and defaults.Environment variablesEvery environment variable kscript reads, such as KSCRIPT_ENV and KSCRIPT_SECRET, with defaults and examples.A to ZEverything built in, in one list: statements and their options, commands, methods, types and settings.