code-translator

code-translator is a skill for Claude Code, Codex from surfmind-space/awesome-surfmind. It costs 65 tokens per session (546 once invoked), scanned A, original, MIT.

A code-porting tool that rewrites a code snippet from one programming language into another while aiming to keep its behavior unchanged.

In plain words
What is it for?
Use it to port snippets, identify differences to verify, and create test cases for comparing the original and translated code.
Why use it?
Moving code between languages can introduce differences in libraries, runtimes, types, errors, encoding, or edge cases that are easy to miss.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/surfmind-space/awesome-surfmind/code-translator
Any agent
npx skills add surfmind-space/awesome-surfmind --skill code-translator
Clone the repo
git clone --depth 1 https://github.com/surfmind-space/awesome-surfmind

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-translator

README.md
[![agentmods](https://agentmods.dev/badge/skills/surfmind-space/awesome-surfmind/code-translator.svg)](https://agentmods.dev/skills/surfmind-space/awesome-surfmind/code-translator)
Your own site
<a href="https://agentmods.dev/skills/surfmind-space/awesome-surfmind/code-translator"><img src="https://agentmods.dev/badge/skills/surfmind-space/awesome-surfmind/code-translator.svg" alt="Measured on agentmods" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 546 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00065 $0.00546
Opus 5 $0.00032 $0.00273
Sonnet 5 $0.00013 $0.00109
Haiku 4.5 $0.00006 $0.00055

Measured 3d ago against content hash 101dff2618ec, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-translator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-translator/SKILL.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Translator

Port a code snippet into the target language while keeping its behavior intact — write idiomatic code for the target rather than a line-by-line transliteration, and call out the differences the user must verify before relying on the result. Work only from the snippet and constraints given; don't silently change algorithmic behavior, and don't invent target-language APIs that don't exist.

  1. Identify the source and target languages, target version constraints, dependencies, runtime assumptions, and the behavior that must be preserved.
  2. Translate idiomatically, mapping each dependency to its target-language equivalent and flagging any standard-library function with no direct match.
  3. Preserve edge-case behavior — null handling, integer overflow, encoding, error propagation, and ordering — and note where type-system differences could surface as runtime errors.
  4. Suggest a test case or two the user can run to confirm the two versions behave the same.

Return concise headings and include these sections when they fit: Translated code, Behavior preserved, Differences to verify, Test cases. Preserve important names, numbers, and constraints. Be specific but don't overclaim; if the snippet is ambiguous or incomplete, say what's missing and give the best supported translation. Respond in the same language as the user's request.

Example

Source (Python):

def avg(nums):
    return sum(nums) / len(nums)

Translation:

Translated code (JavaScript):

function avg(nums) {
  return nums.reduce((a, b) => a + b, 0) / nums.length;
}

Behavior preserved: Sums the list and divides by its length, returning the mean.

Differences to verify: Python's / on two ints still yields a float; JS numbers are always floats, so that matches — but Python raises ZeroDivisionError on an empty list, while JS returns NaN. Add an explicit guard if the empty-input contract matters.

Test cases: avg([1, 2, 3])2; avg([]) → confirm whether you want a thrown error or NaN.

Read the full file on GitHub · 47 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 47 lines · 65 tokens per session scan A 101dff2618ec

Subscribe to this mod's changes

code-translator is a skill published in the GitHub repository surfmind-space/awesome-surfmind (5 stars, last pushed 1mo ago), licensed MIT. It adds 65 tokens to every session and 546 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.