sdxc-yaml

Parse and stringify YAML with Result-returning errors that name the failing line.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-yaml-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-yaml
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-yaml
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-yaml-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @sdxc/result.

What problem does it solve? Reading YAML config files or frontmatter with throwing parsers makes error handling awkward and hides where a malformed document failed. This Skill documents @sdxc/yaml, which returns a Result carrying the exact line of a parse failure instead of throwing. ## Core Features & Use Cases - Result-based parsing: parse returns Result<unknown, YAMLParseError> where the error carries the line it stopped on, modeled after the built-in JSON object. - Result-based serialization: stringify returns Result<string, YAMLStringifyError> with the path to the offending value, following JSON.stringify semantics for toJSON, undefined, and circular structures. - Documented subset: Supports block mappings and sequences, plain and quoted scalars, flow collections, block scalars and comments; anchors, aliases, merge keys, tags and multi-document sources fail loudly by name. - Use Case: Read a config file or frontmatter block, and when the source is malformed, surface a message naming the line rather than catching an exception. ## Quick Start Add @sdxc/yaml as a workspace dependency and use its parse function to read a YAML config file into typed data with line-numbered error handling.

Frequently Asked Questions about sdxc-yaml

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse YAML in TypeScript without try/catch?▼

Use the parse function from @sdxc/yaml, which returns Result<unknown, YAMLParseError> instead of throwing. Check the result with isFailure from @sdxc/result, and the error carries the line where parsing stopped.

How do I convert a JavaScript object to a YAML string?▼

Call stringify from @sdxc/yaml with the value and optional indent option, which defaults to 2. It returns Result<string, YAMLStringifyError> and follows JSON.stringify semantics for toJSON, undefined entries, and circular structures.

Does @sdxc/yaml support anchors, tags, and multi-document YAML?▼

No. Anchors, aliases, merge keys, tags, and multi-document sources are outside the supported subset and produce named parse failures rather than being silently misread. The subset covers block mappings, sequences, scalars, flow collections, block scalars, and comments.

Why does YAML parse return unknown instead of a typed object?▼

Parse returns unknown because text read from a file has no guaranteed shape. Pass the result to a Standard Schema validator to obtain a concrete type, and note that an empty or comment-only source reads as null.

How are dates and special numbers handled when writing YAML?▼

The core schema has no timestamp type, so dates stay strings in both directions and must be validated and converted yourself. Stringify writes NaN and infinities as .nan, .inf, and -.inf, and fails on circular structures or bigint values.