Agent skill

Fanyi

by afc163 in afc163/fanyi

用命令行工具 fanyi(别名 fy)做中英互译与查词,一次返回词典(iciba、youdao)和大模型三方结果。适用于单词、短语、习语谚语、单句短句的中英翻译,以及查释义、音标、例句、相关词。触发场景如"翻译一下 xxx"、"xxx 是什么意思"、"xxx 用英语怎么说"、"和谐 翻译成英文"——即使没说"用 fanyi"也应优先用本…

MITAuto-check passedWriting & Content

Install Fanyi

skills CLI
$ npx skills add afc163/fanyi --skill fanyi -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install afc163/fanyi fanyi --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/afc163/fanyi.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/fanyi .claude/skills/fanyi && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fanyi
GitHub stars
1.6k
Token cost
~766 tokens
SKILL.md length
133 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

用命令行工具 fanyi(别名 fy)做中英互译与查词,一次返回词典(iciba、youdao)和大模型三方结果。适用于单词、短语、习语谚语、单句短句的中英翻译,以及查释义、音标、例句、相关词。触发场景如"翻译一下 xxx"、"xxx 是什么意思"、"xxx 用英语怎么说"、"和谐 翻译成英文"——即使没说"用 fanyi"也应优先用本…

  • Works in 2 steps: 探测用户机器上有哪些包管理器,按下面顺序取第一个可用的即可(它们大多兼容 npm… → 用探测到的包管理器全局安装,各工具的全局安装命令
  • Tasks that involve Translation
  • SKILL.md covers 适用范围, 为什么用它, 用法 and 执行要点, plus 3 more sections
  • Calls bun, pnpm and yarn; needs LLM_API_KEY

What it does

Fanyi is an agent skill from afc163/fanyi. 用命令行工具 fanyi(别名 fy)做中英互译与查词,一次返回词典(iciba、youdao)和大模型三方结果。适用于单词、短语、习语谚语、单句短句的中英翻译,以及查释义、音标、例句、相关词。触发场景如"翻译一下 xxx"、"xxx 是什么意思"、"xxx 用英语怎么说"、"和谐 翻译成英文"——即使没说"用 fanyi"也应优先用本 skill,比口头翻译更准更全。不适用:长句、段落、整篇文章等长文本翻译(改由模型直接翻),以及非中英语言、文案润色、写代码等需求。

Its SKILL.md is about 770 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Writing & Content, covering Translation. It works with Node.js, npm and pnpm. The repository describes itself as: A 🇨🇳 and 🇺🇸 translator in your command line. The licence is MIT.

When your agent uses it

  • Tasks that involve Translation

Example prompts

  • “翻译一下 xxx”
  • “xxx 是什么意思”
  • “xxx 用英语怎么说”
  • “/fanyi”

Requirements

  • Node.js
  • A credential in LLM_API_KEY

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. 探测用户机器上有哪些包管理器,按下面顺序取第一个可用的即可(它们大多兼容 npm 的全局安装语义)
  2. 用探测到的包管理器全局安装,各工具的全局安装命令

What it can do on your machine

Read from SKILL.md and the folder at commit c853e6b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun
    • pnpm
    • yarn
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm, yarn and npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • LLM_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Fanyi loads about 766 tokens when it runs. Until then it costs about 61 tokens; SKILL.md has 133 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~61
When it runs · the whole SKILL.md, loaded when a task matches
~766

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from afc163/fanyi at commit c853e6b, republished under its MIT licence (© afc163). 133 words, ~766 tokens.

Download SKILL.mdSave it as .claude/skills/fanyi/SKILL.md (or your agent's skills folder).
name
fanyi
description
用命令行工具 fanyi(别名 fy)做中英互译与查词,一次返回词典(iciba、youdao)和大模型三方结果。适用于单词、短语、习语谚语、单句短句的中英翻译,以及查释义、音标、例句、相关词。触发场景如"翻译一下 xxx"、"xxx 是什么意思"、"xxx 用英语怎么说"、"和谐 翻译成英文"——即使没说"用 fanyi"也应优先用本 skill,比口头翻译更准更全。不适用:长句、段落、整篇文章等长文本翻译(改由模型直接翻),以及非中英语言、文案润色、写代码等需求。

fanyi 中英翻译

fanyi(短别名 fy)是一个命令行中英互译工具。它会同时返回 iciba 词典、youdao 词典和大模型(LLM)三方的翻译结果:词典给出权威释义、音标、词形、相关词、词组和例句,LLM 给出贴合语境的翻译。仅支持中文 ↔ 英文。

适用范围

适合:单词、短语、习语谚语、单句短句的中英互译与查词。这类内容词典能给出结构化释义,放进命令行参数也自然。

不适合:长句、整段落、整篇文章、文档的翻译。原因有两点——一是这种长文本作为命令行参数既笨拙又容易被 shell 拆坏;二是 fanyi 的输出是按"查词/短句"组织的(音标、词性、例句那一套),长文反而读起来累赘。遇到长文本翻译,直接由模型自己翻更合适,不要套用本 skill。一个简单的判断:如果内容超过一句话、或明显是要"通顺译完一段",就别用 fanyi。

为什么用它

直接靠模型口头翻译,容易漏掉音标、词性、常用搭配和真实例句,单词的多个义项也容易给得不全。fanyi 把词典的结构化数据和大模型的语境翻译合在一起,一条命令就能拿到最完整的结果,所以遇到中英查词/短句翻译时优先调用它,而不是自己直接翻。

用法

核心命令就是把要翻译的内容作为参数传给 fanyi:

bash
fanyi <要翻译的内容>

fy 是完全等价的短别名,任选其一即可:

bash
fy <要翻译的内容>

翻译单个英文单词(会返回释义、音标、相关词、例句):

bash
fanyi love

翻译短语或多个词(直接跟在后面,不用引号):

bash
fanyi make love
fanyi world peace

中译英 / 翻译中文(单字、词、甚至整句都支持):

bash
fanyi 和谐
fanyi 子非鱼焉知鱼之乐

含空格或特殊字符的句子用引号包起来,避免被 shell 拆开:

bash
fanyi "How are you doing today?"
fanyi "纸上得来终觉浅"

执行要点

  • 运行后直接把工具的完整输出原样展示给用户即可,不需要自己再翻译或改写一遍——工具已经给出了词典三方结果。可以在结尾用一句话点出最贴切的译法。
  • 命令会发起网络请求(iciba / youdao / LLM),通常几秒内返回。如果某一源超时或报错,工具仍会输出其他源的结果,属正常现象。
  • 不要给参数加多余的转义。一般情况下整句直接跟在命令后即可,只有当内容里带引号、&、|、$ 等 shell 特殊字符时才用双引号包裹。

查历史记录

用户问"我之前查过哪些词""最近查的单词"时,用 list 子命令:

bash
fanyi list                 # 查看当天的查询记录(默认)
fanyi list -r 7            # 查看最近 7 天
fanyi list -d 2026-06-06   # 查看指定某天

注意 fanyi list 默认只返回当天记录。要看更早的历史,用 -r <天数> 指定回溯范围,或用 -d <日期> 看某一天。

配置(仅在用户主动要求时)

fanyi 默认即可用。只有当用户明确想调整时才动配置:

bash
fanyi config list                              # 查看当前配置
fanyi config set iciba false                   # 关闭 iciba 源
fanyi config set llm false                      # 关闭大模型翻译
fanyi config set color false                    # 关闭彩色输出
fanyi config set LLM_API_KEY <your-key>         # 用自己的大模型 API Key
fanyi config set LLM_API_BASE_URL <your-url>    # 自定义 OpenAI 兼容接口地址
fanyi config set LLM_MODEL_ID <model-id>        # 指定模型 ID

配置写入 ~/.config/fanyi/.fanyirc。

前置条件:确保 fanyi 已安装

运行翻译命令前,先确认 fanyi 可用(例如 command -v fanyi)。如果提示 command not found,直接帮用户装上,不要只丢一条命令让用户自己敲。

安装步骤:

  1. 探测用户机器上有哪些包管理器,按下面顺序取第一个可用的即可(它们大多兼容 npm 的全局安装语义):

    bash
    for pm in bun pnpm yarn cnpm tnpm utoo npm; do
      command -v "$pm" >/dev/null 2>&1 && echo "$pm"
    done
  2. 用探测到的包管理器全局安装,各工具的全局安装命令:

    包管理器安装命令
    bunbun add -g fanyi
    pnpmpnpm add -g fanyi
    yarnyarn global add fanyi
    cnpmcnpm i fanyi -g
    tnpmtnpm i fanyi -g
    utooutoo i fanyi -g(或 utoo add -g fanyi)
    npmnpm i fanyi -g

    优先选 bun / pnpm(更快);都没有就回退到 npm。装完再跑一次翻译命令即可。

为什么这样做:用户的本意是想翻译,卡在"没装工具"这一步上很扫兴。帮他用现成的包管理器一键装好、然后立刻给出翻译结果,体验最顺。注意全局安装在某些环境(如系统 Node)可能需要权限,若报 EACCES 之类的权限错误,再把命令和 sudo 提示交给用户判断,不要擅自加 sudo 执行。

© afc163, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/fanyi of afc163/fanyi.

Open the folder on GitHubat commit c853e6b

Compare with similar skills

Fanyi next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Fanyi compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fanyi this skillafc163/fanyi1.6k—~766Automated safety check: PassMIT
Generate Translationspayloadcms/payload45k—~1.1kAutomated safety check: PassMIT
Plane UI Translationmakeplane/plane61k—~16kAutomated safety check: PassAGPL-3.0
Aholo Viewer Docsmanycoretech/aholo-viewer1.1k—~341Automated safety check: PassMIT
Adding Translation Keyvexl-it/vexl125—~632Automated safety check: PassGPL-3.0
Bunbrianlovin/agent-config3771 repos~484Automated safety check: NotesNone

Similar skills

  • Generate Translations

    payloadcms/payload

    A skill your agent uses when new translation keys are added to packages to generate new translations strings

    45k GitHub stars~1.1k tokensUpdated today
    Writing & ContentAuto-check passed
  • Plane UI Translation

    makeplane/plane

    Sets the rules for translating and updating Plane's UI strings across locales: do-not-translate terms, plural forms, placeholders and AI translation review.

    61k GitHub stars~16k tokensUpdated today
    Writing & ContentAuto-check passed
  • Aholo Viewer Docs

    manycoretech/aholo-viewer

    Guides writing and maintaining Aholo Viewer documentation: README, AGENTS.md, architecture notes, bilingual manual pages and AI collaboration guides.

    1.1k GitHub stars~341 tokensUpdated today
    Writing & ContentAuto-check passed
  • How to add or change a user-facing string in the Vexl app and translate it into all shipped locales.

    125 GitHub stars~632 tokensUpdated yesterday
    Writing & ContentAuto-check passed
  • Bun

    brianlovin/agent-config

    Use Bun instead of Node.js, npm, pnpm, or vite. An agent skill from brianlovin/agent-config.

    377 GitHub starsUsed in 1 repo~484 tokens
    Frontend & DesignAuto-check: notes
  • Translation Audit

    vexl-it/vexl

    Translations audit — fill missing keys in every shipped locale, re-translate keys whose English changed, delete stale ones, flag suspicious values.

    125 GitHub stars~693 tokensUpdated yesterday
    Writing & ContentAuto-check passed

Works with

Questions about Fanyi

What does Fanyi do?

用命令行工具 fanyi(别名 fy)做中英互译与查词,一次返回词典(iciba、youdao)和大模型三方结果。适用于单词、短语、习语谚语、单句短句的中英翻译,以及查释义、音标、例句、相关词。触发场景如"翻译一下 xxx"、"xxx 是什么意思"、"xxx 用英语怎么说"、"和谐 翻译成英文"——即使没说"用 fanyi"也应优先用本…. Fanyi is an agent skill from afc163/fanyi.

When should I use Fanyi?

Fanyi fits situations like: tasks that involve Translation.

How do I install Fanyi in Claude Code?

Run `npx skills add afc163/fanyi --skill fanyi -a claude-code`. Or copy the skill folder (skills/fanyi in afc163/fanyi) into .claude/skills/fanyi in your project. Claude Code loads it when a task matches its description.

How do I install Fanyi in Codex?

Run `npx skills add afc163/fanyi --skill fanyi -a codex`. Or copy the skill folder (skills/fanyi in afc163/fanyi) into .agents/skills/fanyi in your project. Codex loads it when a task matches its description.

Can I use Fanyi in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add afc163/fanyi --skill fanyi -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fanyi, .gemini/skills/fanyi, .github/skills/fanyi and .opencode/skills/fanyi in your project.

What does Fanyi need to run?

Going by SKILL.md and its folder, Fanyi needs the command-line tools its instructions call (bun, pnpm, yarn and npm) and credentials named LLM_API_KEY. Our summary lists: Node.js; A credential in LLM_API_KEY.

Does Fanyi access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Fanyi safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Fanyi use?

Fanyi is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fanyi use?

About 766 tokens (SKILL.md is roughly 3.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Fanyi?

Skills that share tags, products or a category with Fanyi: Generate Translations (payloadcms/payload, 45k stars), Plane UI Translation (makeplane/plane, 61k stars), Aholo Viewer Docs (manycoretech/aholo-viewer, 1.1k stars) and Adding Translation Key (vexl-it/vexl, 125 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fanyi?

afc163 (a GitHub user) maintains it in afc163/fanyi, which has 1,554 GitHub stars. The repository was last updated on September 7, 2026.

Source: afc163/fanyi on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.