Token导航 LogoToken导航TokenDH.com
开发只读clawhub未标认证来源可访问clear审计通过

js-literals-protocoljs 文字协议

Agent Skill

js-literals-protocol 用于补充开发相关能力,适合在 OpenClaw 中需要让 Agent 承接开发相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,318

周安装

173

GitHub Stars

公开资料未说明

下载量

1,398
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:js-literals-protocol(js 文字协议)
来源仓库:https://github.com/roryyu/js-literals-protocol
安装命令:
openclaw skills install js-literals-protocol
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install js-literals-protocol

简介

基于JavaScript字面量语法实现LLM工具调用协议,简化本地函数绑定。

  • 允许模板字面量直接调用JS函数,提升AI助手与本地环境交互效率。
  • 适用于需要混合AI推理与本地计算资源的复杂任务处理场景。
  • 安装命令:openclaw skills install js-literals-protocol,遵循协议规范编写调用语句。
  • 函数安全性需自行保证,避免执行不可信代码造成系统风险。

SKILL.md

name
js-literals-protocol
description
Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax.

JavaScript Literals Protocol Tool Skill

Overview

This skill establishes a new protocol for LLM to call tools using JavaScript's template literal syntax. It allows seamless integration between LLM prompts and local JavaScript functions through a tag function mechanism.

Protocol Definition

Core Concept

The protocol uses JavaScript template literals with tag functions to enable LLM to invoke local functions. This provides a natural, JavaScript-native way for LLMs to interact with tools.

Syntax Format

// Define variables
const var1 = value1;
const var2 = value2;

// Define tag function (tool)
function toolTag(strings, ...expressions) {
  // Process the strings and expressions
  // Return the result
}

// LLM invokes the tool using template literal syntax
const result = toolTag`Template ${var1} with ${var2} expressions`;

Usage Example

Basic Function Call

// Define variables
const person = "Mike";
const age = 28;

// Define a simple tool function
function describePerson(strings, personExp, ageExp) {
  const str0 = strings[0]; // "That " 
  const str1 = strings[1]; // " is a " 
  const str2 = strings[2]; // "." 
  
  const ageStr = ageExp > 99 ? "centenarian" : "youngster";
  
  return `${str0}${personExp}${str1}${ageStr}${str2}`;
}

// LLM invokes the tool
const output = describePerson`That ${person} is a ${age}.`;

console.log(output);
// Output: That Mike is a youngster.

Multi-Parameter Tool Call

// Define a calculation tool
function calculate(strings, ...nums) {
  const operation = strings.join(' ').trim();
  let result;
  
  if (operation.includes('add')) {
    result = nums.reduce((a, b) => a + b, 0);
  } else if (operation.includes('multiply')) {
    result = nums.reduce((a, b) => a * b, 1);
  }
  
  return `${operation} ${nums.join(', ')} = ${result}`;
}

// LLM invokes with multiple parameters
const sum = calculate`add ${5} ${3} ${7}`;
const product = calculate`multiply ${2} ${4} ${6}`;

console.log(sum);     // Output: add 5, 3, 7 = 15
console.log(product); // Output: multiply 2, 4, 6 = 48

Implementation Guidelines

For Developers Creating Tools

  1. Define tag functions that accept strings as the first parameter and variable expressions as rest parameters
  2. Process the template strings and expressions appropriately
  3. Return a result that provides meaningful feedback to the LLM

For LLMs Using the Protocol

  1. Use the template literal syntax with backticks
  2. Insert variables and expressions inside ${} placeholders
  3. Call the appropriate tag function as the prefix to the template literal

Benefits

  1. JavaScript Native: Uses existing JavaScript syntax that developers are familiar with
  2. Natural Integration: Seamlessly blends with JavaScript code
  3. Type Safety: Leverages JavaScript's type system
  4. Flexible: Supports multiple parameters and complex logic
  5. Readable: Provides clear, self-documenting tool calls

Limitations

  1. Requires JavaScript runtime environment
  2. Template literal syntax may need special handling in some LLM prompts
  3. Limited to JavaScript function capabilities

Example Workflow

  1. Developer defines local tool functions using tag function pattern
  2. LLM is instructed to use the JavaScript literals protocol
  3. LLM generates template literal calls to the defined tools
  4. System executes the tool calls and returns results to the LLM
  5. LLM continues interaction based on the results

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

91.1%
按下载量换算1,274

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills