web-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Web Search

网页搜索

This skill uses
duckduckgo-cli
— a command-line search tool that returns DuckDuckGo results as plain text or JSON. It's built for LLM agents: plain text output is compact (title, URL, snippet per result) and the flags let you control time, region, site, and count.
本技能使用
duckduckgo-cli
——一款命令行搜索工具,可将DuckDuckGo的搜索结果以纯文本或JSON格式返回。它专为LLM Agent设计:纯文本输出简洁紧凑(每条结果包含标题、URL和摘要片段),通过参数可控制搜索的时间范围、地区、站点和结果数量。

When to reach for this

适用场景

  • The user asks about something recent ("latest", "today", "current", a year at or past your knowledge cutoff)
  • A claim needs verification
  • Documentation, references, or external context is needed
  • The user asks to search, look up, find out, research, or check something
  • You're answering a factual question and you're not sure your knowledge is current
Once you're already in a conversation, you don't need explicit permission — just search.
  • 用户询问近期相关内容(如“最新”“今日”“当前”,或涉及模型知识 cutoff 时间之后的年份)
  • 需要验证某个主张
  • 需要获取文档、参考资料或外部背景信息
  • 用户要求进行搜索、查询、查明、研究或核实某件事
  • 你在回答事实类问题,但不确定自身知识是否为最新状态
在对话过程中,无需用户明确许可,直接进行搜索即可。

Command

命令

The CLI is invoked as
ddg
(a short alias for
duckduckgo-cli
).
sh
ddg rust async tutorial             # plain text, default 10 results
ddg -n 5 "best Rust web framework 2026"
ddg --json -n 5 "topic"              # JSON envelope, for parsing
echo "tokio runtime overhead" | ddg  # query via stdin
Plain text is the default and the right choice for most uses — it's compact and you can quote URLs and snippets straight out of it.
该命令行工具可通过别名
ddg
调用(
duckduckgo-cli
的简写)。
sh
ddg rust async tutorial             # plain text, default 10 results
ddg -n 5 "best Rust web framework 2026"
ddg --json -n 5 "topic"              # JSON envelope, for parsing
echo "tokio runtime overhead" | ddg  # query via stdin
纯文本是默认输出格式,也是大多数场景的首选——它简洁紧凑,你可以直接引用其中的URL和摘要片段。

Flags worth knowing

实用参数说明

-n <N>
— number of results (1–100, default 10). Use 3–5 for quick lookups, 10–20 for broader research. More results cost tokens and the long tail rarely helps.
-t <d|w|m|y>
— restrict to past day / week / month / year. Critical for "latest" or "recent" questions — without it, evergreen pages outrank fresh ones and you'll quote stale info.
-w <DOMAIN>
— repeatable site filter. Use for official docs (
-w docs.python.org
), known-trusted sources, or to dodge spam.
-r <CODE>
— region (e.g.,
us-en
,
kr-ko
,
jp-jp
,
de-de
). Match the language of the query. Run
ddg --list-regions
to see them all.
--json
— compact JSON envelope. Use only when parsing programmatically (counting results, extracting URLs into a script). For ordinary reading and citing, plain text is better.
--page <N>
— paginate when the first page didn't have what you needed.
-n <N>
— 设置结果数量(范围1–100,默认10条)。快速查询时使用3–5条,更广泛的研究可使用10–20条。结果数量过多会消耗更多tokens,且长尾结果通常帮助不大。
-t <d|w|m|y>
— 将搜索范围限制在过去的一天/一周/一月/一年。这对“最新”或“近期”类问题至关重要——如果不设置该参数,常青内容页面会优先于新内容,导致你引用过时信息。
-w <DOMAIN>
— 可重复使用的站点筛选参数。用于搜索官方文档(如
-w docs.python.org
)、可信来源,或规避垃圾内容。
-r <CODE>
— 设置地区(例如
us-en
、
kr-ko
、
jp-jp
、
de-de
)。需与查询语言匹配。运行
ddg --list-regions
可查看所有地区代码。
--json
— 生成紧凑的JSON格式结果。仅在需要程序化解析时使用(如统计结果数量、将URL提取到脚本中)。对于常规阅读和引用,纯文本格式更合适。
--page <N>
— 当第一页结果不符合需求时,用于分页查询。

Patterns

使用模式

Quick fact lookup

快速事实查询

sh
ddg -n 3 "current ceo of openai"
Three results is enough to triangulate a consensus answer.
sh
ddg -n 3 "current ceo of openai"
三条结果足以通过交叉验证得出一致答案。

Latest news / recent updates

最新新闻/近期动态

sh
ddg -n 5 -t w "anthropic claude release"
The
-t w
filter is what makes this useful — without it you'll get older articles that rank well.
sh
ddg -n 5 -t w "anthropic claude release"
-t w
参数是该查询有效的关键——如果不设置,你会得到排名靠前但较旧的文章。

Documentation

文档查询

sh
ddg -n 5 -w docs.python.org "asyncio gather exception"
sh
ddg -n 5 -w docs.python.org "asyncio gather exception"

Fact-check a specific claim

事实核查特定主张

sh
ddg -n 5 "the exact phrasing of the claim"
Read snippets carefully. If sources disagree, surface that to the user — don't pick one and present it as fact.
sh
ddg -n 5 "the exact phrasing of the claim"
仔细阅读摘要片段。如果来源之间存在分歧,需向用户说明这一点——不要随意选择一个来源并将其表述为事实。

Broader research

深度研究

Run several focused queries rather than one giant one. Three
-n 10
queries on different angles beat one
-n 30
.
执行多个针对性查询,而非一个宽泛的查询。从不同角度进行三次
-n 10
的查询效果优于一次
-n 30
的查询。

Reading the output

结果解读

Each result has a position, title, URL, and a short snippet. The snippet is usually enough to decide whether to fetch the page in full with
WebFetch
. When citing to the user, include the URL so they can verify; if you only have a snippet, say "from the search snippet..." rather than implying you read the whole page.
每条结果包含序号、标题、URL和简短摘要。通常通过摘要即可判断是否需要使用
WebFetch
获取完整页面内容。向用户引用内容时,需附上URL供其验证;如果仅使用了摘要片段,需说明“来自搜索摘要……”,而非暗示你已阅读完整页面。

Gotchas

注意事项

  • Rate limits: in
    --json
    mode the response includes
    meta.rate_limit.tokens_remaining
    . If it hits 0, back off — don't fire more queries in a tight loop.
  • No instant answer is normal — most queries just return the numbered list.
  • Region must match language — a Korean query with
    -r us-en
    will return weaker results; use
    -r kr-ko
    .
  • Don't pipe to
    head
    to truncate
    — use
    -n
    instead, otherwise a result may get chopped mid-snippet.
  • If the binary isn't installed, install with
    npm i -g duckduckgo-cli
    or
    cargo install duckduckgo-cli
    .
  • 速率限制:在
    --json
    模式下,响应结果包含
    meta.rate_limit.tokens_remaining
    字段。当该值为0时,需暂停查询——不要在短时间内连续发起更多请求。
  • 无即时答案是正常现象——大多数查询只会返回编号列表形式的结果。
  • 地区需与语言匹配——如果用韩语查询却设置
    -r us-en
    ,结果质量会很差;应使用
    -r kr-ko
    。
  • 不要通过管道符
    head
    截断结果
    ——请使用
    -n
    参数,否则可能会截断摘要片段的内容。
  • 如果未安装该工具,可通过
    npm i -g duckduckgo-cli
    或
    cargo install duckduckgo-cli
    命令进行安装。