Skill: aronchick/expanso-language-detect (version 1.0.0)

# language-detect Detect the language of text using AI ## Requirements - Expanso Edge installed (`expanso-edge` binary in PATH) - Install via: `clawhub install expanso-edge` ## Usage ### CLI Pipeline ```bash # Run standalone echo '<input>' | expanso-edge run pipeline-cli.yaml ``` ### MCP Pipeline ```bash # Start as MCP server expanso-edge run pipeline-mcp.yaml ``` ### Deploy to Expanso Cloud ```bash expanso-cli job deploy https://skills.expanso.io/language-detect/pipeline-cli.yaml ``` ## Files | File | Purpose | |------|---------| | `skill.yaml` | Skill metadata (inputs, outputs, credentials) | | `pipeline-cli.yaml` | Standalone CLI pipeline | | `pipeline-mcp.yaml` | MCP server pipeline |

path: README.md
content: # language-detect

Detect the language of text using AI.

## Usage

```bash
export OPENAI_API_KEY=sk-...
echo "Bonjour le monde" | expanso-edge run pipeline-cli.yaml
```

## Output

```json
{
  "language": "French",
  "code": "fr",
  "confidence": 0.98
}
```


path: pipeline-cli.yaml
content: name: "language-detect-cli"
type: pipeline

config:
  input:
    stdin:
      codec: all
      max_buffer: 102400

  pipeline:
    processors:
      - mapping: |
          meta trace_id = uuid_v4()
          root.messages = [
            {"role": "system", "content": "You are a language detection expert. Respond with ONLY a JSON object containing: language (full name), code (ISO 639-1), confidence (0-1). Example: {\"language\": \"English\", \"code\": \"en\", \"confidence\": 0.95}"},
            {"role": "user", "content": "Detect the language of this text:\n\n" + content()}
          ]

      - openai_chat_completion:
          [REDACTED_SECRET]"
          model: gpt-4o-mini

      - mapping: |
          let response = this.choices.0.message.content.parse_json().catch({})
          root.language = $response.language.or("Unknown")
          root.code = $response.code.or("xx")
          root.confidence = $response.confidence.or(0)
          root.metadata = {"skill": "language-detect", "mode": "cli", "trace_id": meta("trace_id"), "timestamp": now()}

  output:
    stdout:
      codec: json_object


path: pipeline-mcp.yaml
content: name: "language-detect-mcp"
type: pipeline

config:
  http:
    enabled: true
    address: "0.0.0.0:${PORT:-8080}"

  input:
    http_server:
      path: /detect
      allowed_verbs: [POST]
      timeout: 60s

  pipeline:
    processors:
      - mapping: |
          meta trace_id = uuid_v4()
          let text = this.text.or(content()).string()
          root.messages = [
            {"role": "system", "content": "You are a language detection expert. Respond with ONLY a JSON object containing: language (full name), code (ISO 639-1), confidence (0-1). Example: {\"language\": \"English\", \"code\": \"en\", \"confidence\": 0.95}"},
            {"role": "user", "content": "Detect the language of this text:\n\n" + $text}
          ]

      - openai_chat_completion:
          [REDACTED_SECRET]"
          model: gpt-4o-mini

      - mapping: |
          let response = this.choices.0.message.content.parse_json().catch({})
          root.language = $response.language.or("Unknown")
          root.code = $response.code.or("xx")
          root.confidence = $response.confidence.or(0)
          root.metadata = {"skill": "language-detect", "mode": "mcp", "trace_id": meta("trace_id"), "timestamp": now()}

  output:
    sync_response: {}


path: skill.yaml
content: name: language-detect
version: 1.0.0
description: Detect the language of text using AI

inputs:
  - name: text
    type: string
    required: true
    description: Text to analyze

outputs:
  - name: language
    type: string
    description: Detected language
  - name: confidence
    type: number
    description: Confidence score

credentials:
  - name: OPENAI_API_KEY
    required: false
    description: OpenAI API key

backends:
  - name: openai
    type: remote
    requires: [OPENAI_API_KEY]
    description: OpenAI GPT-4o-mini
  - name: ollama
    type: local
    models: [llama3.2]
    description: Local Ollama

author: expanso
license: MIT


path: test/fixtures/input.txt
content: Bonjour le monde


path: test/test.yaml
content: tests:
  - name: "Detect language"
    input: "Hello world"
    expected:
      has_field: language
      has_field: code
      metadata_has: [skill, trace_id]


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: suspicious | SkillSpector: suspicious (MEDIUM)