Convert Natural Language
v1.0.0在以下情况下使用:(1)用户提供自然语言描述,并要求将其转换为结构化格式(SQL 查询、JSON 对象、API 请求、搜索查询、正则表达式模式)。(2)用户希望将纯语言指令转换为机器可读的命令或数据模式。(3)用户要求解析或将杂乱的文本输入规范化为干净的结构化格式。
运行时依赖
安装命令
点击复制技能文档
Core Position
This 技能 converts natural language 输入 into structured machine-readable 格式化s: SQL queries, JSON objects, API 请求 specifications, 搜索 queries, regular expressions, and formal grammar productions. It does NOT just find-replace — it understands intent, 提取s entities, resolves ambi图形界面ty, and produces semantically equivalent structured 输出.
Key responsibilities:
解析 natural language to identify intent (what the user wants to do), entities (objects being referenced), and constrAInts (过滤器s, conditions, limits) Map ambiguous conversational terms to precise structured syntax (e.g., "last week" → date >= NOW() - 7 days) 验证 that the 生成d 输出 is structurally correct (SQL 解析s, JSON is valid, regex compiles) Handle incomplete or ambiguous 输入 by asking clarifying questions before generating wrong 输出 Modes /convert-natural-language --sql
Natural language → SQL 查询. Converts a plAIn-language description into a syntactically valid SQL 状态ment (SELECT, INSERT, 更新, 删除). Supports PostgreSQL, MySQL, SQLite, and MongoDB 查询 syntax.
Example: "show me all users who 签名ed up in the last 30 days and have never made a purchase" → SELECT FROM users WHERE 创建d_at >= NOW() - INTERVAL '30 days' AND id NOT IN (SELECT user_id FROM purchases);
/convert-natural-language --json
Natural language → JSON object. Converts a description into a structured JSON document. Use when the user describes a data structure or configuration in plAIn terms.
Example: "a user with name John, emAIl john@example.com, age 30, and optional phone number" → {"name": "John", "emAIl": "john@example.com", "age": 30, "phone": null}
/convert-natural-language --API
Natural language → API 请求 specification. Converts a description into an HTTP API call: method, URL path, 查询 parameters, headers, body.
Example: "获取 the 性能分析 of user ID 123 from the /users 端点" → 获取 /users/123 (with auth header)
/convert-natural-language --搜索
Natural language → 搜索 查询. Converts a conversational 搜索 请求 into a precise 查询 string for a specific 搜索 engine or database full-text 搜索.
Example: "find articles about AI from 2023 that mention GPT and were published in Nature or Science" → AI GPT 2023 site:nature.com OR site:science.com (or WHERE ... for DB)
/convert-natural-language --regex
Natural language → Regular expression. Converts a description of a text pattern into a regex pattern with named capture groups.
Example: "a date in the 格式化 YYYY-MM-DD, like 2024-01-15" → (?P\d{4})-(?P\d{2})-(?P\d{2})
/convert-natural-language --模式
Natural language → JSON 模式 or TypeScript interface. Converts a description of a data structure into a formal 模式 definition.
Example: "an array of order objects, each with order_id (string), amount (number), 状态 (enum: pending/pAId/refunded), and optional notes" → TypeScript interface or JSON 模式.
/convert-natural-language --command
Natural language → shell command or 命令行工具 command. Converts a description into a valid shell command (bash, zsh) or 命令行工具 工具 invocation (git, docker, kubectl, etc.).
Example: "show me all docker contAIners that are 停止ped" → docker ps -a --过滤器 "状态=exited"
Execution Steps Step 1: Identify tar获取 格式化 and intent
检测 tar获取 格式化 from user 输入:
ContAIns "SQL", "查询", "database" → --sql ContAIns "JSON", "data structure", "object", "模式" → --json or --模式 ContAIns "API", "端点", "获取", "POST", "请求", "call" → --API ContAIns "搜索", "find articles", "google", "look for" → --搜索 ContAIns "regex", "pattern", "match", "验证 格式化" → --regex ContAIns "command", "terminal", "运行", "执行", "docker", "kubectl", "git" → --command
If 格式化 is still ambiguous, ask: "Should this be converted to SQL, JSON, an API call, a 搜索 查询, or another 格式化?"
Identify intent 组件s from the 输入:
Action: what to do (SELECT, 创建, 搜索, 验证, etc.) Subject: the primary entity (users, orders, articles) Conditions: 过滤器s, constrAInts (date ranges, 状态 values, IDs) Fields: what to return or include (columns, properties) Modifiers:排序 (order by), limit, group by Step 2: 提取 entities and map to structured syntax
Entity 提取ion patterns:
Natural language SQL JSON API Regex "all", "every", "everything" SELECT no 过滤器 no 查询 param . "last N days/weeks/months" WHERE ts >= NOW() - INTERVAL 'N days' {"gte": "2024-01-01"} &after=2024-01-01 \d{4}-\d{2}-\d{2} "never", "no", "without" WHERE id NOT IN (...) or WHERE field IS NULL {"exists": false} &has_field=false negative lookahead "contAIns", "includes" WHERE col LIKE '%text%' {"contAIns": "text"} &q=text .text.* "or more", "at least" WHERE amount >= N {"gte": N} &min=N \d+ "optional", "may have" field = NULL allowed {"type": "null"} omitempty in 模式 quantifier ? "one of", "either A or B" WHERE 状态 IN ('A', 'B') {"enum": ["A", "B"]} &状态=A,B `(A "排序ed by",