返回技能列表

transmute

pjt222
更新于 2 days ago
5 次查看
17
2
17
在 GitHub 上查看
设计apidesigndata

关于

Transmute is a targeted transformation skill for converting a single function, module, or data structure into another form while preserving its core behavior. It's a lighter-weight alternative to a full refactoring cycle, ideal for well-understood conversions like translating a function between languages or migrating an API consumer. Use it for focused tasks where the scope is a discrete unit, not an entire system.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/transmute

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Transmute

Transform specific code/data → another form (lang translation, paradigm shift, format conversion, API migration) preserving essential behavior + semantics.

Use When

  • Convert fn between langs (Python → R, JS → TS)
  • Shift module between paradigms (class-based → functional, callbacks → async/await)
  • Migrate API consumer v1 → v2
  • Convert data formats (CSV → Parquet, REST → GraphQL schema)
  • Replace dep w/ equiv (moment.js → date-fns, jQuery → vanilla JS)
  • Scope = single fn, class, module (NOT full system)

In

  • Required: Source (file path, fn name, data sample)
  • Required: Target form (lang, paradigm, format, API ver)
  • Optional: Behavioral contract (tests, type signatures, expected I/O pairs)
  • Optional: Constraints (backward compat, perf budget)

Do

Step 1: Analyze Source

Understand exactly what src does before transforming.

  1. Read src completely — every branch, edge case, err path
  2. ID behavioral contract:
    • What ins accepts? (types, ranges, edge cases)
    • What outs produces? (return values, side effects, err signals)
    • What invariants maintains? (ordering, uniqueness, ref integrity)
  3. Catalog deps: what src imports, calls, relies on?
  4. Tests exist → read for expected behavior
  5. No tests → write behavioral characterization tests before transmuting

Got: Complete understanding of what src does (not how). Behavioral contract explicit + testable.

If err: Src too complex for single transmute → break into smaller pieces | escalate to full athanor proc. Behavior ambiguous → ask clarification vs guess.

Step 2: Map Source → Target

Design transformation mapping.

  1. Per src element, ID target equivalent:
    • Lang constructs: loops → map/filter, classes → closures
    • API calls: old endpoint → new, req/res shape changes
    • Data types: dataframe cols → schema fields, nested JSON → flat tables
  2. ID elements w/ no direct equiv:
    • Src features missing in target (pattern matching in lang w/o it)
    • Target idioms not in src (R vectorization vs Python loops)
  3. Per gap, choose adaptation strategy:
    • Emulate: reproduce behavior w/ target-native constructs
    • Simplify: src construct was workaround → use target's native solution
    • Document: behavior changes slightly → note explicit
  4. Write transformation map: src → target per piece

Got: Complete mapping where every src element has target dest. Gaps ID'd + adaptation chosen.

If err: Too many no direct equivs → transformation may be inappropriate (highly OO design → lang w/o classes). Reconsider target | escalate athanor.

Step 3: Execute

Write target form following map.

  1. Create target file(s) w/ structure + boilerplate
  2. Transmute each element per Step 2 map:
    • Preserve behavioral contract — same ins → same outs
    • Use target-native idioms not literal translations
    • Maintain | improve err handling
  3. Handle deps:
    • Replace src deps w/ target equivs
    • No equiv → impl minimal adapter
  4. Inline comments ONLY where transformation non-obvious

Got: Complete target impl following map. Reads like written natively in target, not mechanically translated.

If err: Specific element resists → isolate. Transform everything else first, tackle resistant w/ focused attention. Truly can't be transmuted → doc why + workaround.

Step 4: Verify Behavioral Equivalence

Confirm transmuted preserves original's behavior.

  1. Run behavioral contract tests vs target impl
  2. Per test:
    • Same ins → same outs (within tolerance for numeric conversions)
    • Same err conditions → equiv err signals
    • Side effects (if any) preserved | doc'd as changed
  3. Check edge cases explicit:
    • Null/NA/undefined handling
    • Empty collections
    • Boundary values (max int, empty string, zero-length arrays)
  4. Target adds capabilities (type safety) → verify those too

Got: All behavioral contract tests pass. Edge cases handled equivalent. Behavioral diffs doc'd + intentional.

If err: Tests fail → diff src vs target behavior, find divergence. Fix target → match src contract. Divergence intentional (fixing src bug) → doc explicit.

Check

  • Src fully analyzed w/ explicit behavioral contract
  • Transformation map covers every src element
  • Gaps ID'd w/ adaptation strategies doc'd
  • Target uses native idioms (not literal translation)
  • All behavioral contract tests pass vs target
  • Edge cases verified (null, empty, boundary)
  • Deps resolved w/ target equivs
  • Behavioral diffs doc'd + intentional

Traps

  • Literal translation: Python-in-R | Java-in-JS vs using target idioms. Result should look native.
  • Skip behavioral tests: Transmute w/o tests → can't verify equivalence. Write characterization tests first.
  • Ignore edge cases: Happy path transmutes easy; edge cases hide bugs.
  • Over-engineer adapter: Dep needs 200-line adapter → scope too large.
  • Transmute comments verbatim: Comments explain target code, not echo src. Rewrite.

  • athanor — Full 4-stage transformation for systems too large for single transmute
  • chrysopoeia — Optimizing transmuted code for max value extraction
  • review-software-architecture — Post-transmutation arch review for larger conversions
  • serialize-data-formats — Specialized data format conversion procedures

GitHub 仓库

pjt222/agent-almanac
路径: i18n/caveman-ultra/skills/transmute
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

executing-plans

设计

该Skill用于当开发者提供完整实施计划时,以受控批次方式执行代码实现。它会先审阅计划并提出疑问,然后分批次执行任务(默认每批3个任务),并在批次间暂停等待审查。关键特性包括分批次执行、内置检查点和架构师审查机制,确保复杂系统实现的可控性。

查看技能

requesting-code-review

设计

该Skill可在完成任务、实现主要功能或合并代码前自动调度代码审查子代理,确保实现符合需求和计划。它支持通过指定git SHA范围进行精准的代码变更审查,帮助开发者在关键节点及时发现潜在问题。核心原则是"早审查、勤审查",适用于开发流程的各个关键阶段。

查看技能

connect-mcp-server

设计

这个Skill指导开发者如何将MCP服务器连接到Claude Code,支持HTTP、stdio和SSE三种传输协议。它涵盖了从安装配置到认证安全的完整流程,适用于集成GitHub、Notion、数据库等外部服务。当开发者需要添加集成、配置外部工具或提及MCP相关功能时,这个Skill能提供实用的操作指南。

查看技能

web-cli-teleport

设计

该Skill帮助开发者根据任务特性选择Claude Code的Web或CLI界面,并指导如何在两种环境间无缝迁移会话。它能分析任务复杂度、迭代需求等要素,推荐最优工作界面和工作流。关键特性包括会话状态管理、环境切换指导和上下文优化建议。

查看技能