mcpbeat Sign in

Language Injection Agent Skill

LLM Agent 多语言注入规范。在修改 Agent 提示词、添加新的 Agent 端点、处理用户可见的后端消息(message_code)时使用。

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
16000
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/microsoft/data-formulator --skill language-injection

The instruction itself

9 sections, as written by the author

Language Injection for Agent Prompts

Authoritative developer guide: docs/dev-guides/6-i18n-language-injection.md.

> Prerequisites: Read docs/dev-guides/6-i18n-language-injection.md before changing Agent prompts, Agent routes, backend user-visible messages, or frontend i18n strings.

> If your work introduces new language injection patterns or conventions, update this file and related dev-guides accordingly.

Architecture

Frontend i18n.language  →  Accept-Language header  →  get_language_instruction()
                                                           │
                                                   build_language_instruction()
                                                   (agents/agent_language.py)
                                                           │
                                              ┌────────────┴────────────┐
                                              ▼                         ▼
                                        mode="full"               mode="compact"
                                    (text-heavy agents)        (code-gen agents)

Core Modules

| Module | Role |

|--------|------|

| agents/agent_language.py | build_language_instruction(lang, mode) — generates prompt fragments; inject_language_instruction() — injects into system prompts; supports 20 languages; returns "" for English |

| routes/agents.pyget_language_instruction() | Reads Accept-Language header, delegates to build_language_instruction |

| routes/agents.py_get_ui_lang() | Extracts primary language code from Accept-Language header |

| src/app/utils.tsxfetchWithIdentity() | Sets Accept-Language header on every API request from i18n.language |

| src/app/utils.tsxtranslateBackend() | Translates backend message_code / content_code using frontend i18n |

Code Examples

Route handler — inject language

# In a Flask route handler:
lang_instruction = get_language_instruction(mode="compact")
lang_suffix = f"\n\n{lang_instruction}" if lang_instruction else ""

messages = [
    {"role": "system", "content": "You are a helpful assistant." + lang_suffix},
    {"role": "user", "content": user_input},
]

Agent constructor — use inject_language_instruction()

from data_formulator.agents.agent_language import inject_language_instruction

# Simple append (most agents)
system_prompt = inject_language_instruction(system_prompt, language_instruction)

# Insert before a marker (complex prompts)
system_prompt = inject_language_instruction(
    system_prompt, language_instruction,
    marker="**About the execution environment:**"
)

Python-side user-visible messages — message_code pattern

For fixed strings in Python that appear in the UI, do NOT translate in Python.

Return a message_code and let the frontend translate:

# In an Agent or route handler:
yield {
    "type": "error",
    "message": "Output DataFrame is empty (0 rows).",  # English fallback
    "message_code": "agent.emptyDataframe",             # frontend i18n key
}

# With parameters:
result = {
    "status": "error",
    "content": f"Fields not found: {missing}",
    "content_code": "agent.fieldsNotFound",
    "content_params": {"missing": missing, "available": available},
}

Frontend consumption:

import { translateBackend } from '../app/utils';
const msg = translateBackend(event.message, event.message_code, event.message_params);

Translation keys go in src/i18n/locales/{en,zh}/messages.json under messages.agent.*.

Anti-Patterns (with explanations)

| Pattern | Why it's wrong |

|---------|---------------|

| os.environ.get("DF_DEFAULT_LANGUAGE") | Process-level — all users get same language; breaks multi-user |

| Global LLM client interceptor | Hidden behavior; can't distinguish full/compact mode; fragile string detection |

| New MessageBuilder class | Duplicates agent_language.py; creates parallel conflicting abstractions |

| Hardcoded "回答请使用中文" in prompts | Not configurable; skips the mode system; breaks for other languages |

| Backend-side translation dict (agent_messages.py) | Forces adding every new language to Python; translations should all live in src/i18n/locales/ |

| Hardcoded English UI strings in .tsx without t() | Not translatable; use useTranslation + t('key') |

Adding a New Language

  • Add language code + display name to LANGUAGE_DISPLAY_NAMES in agents/agent_language.py.
  • Optionally add extra rules to LANGUAGE_EXTRA_RULES (e.g. simplified vs traditional Chinese).
  • Add frontend translations in src/i18n/locales/<lang>/ — copy an existing locale folder as template.
  • No Agent code changes needed — the existing flow picks up new languages automatically.

Other skills for the same job

different authors, same section of the catalogue
Skill Share
by frostant
×4

A skill that creates new Claude skills and automatically shares them on Slack using Rube for seamless team collaboration and skill discovery.

728 tokens
Init First Agent
by nanocoai

Walk the operator through creating the first NanoClaw agent for a DM channel — resolve the operator's channel identity, wire the DM messaging group to a new agent, and trigger a welcome DM via the normal delivery path. Use after channel credentials are configured and the service is running.

2k tokens
Customer Support Agent
by mastra-ai
vendor

Authoring playbook for building agents that triage and reply to customer messages — support tickets, email inquiries, chat questions, refund requests, or product issues. Use this when the user wants an agent that handles inbound customer questions, drafts replies, escalates hard cases, summarizes tickets, or follows a support playbook.

2k tokens
Build Zoom Team Chat App
by anthropics
vendor

Reference skill for Zoom Team Chat. Use after routing to a chat workflow when building user-scoped messaging integrations, chatbot experiences, rich cards, buttons, slash commands, or chat webhooks.

29k tokens
Trigger Chat Agent Advanced
by triggerdotdev
vendor

> Advanced and operational chat.agent capabilities for Trigger.dev, loaded on demand. Load this when working on the raw Sessions primitive (sessions / SessionHandle), a custom chat transport or the realtime wire protocol, durable sub-agents (AgentChat, chat.stream.writer), human-in-the-loop, steering, actions, background injection (chat.defer / chat.inject), fast starts (preload, Head Start via @trigger.dev/sdk/chat-server), context resilience (compaction, recovery boot, OOM, large payloads), chat.local run-scoped state, offline testing with mockChatAgent, or prerelease/version upgrades. For the everyday chat.agent({...}) definition and the useTriggerChatTransport happy path, use the trigger-authoring-chat-agent skill instead.

4k tokens
Bootstrap Google Tools
by google
vendor

Install and authenticate, on demand, the CLIs the sandbox does not prebake — Node/npm, `gws` (Google Workspace), `gcloud`, `agents-cli` (call remote A2A/ADK agents), and `mcp-cli` (use MCP-server tools). Use this whenever one of those tools is needed but missing (a `node`/`npm`/`gws`/`gcloud`/`agents-cli`/`mcp-cli` command returns "command not found"), or before starting any task that requires one — Google Workspace work (Drive, Gmail, Sheets, Calendar, Chat), GCP via `gcloud`, calling another agent deployed remotely over HTTP (Cloud Run or Vertex Agent Runtime), or using tools exposed by an MCP server. Setup only (install + config + headless auth); each tool's own usage lives in its own skill(s).

5k tokens
Hubspot Customer Prep
by openai
vendor

Use when preparing HubSpot customer briefs for meetings, renewals, QBRs, sales calls, escalations, handoffs, or follow-ups.

417 tokens
Skill Share
by davepoon

A skill that creates new Claude skills and automatically shares them on Slack using Rube for seamless team collaboration and skill discovery.

736 tokens

How to use it

Copy the folder

Take microsoft/language-injection from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.