Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nasal-library-base

БесплатноБез исполняемых скриптовНе проверен

Explains the Nasal base libraries, including `clipboard`, `math`, `string`, `utf8`, built-in constants, and some built-in functions.

container32от container32588 установок в других каталогах

Об этом скилле

Base Libraries (clipboard, math, string, utf8)

Nasal provides robust, low-level libraries to interact with system buffers, compute complex mathematical and trigonometric equations, analyze character attributes, and handle byte-level or UTF-8 multi-byte string manipulations.

Clipboard Access (clipboard)

The clipboard library facilitates interacting with the host system's primary copy-paste buffers.

Buffer Selection Constants

  • clipboard.CLIPBOARD: The standard, system-wide copy-paste buffer.
  • clipboard.SELECTION: The X11 system selection buffer (typically populated by highlighting text in Linux/Unix environments).

Functions

  • clipboard.getText([type]): Retrieves the current string content of the specified buffer type (defaults to clipboard.CLIPBOARD).
  • clipboard.setText(text[, type]): Places a string into the designated clipboard buffer. Returns 1 on success, or 0 if the operation fails.

Mathematics (math and constants)

The math library wraps standard C mathematical utilities, adding array-processing helpers and normalization tools.

Constants

  • math.pi: Value of $\pi$ ($\approx 3.141592653589793$)
  • math.e: Value of $e$ ($\approx 2.718281828459045$)

Core Arithmetic & Rounding

  • math.abs(x): Returns the absolute value $\vert{}x\vert{}$.
  • math.sgn(x): Signum function. Returns -1 if $x < 0$, 0 if $x = 0$, or 1 if $x > 0$.
  • math.ceil(x): Returns the ceiling of $x$ (smallest integer $\ge x$).
  • math.floor(x): Returns the floor of $x$ (largest integer $\le x$).
  • math.round(x[, p]): Rounds $x$ to the nearest precision step $p$ (defaults to 1). If the fractional part is exactly 0.5, it rounds up.
  • math.clamp(x, min, max): Restricts $x$ to be within the inclusive range $[\text{min}, \text{max}]$.
  • math.periodic(min, max, x): Normalizes $x$ to fit within a continuous periodic domain defined by $[\text{min}, \text{max})$. Excellent for heading/bearing loops.
# Compass heading wrap-around (0 to 360)
var raw_heading = -45;
var norm_heading = math.periodic(0, 360, raw_heading); # 315

# Rounding to nearest step
print(math.round(127, 10)); # 130
print(math.round(4.5)); # 5

Trigonometry (Angles in Radians)

  • math.sin(x): Sine of $x$.
  • math.cos(x): Cosine of $x$.
  • math.tan(x): Tangent of $x$.
  • math.asin(x): Arcsine of $x$, returns angle in $[-\frac{\pi}{2}, \frac{\pi}{2}]$.
  • math.acos(x): Arccosine of $x$, returns angle in $[0, \pi]$.
  • math.atan2(y, x): Two-argument arctangent returning the quadrant-accurate angle in radians $[-\pi, \pi]$.
print(math.tan(60 * D2R)); # 1.732

Exponents, Logarithms & Roots

  • math.pow(b, n): Returns base $b$ raised to the power of $n$ ($b^n$).
  • math.sqrt(x): Returns the square root of $x$ ($\sqrt{x}$).
  • math.exp(x): Returns $e^x$.
  • math.ln(x): Returns the natural logarithm of $x$ ($\ln x$).
  • math.log10(x): Base-10 logarithm of $x$ ($\log_{10} x$).

Multi-Argument Utilities

  • math.min(x, y, ...): Returns the lowest numeric argument.
  • math.max(x, y, ...): Returns the highest numeric argument.
  • math.avg(x, y, ...): Returns the mathematical average of all provided numbers.
  • math.fmod(x, y): Remainder of $x/y$ preserving mathematical correctness for negative dividends using C’s standard fmod.
  • math.mod(x, y): Simpler modulo calculation. Note: Yields mathematically incorrect values when handling negative operands.

Built-in Constants

  • D2R: degrees to radians (= π / 180)
  • FPS2KT: ft/s to knots (~ 0.5925)
  • FT2M: feet to metres (= 0.3048)
  • GAL2L: US gallons to litres (~ 3.7854)
  • IN2M: inches to metres (= 0.0254)
  • KG2LB: kg to pounds (~ 2.2046)
  • KT2FPS: knots to ft/s (~ 1.6878)
  • KT2MPS: knots to m/s (~ 0.5144)
  • L2GAL: litres to US gallons (~ 0.2642)
  • LB2KG: pounds to kg (~ 0.4536)
  • M2FT: metres to feet (~ 3.2808)
  • M2IN: metres to inches (~ 39.3701)
  • M2NM: metres to nautical miles (~ 0.00054)
  • MPS2KT: m/s to knots (~ 1.9438)
  • NM2M: nautical miles to metres (= 1852)
  • R2D: radians to degrees (= 180 / π)

Character & String Manipulation (string and utf8)

The string and utf8 libraries divide their capabilities between byte-level verification and high-level string formatters.

Character Type Classifiers (Evaluates Character Codes)

These functions analyze a single ASCII character code (number representing a byte) and return boolean $1$ or $0$:

Function Checks If ASCII Character Is...
string.isalnum() Alphanumeric (A-Z, a-z, 0-9)
string.isalpha() Alphabetic (A-Z, a-z)
string.isascii() Valid ASCII value ($0$ to $127$)
string.isblank() Space or horizontal tab (\t)
string.iscntrl() Control character ($1$ to $31$, or $127$)
string.isdigit() Decimal digit (0-9)
string.isgraph() Visible alphanumeric or punctuation (excludes whitespace)
`string.islo
Полный SKILL.md на ClawHub

Установить nasal-library-base в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл nasal-library-base?

Explains the Nasal base libraries, including `clipboard`, `math`, `string`, `utf8`, built-in constants, and some built-in functions.

Как установить скилл nasal-library-base?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nasal-library-base запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nasal-library-base с