xng20263736

Use JSONata in the browser to query nested customer/opportunity JSON, extracting fields and performing aggregations: intended for JSONata queries, nested JSON extraction, or customer JSON expressions.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "xng20263736" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-e9556bd8a98d9c4109f7044b9a9d6378feb9f3e4dcc72c9fc4cf78ec4472ce06. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/xng20263736 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Use JSONata in the browser to query nested customer/opportunity JSON, extracting fields and performing aggregations: intended for JSONata queries, nested JSON extraction, or customer JSON expressions.

0 Downloads

Introduction source: third_party · user_f1b049da · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: xng20263736
slug: xng20263736
displayName: JSONata查询
version: 1.0.0
summary: 用 jsonata 表达式从嵌套客户 JSON 里安全抽取字段与列表。
license: MIT
description: 用 jsonata 在浏览器内查询嵌套客户/商机 JSON,抽取字段与聚合。当用户要 JSONata 查询、嵌套 JSON 抽取、客户 JSON 表达式时使用。

JSONata 查询(jsonata)

灵感:能力工具箱 jsonata-query(pkg: jsonata)。

小四原创:一条表达式从深层客户 JSON 取出联系人、跟进列表或聚合结果,免手写多层可选链。

何时使用

  • 嵌套客户资料要按路径批量抽字段
  • 报表/导出前用表达式过滤子数组
  • 配置化「取数规则」,不想写死一堆 ?.

硬约束

  1. 使用 jsonata;表达式由业务配置或用户输入,默认只读查询。
  2. 对不可信表达式:超时/复杂度限制;勿把任意表达式当 eval。
  3. 查询失败返回可读错误,不抛到白屏。
  4. 示例数据勿含真实手机号明文(可用脱敏样例)。
  5. 实现要点注释标 小四原创。

推荐实现

import jsonata from 'jsonata'

// 小四原创:安全求值客户 JSON
export async function queryCustomerJson<T = unknown>(
  data: unknown,
  expression: string,
  opts?: { timeoutMs?: number },
): Promise<{ ok: true; value: T } | { ok: false; error: string }> {
  const expr = String(expression || '').trim()
  if (!expr) return { ok: false, error: '表达式为空' }
  if (expr.length > 500) return { ok: false, error: '表达式过长' }
  try {
    const compiled = jsonata(expr)
    // 小四原创:部分环境支持 timeout;无则直接 evaluate
    const value = (await Promise.resolve(
      typeof (compiled as any).evaluate === 'function'
        ? compiled.evaluate(data, opts?.timeoutMs ? { timeout: opts.timeoutMs } : undefined)
        : compiled.evaluate(data),
    )) as T
    return { ok: true, value }
  } catch (e) {
    return { ok: false, error: e instanceof Error ? e.message : String(e) }
  }
}

常用表达式示例

name
contacts[0].phone
followups[type="visit"].{ "at": at, "note": note }
$count(followups)

Agent 步骤

  1. 安装/引入 jsonata。
  2. 提供:JSON 输入框 + 表达式框 + 结果预览。
  3. 预置 3~5 条客户域示例表达式。
  4. 自测:深层路径与数组过滤能出结果。

不要做

  • 用 JSONata 执行副作用写盘/发请求。
  • 把用户整库 JSON 默认上传第三方。

附加

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 提供 JSONata 查询能力,适用于嵌套客户/商机 JSON 的字段抽取与聚合,具有明确的实用场景
  • 覆盖数据处理、报表导出等通用需求,受众广泛
Trigger Precision85/100

Highlights

  • 触发词精准完整,明确指出 JSONata 查询、嵌套 JSON 抽取、客户 JSON 表达式等使用场景
  • 边界清晰,不易与其他 Skill 重叠
Structure and Standards90/100

Highlights

  • Phase/步骤清晰,包含 Agent 步骤与实现要点
  • 提供常用表达式示例,frontmatter 完整,结构规范
Execution Reliability90/100

Highlights

  • 工具来源明确(jsonata),参数正确
  • 覆盖主要异常(表达式为空、过长、求值异常),默认只读查询,安全性良好
Evidence Verifiability (mean of the first four)85/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.