component-roundtrip

Runs targeted round-trip tests validating source code through lift, generate, and execution stages.

9|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/timcsy/semorphe --skill component-roundtrip-timcsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component-roundtrip
Source: https://github.com/timcsy/semorphe/tree/main/knowledge/skills/component-roundtrip
Command: npx skills add https://github.com/timcsy/semorphe --skill component-roundtrip-timcsy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Verifying that a code-to-blocks pipeline preserves program semantics is hard: generated code may compile but behave differently, or lifters may silently degrade unrecognized syntax. This Skill automates targeted round-trip testing through the Semorphe pipeline (source → lift → SemanticTree → generate → source → execute → compare stdout), catching semantic bugs, coverage gaps, and projection violations. ## Core Features & Use Cases - Targeted Round-Trip Testing: Test specific concepts (e.g., cpp if), difficulty levels (easy/medium/hard), inline code snippets, or all supported concepts of a language. - Multi-Level Verification: Compares stdout equivalence, semantic tree integrity (component identity, confidence distribution, double round-trip stability), multi-branch scaffolding behavior, and code structure. - Permanent Regression Tests: Converts every test case into Vitest files under tests/integration/, with failures marked as it.todo and a mandatory bug-fix policy. - Use Case: After adding pointer support to the C++ lifter, run the skill with cpp pointer to generate representative programs, verify the semantic tree uses cpp_pointer_declare (not a degraded generic node), confirm stdout matches, and persist passing cases as regression tests. ## Quick Start Ask the AI to run a round-trip test on a C++ if-statement snippet and report whether the generated code produces identical output.

Frequently Asked Questions about component-roundtrip

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

FAQPage Schema
How do I run a round-trip test on a code snippet?

Pass the code snippet directly as an argument, either inline or as a file path. The language is inferred from the extension (.cpp, .py, .java, .js) or syntax, and the skill lifts, regenerates, executes, and compares stdout automatically.

How do I test a specific programming concept like loops or pointers?

Use the format '{lang} {component_name}', such as 'cpp if' or 'python while_loop'. The skill generates 3-5 representative programs with edge cases for that concept and runs the full round-trip verification on each.

What does the round-trip test actually verify?

It checks stdout equivalence between original and generated code, semantic tree integrity including component identity and confidence distribution, double round-trip structural stability, and multi-branch scaffolding behavior per the P4 progressive disclosure rules.

Does the skill support languages other than C++?

Yes, it supports any language with a Semorphe pipeline implementation, including Python, Java, and JavaScript. The language is inferred from file extensions or specified explicitly in the argument.

What happens when a round-trip test fails?

Failures are classified (STDOUT_DIFF, COMPILE_FAIL, LIFT_FAIL, DEGRADED, etc.) and persisted as Vitest cases marked with it.todo or it.skip, including the failure reason. Bugs with identifiable root causes must be fixed immediately and the tests enabled.

Why does the skill check component identity in the semantic tree?

Component identity checks prevent false positives where the lifter uses a wrong generic concept (like var_declare) but happens to generate correct code. It asserts the expected componentId exists with correct properties, ensuring true semantic understanding.