SuperAPI AI Directory

skd-decompile

Coding & development

View repository

Updated 10-15 21:49

About this skill

/skd-decompile — JSON draft from the DCS Template.xml

Reads Template.xml and emits JSON in the format skd-compile. The result is a draft, not a reversible representation: see the section "What you get".

When to use

  • Scaffold a new report from a sample — take an existing DCS, get the JSON, modify it, and compile it into a new one.
  • Structural refactoring — rewrite a variant, redraw a template, go through the set of fields again.

When not to use

  • Point edits to a finished report (add a field, filter, total, rename) → /skd-edit. The "decompile → edit JSON → compile" cycle rewrites the template entirely, may lose uncovered constructs, and produces a large diff in the sources. /skd-edit edits in a targeted way, without full reconstruction.

Parameters

Parameter Description
TemplatePath Path to Template.xml (required)
OutputPath Path to the output JSON. If not specified — JSON to stdout
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/skd-decompile.ps1" -TemplatePath "<Template.xml>" -OutputPath "<out.json>"

What you get

JSON draft in the format /skd-compile — not a full reversible representation of the DCS. Such JSON may not go directly into the compiler: it contains sentinel nodes (marker __unsupported__).

  • Ready nodes — most of the DCS (fields, parameters, templates, variants with structure/filter/order/conditionalAppearance, etc.) maps into JSON as ordinary DSL nodes.
  • Sentinel nodes — places where a construct was encountered that the decompiler cannot express in the DSL. The JSON remains valid, but the compiler will refuse to assemble it until the sentinel is replaced with a manual implementation (an explicit raw template, a prescribed appearance, etc.) or removed, if the construct is not needed in the new report. This is a deliberate barrier — so that anything uncovered does not end up in the final report unnoticed.
  • <basename>.warnings.md next to OutputPath — a list of all sentinel nodes with coordinates in the source; it is convenient to use it to go through the places that need manual refinement.
  • Critical constructs (Picture cells, ValueStorage, nested schemas, non-DCS root) — the script fails with a nonzero code and a message in stderr; such a Template is not suitable as a sample.

Workflow

  1. /skd-decompile <Template.xml> -OutputPath draft.json — get a draft.
  2. Open draft.warnings.md, see what was not covered.
  3. Adjust the JSON for the task. Sentinel nodes — replace with a manual implementation (via an explicit raw template, via a manual description of appearance, etc.) or delete if the construct is not needed in the new report.
  4. /skd-compile -DefinitionFile draft.json -OutputPath new-Template.xml — assemble back.
  5. /skd-validate + /skd-info — check.