关于 croql
帮助用户将自然语言筛选需求转换为有效 Crowdin CroQL 表达式的 Skill,适用于构造源字符串、翻译、翻译记忆和术语筛选。它会检查字段上下文、语言范围及查询语法,并在需求不明确时提供备选表达式。
主要功能
- 01将筛选需求转为 CroQL
- 02覆盖多种 Crowdin 数据上下文
- 03组合逻辑与嵌套筛选条件
- 04检查字段及语言范围
- 05提供查询示例与备选方案
适用场景
- 01筛选特定语言的翻译
- 02查找未翻译或未批准的字符串
- 03按术语状态或翻译记忆记录查询
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ crowdin/ skills --skill croql安装后在 Claude Code 中输入/croql确认已加载。
附带文件evals/evals.json
详细介绍
CroQL 技能
使用此技能将自然语言筛选目标转换为有效的 Crowdin CroQL 表达式。
完整文档
输出内容
协助处理 CroQL 时,请返回:
- 一个主要的 CroQL 表达式。
- 简短说明它为何符合请求。
- 如果请求存在歧义,可选提供一个更严格或更宽泛的变体。
快速工作流程
- 确定数据上下文:
- 源字符串
- 语言翻译
- TM 片段
- 术语库词条
- 将用户意图映射到 CroQL 字段和运算符。
- 将查询拆分为小子句,并使用
and/or组合。 - 检查可能的陷阱(上下文字段错误、缺少语言范围、查询未编码)。
- 提供最终查询和可直接运行的端点示例。
核心语法速查表
- 比较:
=、!=、>、>=、<、<=、between ... and ...、contains - 逻辑:
and、or、xor、not - 筛选集合:
collection where (predicate) - 计数:
count of translations、count of comments where (...) - 对象成员访问:
id of file、count of votes - 提及:
- 用户:
@user:"username" - 语言:
@language:"uk"
- 用户:
上下文相关的查询模式
选择属于正确上下文的字段。常见错误之一是使用其他上下文中的字段。
1)源字符串上下文
常见字段:
text、identifier、contextis hidden、is duplicatecount of translations、count of comments、count of screenshotscount of languages summary where (...)id of file、added、updated- Enterprise 字段筛选:
count of fields where (name = "Priority" and value = "High") > 0
示例:
- 已隐藏、非重复且有翻译:
is hidden and not is duplicate and count of translations > 0
- 源文本包含
ABC,但翻译不包含:text contains "ABC" and count of translations where (text contains "ABC") = 0
- 至少有一种语言存在一项审核:
count of languages summary where (approvalsCount >= 1) > 0
2)翻译上下文
常见字段:
text、plural form、is pre translated、provider、user、updated- 嵌套字段:
count of votes where (is up)、count of approvals where (...)
示例:
- 由特定用户提交或获得大量赞同:
user = @user:"crowdin" or count of votes where (is up) >= 100
3)TM 片段上下文
常见结构是基于记录的:
count of records where (usageCount > 0) > 0count of records where (createdBy = @user:"crowdin") > 0
4)术语库词条上下文
常见字段:
text、description、language、user、partOfSpeech、status、type、gendernote、lemma、url、createdAt、updatedAt
示例:
- 已废弃或不推荐:
status = "not_recommended" or status = "obsolete"
- 英语词元:
lemma = "cancel" and language = @language:"en"
高级编辑器风格筛选条件
以下是用户尝试在 API 调用中复现 UI 筛选条件时常见的请求:
- 未翻译:
count of languages summary = 0
- 已翻译:
count of languages summary where (is translated) > 0
- 已审核:
count of languages summary where (is approved) > 0
- 存在 QA 问题:
count of languages summary where (has qa issues) > 0
- 仅重复项:
is duplicate
如果目标语言很重要,请明确限定范围:
count of languages summary where (language = @language:"uk" and is translated) > 0
查询构建策略
如果用户请求信息不完整:
- 从最严格的解释开始。
- 提供一个更宽泛的备用查询。
- 说明假设发生了哪些变化(语言范围、审核门槛、日期范围等)。
示例:
- 严格:
count of languages summary where (language = @language:"uk" and is translated and not is approved) > 0
- 更宽泛:
count of languages summary where (is translated and not is approved) > 0
应避免的常见错误
- 混用源字符串字段与仅用于翻译或词汇表的字段。
- 在 API 中复现 Editor 筛选条件时,忘记限定语言范围。
- 在请求 URL 中使用未编码的原始 CroQL。
- 在嵌套的
where子句中遗漏括号。 - 过度使用
or,却没有对条件进行分组。
评论
支持 Markdown