yaml-config-convert

Use js-yaml in-browser to convert customer or business configuration between YAML and JSON, suitable for scenarios needing YAML↔JSON conversion, using the js-yaml library, or locally parsing configuration files.

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 "yaml-config-convert" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-5ad2f98bdcd13e72fc03ceaa0ca510be53f228c4c54a4fdd78219d44ff7cbcd4. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/orf20268855 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 js-yaml in-browser to convert customer or business configuration between YAML and JSON, suitable for scenarios needing YAML↔JSON conversion, using the js-yaml library, or locally parsing configuration files.

0 Downloads

Introduction source: third_party · user_f1b049da · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: yaml-config-convert
slug: orf20268855
displayName: YAML配置互转
version: 1.0.0
summary: 用 js-yaml 本地互转客户配置 YAML 与 JSON。
license: MIT
description: 用 js-yaml 在浏览器内把客户/业务配置在 YAML 与 JSON 之间互转。当用户需要 YAML 配置互转、js-yaml、YAML转JSON、配置文件本地解析时使用。

YAML 配置互转(js-yaml)

灵感:能力工具箱 yaml-config(pkg: js-yaml)。

在浏览器本地把客户筛选规则、跟进模板配置等在 YAML(易读)与 JSON(易存)之间互转,不请求后端。

何时使用

  • 运营可读的 YAML 配置导入系统
  • 把 JSON 配置导出为 YAML 便于 diff/评审
  • 本地校验配置能否解析

硬约束

  1. 依赖 js-yaml;使用 load / dump(或等价 API)。
  2. 安全:load 使用安全模式(默认 load 已非 loadAll 任意类型时注意;禁止启用可执行自定义类型)。勿对不可信 YAML 开危险 schema。
  3. 解析失败返回中文原因;dump 使用稳定缩进(如 2 空格)。
  4. 往返后关键字段不丢;可对客户配置做轻量字段校验(可选)。
  5. 纯本地,不上传配置到第三方。

推荐实现要点

import yaml from 'js-yaml'

export function yamlToJson(text: string): { ok: true; data: unknown } | { ok: false; reason: string } {
  try {
    const data = yaml.load(text, { schema: yaml.DEFAULT_SCHEMA })
    if (data === undefined) return { ok: false, reason: '内容为空' }
    return { ok: true, data }
  } catch (e: any) {
    return { ok: false, reason: e?.reason || e?.message || 'YAML 无法解析' }
  }
}

export function jsonToYaml(data: unknown): { ok: true; text: string } | { ok: false; reason: string } {
  try {
    const text = yaml.dump(data, {
      indent: 2,
      lineWidth: 100,
      noRefs: true,
      sortKeys: false,
    })
    return { ok: true, text }
  } catch {
    return { ok: false, reason: '无法序列化为 YAML' }
  }
}

/** 客户配置示例形状 */
export type CustomerFilterConfig = {
  stages?: string[]
  minAmount?: number
  owners?: string[]
}

Agent 步骤

  1. 安装 js-yaml,封装 yamlToJson / jsonToYaml。
  2. UI:双栏「YAML ↔ JSON」预览;导入文件用 UTF-8。
  3. 自测:样例配置往返;坏缩进有中文错误。

附加

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • 提供 YAML 与 JSON 互转的实用功能,适用于客户/业务配置场景
  • 纯本地处理,不上传配置,保障数据安全
Trigger Precision85/100

Highlights

  • 触发描述清晰,覆盖 YAML 配置互转、js-yaml 使用等典型场景
Structure and Standards75/100

Areas to improve

  • 缺少端到端用户示例 Reported severity: Minor

    文档缺少具体的输入输出示例展示,用户难以直观理解转换效果

    Recommendation: 补充一个完整的 YAML 配置示例及其对应的 JSON 输出,帮助用户快速理解功能

Highlights

  • 文档结构清晰,包含使用场景、硬约束、实现要点等完整章节
  • 提供了 TypeScript 实现代码和类型定义
Execution Reliability88/100

Highlights

  • 使用 js-yaml 安全模式,避免执行任意代码风险
  • 完善的异常处理机制,解析失败返回中文错误信息
  • 配置了合理的 dump 参数(缩进、行宽等)保证输出稳定性
Evidence Verifiability (mean of the first four)82/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.

Not specified in the source documentation.

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