Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

XMLStarlet

$ xml Community Low Risk
XMLStarlet · Database & Data · MIT · macos / linux / windows

XMLStarlet (xml or xmlstarlet) wraps libxml2 and libxslt into Unix subcommands (sel, val, tr, ed, fo, el) for querying XML via XPath, validating against XSD/DTD/RelaxNG, and applying XSLT stylesheets.

FCRS-1.0 Score
73 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
brew install xmlstarlet
CLI vs MCP Decision CLI Only

Extracts XPath nodes and validates XSD schemas deterministically via libxml2 without fragile regex XML parsing.

Agent-Readiness Checklist

— JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 15 / 25

Non-interactive and deterministic exit codes, but emits XML/plain text (zero JSON support) and requires verbose -t -m -v template flags.

  • No JSON output support
  • Verbose XSLT-backed -t flags and xml vs xmlstarlet binary naming split
Trust & Safety 22 / 25

Read-only stdout by default; in-place file edits require explicit xml ed -L (--inplace).

  • Stdout default; explicit -L required for in-place mutation
Setup & Portability 13 / 15

Widely packaged via Homebrew, apt, dnf, and Chocolatey, though the installed command name varies (xml vs xmlstarlet).

  • Available via brew install xmlstarlet and Linux distro packages
Utility & Efficiency 10 / 15

Solid for XPath 1.0 queries, XSD validation, and XSLT 1.0 transforms, though modern tools (yq -p xml) are cleaner when JSON output is needed.

  • Covers XPath, XSLT, XSD, and XML formatting
Maintenance & Lineage 6 / 10

Mature legacy C codebase under MIT license with infrequent modern maintenance.

  • Legacy libxml2 wrapper with minimal upstream changes
Docs & Verifiability 7 / 10

Detailed SourceForge User's Guide and subcommand --help pages.

  • Official User's Guide at xmlstarlet.sourceforge.net

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None; operates purely on local XML/XSD/XSL files and stdin/stdout.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source CLI; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# XMLStarlet (xml) Agent Rules
- Note that the binary may be named `xml` (macOS Homebrew) or `xmlstarlet` (Debian/Ubuntu) depending on OS.
- Pass `-N ns=<uri>` for namespaced XML documents, and prefer `xml ed` to stdout before using `--inplace` (`-L`).

Agent-Ready Command Recipes

Safe Read-Only Queries

Extract values with XPath in plain text
xml sel -T -t -m "//item" -v "name" -n feed.xml

Queries //item/name nodes and prints one value per line without XML escaping.

Validate an XML document against an XSD schema
xml val -e -s schema.xsd data.xml

Checks well-formedness and XSD compliance, printing errors to stderr with exit code 0 or 1.

Controlled Writes & Previews

Update an XML node value to stdout or new file
xml ed -u "//config/port" -v "8080" config.xml > config.new.xml

Applies an XPath update non-destructively to a new file rather than passing --inplace.

Strengths for Agents

  • + Reliable libxml2/libxslt backing for XPath selection and XSD/DTD validation.
  • + Pure C binary with fast execution and zero runtime interpreter overhead.

Caveats & Pitfalls

  • ! No JSON output; XML-to-JSON conversion requires yq or jc.
  • ! Binary name differs across OSes (xml on Homebrew/macOS vs xmlstarlet on Debian/Ubuntu).
  • ! XPath 1.0 namespaces require explicit -N prefix=uri bindings or queries silently return empty.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI