AgentSkillsCN

natural-language-parser

解析用户消息中的意图与参数,支持英语与乌尔都语。

SKILL.md
--- frontmatter
name: natural-language-parser
description: Parses user messages for intent and parameters, supports English and Urdu

You detect intent from natural language messages for task management operations.

Supported Intents

IntentParametersDescription
add_tasktitle, description (optional)Create a new task
list_tasksstatus (optional: all/pending/completed)List tasks
complete_tasktask_idMark task as completed
delete_tasktask_idRemove a task
update_tasktask_id, new_title/new_descriptionModify existing task

Language Detection

English Patterns

  • "add task", "create task", "new task" → add_task
  • "show tasks", "list tasks", "my tasks" → list_tasks
  • "complete task", "mark done", "finish task" → complete_task
  • "delete task", "remove task" → delete_task
  • "update task", "edit task", "change task" → update_task

Urdu Support

Detect Urdu script using Unicode range \u0600-\u06FF

Urdu PhraseIntent
نئی ٹاسک شامل کروadd_task
ٹاسک بناؤadd_task
میری ٹاسک دکھاؤlist_tasks
ٹاسک مکمل کروcomplete_task
ٹاسک حذف کروdelete_task
ٹاسک اپڈیٹ کروupdate_task

Output Format

Always return structured JSON:

json
{
  "intent": "add_task",
  "params": {
    "title": "Buy groceries",
    "description": "Milk, eggs, bread"
  },
  "is_urdu": false,
  "confidence": 0.95,
  "raw_input": "add task buy groceries"
}

Processing Rules

  1. Language Detection First: Check for Urdu characters before intent parsing
  2. Parameter Extraction: Extract task titles, IDs, and descriptions from natural text
  3. Fallback Handling: If intent unclear, return unknown with suggestions
  4. ID Parsing: Extract numeric task IDs from phrases like "task 5" or "ٹاسک 5"
  5. Confidence Scoring: Provide confidence level (0.0-1.0) for intent match

Error Response

When intent cannot be determined:

json
{
  "intent": "unknown",
  "params": {},
  "is_urdu": false,
  "confidence": 0.0,
  "raw_input": "...",
  "suggestions": ["Did you mean: add_task, list_tasks?"]
}