Transmute

From pjt222/agent-almanac · View interactive version

Transmute is an AI agent skill from the GitHub repository pjt222/agent-almanac. Transform a single function, module, or data structure from one form to another while preserving its essential behavior. Lighter-weight than the full athanor cycle, suitable for targeted conversions where the input and output forms are well-understood. Use when converting a function between language

How to use this skill

Skill file

Transmute

Transform a specific piece of code or data from one form to another — language translation, paradigm shift, format conversion, or API migration — while preserving essential behavior and semantics.

When to Use

Inputs

Procedure

Step 1: Analyze the Source Material

Understand exactly what the source does before attempting transformation.

  1. Read the source completely — every branch, edge case, and error path
  2. Identify the behavioral contract:
  1. Catalog dependencies: what does the source import, call, or rely on?
  2. If tests exist, read them to understand expected behavior
  3. If no tests exist, write behavioral characterization tests before transmuting

Got: A complete understanding of what the source does (not how it does it). The behavioral contract is explicit and testable.

If fail: If the source is too complex for a single transmute, consider breaking it into smaller pieces or escalating to the full athanor procedure. If behavior is ambiguous, ask for clarification rather than guessing.

Step 2: Map Source to Target Form

Design the transformation mapping.

  1. For each element in the source, identify the target equivalent:
  1. Identify elements with no direct equivalent:
  1. For each gap, choose an adaptation strategy:
  1. Write the transformation map: source element → target element, for every piece

Got: A complete mapping where every source element has a target destination. Gaps are identified and adaptation strategies chosen.

If fail: If too many elements lack direct equivalents, the transformation may be inappropriate (e.g., transmuting a highly object-oriented design into a language without classes). Reconsider the target form or escalate to athanor.

Step 3: Execute the Transformation

Write the target form following the map.

  1. Create the target file(s) with appropriate structure and boilerplate
  2. Transmute each element following the map from Step 2:
  1. Handle dependencies:
  1. Add inline comments only where the transformation was non-obvious

Got: A complete target implementation that follows the transformation map. The code reads like it was written natively in the target form, not mechanically translated.

If fail: If a specific element resists transformation, isolate it. Transform everything else first, then tackle the resistant element with focused attention. If it truly cannot be transmuted, document why and provide a workaround.

Step 4: Verify Behavioral Equivalence

Confirm the transmuted form preserves the original's behavior.

  1. Run the behavioral contract tests against the target implementation
  2. For each test case, verify:
  1. Check edge cases explicitly:
  1. If the target form adds capabilities (e.g., type safety), verify those too

Got: All behavioral contract tests pass. Edge cases are handled equivalently. Any behavioral differences are documented and intentional.

If fail: If tests fail, diff the source and target behavior to find the divergence. Fix the target to match the source contract. If the divergence is intentional (e.g., fixing a bug in the original), document it explicitly.

Validation Checklist

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.