Converts a code snippet from one programming language to another while preserving behavior and flagging library, runtime, and type-system differences. Use when the user asks to translate, port, rewrite, or convert code between languages — "port this to Python", "rewrite in Rust", "convert Java to Go".
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.
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.
Source (Python):
pythondef avg(nums): return sum(nums) / len(nums)
Translation:
Translated code (JavaScript):
javascriptfunction 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 raisesZeroDivisionErroron an empty list, while JS returnsNaN. 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 orNaN.
Repo Onboarder
surfmindExplains a repository's purpose, structure, setup and run commands, key scripts, and the first files worth opening. Use when the user wants to understand a new repo or codebase — "what does this project do", "how do I get started", "give me a codebase overview", "onboard me to this repo".
API To Example
surfmindTurns REST API documentation into a runnable curl, fetch, or code example with required headers, request body, and placeholders for secrets. Use when the user wants to generate a request from API docs, an endpoint, or a Swagger/OpenAPI spec — "give me a curl for this", "show a fetch example", "how do I call this API".
Regex Decoder
surfmindBreaks a regular expression down into plain-language parts with examples of what it matches and what it rejects. Use when the user asks to explain, decode, or understand a regex, regexp, or pattern — "what does this regex match", "explain this pattern", a .match/.test call.