lov-find-logo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Logo 雷达 · Logo Radar

Logo 雷达 · Logo Radar

Takes a brand name or URL, probes Clearbit + the site's own og:image /
<link rel=icon>
/ favicon, scores each candidate, and archives the best one plus a couple of alternates into the configured collection directory.
输入品牌名称或 URL,探测 Clearbit 以及网站自身的 og:image /
<link rel=icon>
/ favicon,对每个候选结果进行评分,并将最佳结果和另外两个备选结果归档到已配置的收藏目录。

When to Use

使用时机

  • User asks to collect one or more brand logos for a slide/poster/site lineup
  • User names companies to drop into a partners/press strip
  • User gives a URL and wants its logo pulled down cleanly
  • 用户要求为幻灯片、海报或网站中的品牌展示区收集一个或多个 Logo
  • 用户指定公司名称,用于制作合作伙伴或媒体展示区域
  • 用户提供 URL,并希望干净地下载其 Logo

Workflow (MANDATORY)

工作流(必须执行)

Step 1: Identify each brand

第 1 步:识别每个品牌

Accept any mix of names and URLs. If the user gave only a name with no obvious domain, ask — don't silently guess
.com
(script will guess, but for non-US or ambiguous brands that fails).
Use
AskUserQuestion
when:
  • Brand name is ambiguous (e.g. "Apple" = fruit vs. Inc.)
  • No URL and the domain isn't guessable (
    xAI
    →
    x.ai
    , not
    xai.com
    )
  • User gave a list without URLs
可以接受名称和 URL 的任意组合。如果用户只提供了名称且没有明显的域名,应主动询问——不要擅自猜测
.com
(脚本会进行猜测,但对非美国或名称有歧义的品牌会失败)。
出现以下情况时使用
AskUserQuestion
:
  • 品牌名称存在歧义(例如,“Apple”可能指水果,也可能指 Apple Inc.)
  • 没有 URL 且域名无法可靠猜出(
    xAI
    →
    x.ai
    ,而不是
    xai.com
    )
  • 用户提供的是品牌列表,且其中不包含 URL

Step 2: Fetch — one brand per invocation

第 2 步:获取——每次调用处理一个品牌

bash
python3 scripts/find_logo.py --name "Anthropic" --url https://anthropic.com --json
For a batch, loop; the script is idempotent per
<slug>/
(re-runs overwrite).
bash
python3 scripts/find_logo.py --name "Anthropic" --url https://anthropic.com --json
批量处理时,循环执行即可;脚本对每个
<slug>/
目录都是幂等的(重新运行会覆盖现有文件)。

Step 3: Inspect score; fall back to WebSearch if needed

第 3 步:检查评分;必要时回退到 WebSearch

  • Exit code
    0
    → logo archived. The printed
    score
    is your quality signal:
    • ≥ 60
      — solid: SVG or transparent PNG with wide/square aspect
    • 20–60
      — usable: probably a favicon or small PNG
    • < 20
      — weak: only ICO or tiny stub found
  • Exit code
    2
    /
    status: "no-candidates"
    → script found nothing. Do NOT give up. Use
    WebSearch
    for
    "<brand> logo svg site:*.com"
    or the brand's press-kit page, then re-invoke with
    --url <direct-image-url>
    is not supported — if you have a direct image URL, save it into the configured collection directory under
    <slug>/logo.<ext>
    and hand-write
    meta.json
    using the existing layout as a template.
  • 退出码
    0
    → Logo 已归档。输出的
    score
    是质量信号:
    • ≥ 60
      — 优质:SVG 或透明 PNG,具有宽幅或正方形宽高比
    • 20–60
      — 可用:可能是 favicon 或小尺寸 PNG
    • < 20
      — 较弱:仅找到 ICO 或极小的占位图
  • 退出码
    2
    /
    status: "no-candidates"
    → 脚本未找到任何内容。 不要放弃。使用
    WebSearch
    搜索
    "<brand> logo svg site:*.com"
    或查找品牌的 press-kit 页面。找到直接图片 URL 后,不支持通过
    --url <direct-image-url>
    重新调用;请将图片保存到已配置收藏目录中的
    <slug>/logo.<ext>
    ,并参照现有布局手动编写
    meta.json
    。

Step 4: Report

第 4 步:报告

Report back with the archive path and the primary's aspect + format. If the score is weak, tell the user and offer to retry with a specific press-kit URL or Wikipedia SVG.
报告归档路径以及主 Logo 的宽高比和格式。如果评分较弱,应告知用户,并提供使用特定 press-kit URL 或 Wikipedia SVG 重试的选项。

CLI Reference

CLI 参考

ArgumentDefaultDescription
--name
—Brand/product name. Used for slug + meta.
--url
—Official URL or bare domain. Overrides the name-based domain guess.
--slug
slugified nameOverride the directory slug under the archive root.
--out
SKILL_FIND_LOGO_OUTPUT_DIR
or
~/.lovstudio/logo-collection
Archive root.
--keep-alts
2
How many runner-up candidates to keep as
alt-N.<ext>
.
--json
offEmit a JSON result to stdout (use this when chaining).
At least one of
--name
or
--url
is required.
参数默认值说明
--name
—品牌/产品名称。用于生成 slug 和 meta。
--url
—官方 URL 或纯域名。覆盖根据名称猜测域名的结果。
--slug
名称的 slug 化结果覆盖归档根目录下的目录 slug。
--out
SKILL_FIND_LOGO_OUTPUT_DIR
或
~/.lovstudio/logo-collection
归档根目录。
--keep-alts
2
保留为
alt-N.<ext>
的备选候选数量。
--json
关闭向 stdout 输出 JSON 结果(链式调用时使用)。
--name
和
--url
至少需要提供一个。

Archive Layout

归档布局

~/.lovstudio/logo-collection/
├── anthropic/
│   ├── logo.png            # primary (highest score)
│   ├── alt-1.png           # runner-ups
│   ├── alt-2.png
│   └── meta.json           # sources, scores, dimensions, fetched_at
├── vercel/
│   ├── logo.png            # 1200x628 transparent banner
│   └── ...
└── stripe/
    ├── logo.svg
    └── ...
~/.lovstudio/logo-collection/
├── anthropic/
│   ├── logo.png            # primary (highest score)
│   ├── alt-1.png           # runner-ups
│   ├── alt-2.png
│   └── meta.json           # sources, scores, dimensions, fetched_at
├── vercel/
│   ├── logo.png            # 1200x628 transparent banner
│   └── ...
└── stripe/
    ├── logo.svg
    └── ...

Scoring Heuristic (why a candidate wins)

评分启发式规则(为何某个候选项会胜出)

  • Format: SVG (+40) > PNG (+20) > WebP (+10) > JPG (-10) > ICO (-20)
  • Transparency:
    +30
    if alpha channel present (SVG always counts)
  • Aspect ratio:
    +25
    for wide (≥2:1),
    +10
    for landscape (≥1.3:1),
    -5
    for square,
    -15
    for tall/portrait
  • Short edge:
    +15
    if ≥128px,
    +5
    if ≥64px,
    -20
    if <32px
  • Size sanity:
    -30
    if payload <400 bytes (almost certainly a stub)
This matches the "prefer 长条形 + rgba" preference — wide transparent logos come out on top, square favicons land as alternates.
  • 格式:SVG (+40) > PNG (+20) > WebP (+10) > JPG (-10) > ICO (-20)
  • 透明度:存在 alpha 通道时
    +30
    (SVG 始终计为透明)
  • 宽高比:宽幅(≥2:1)为
    +25
    ,横向(≥1.3:1)为
    +10
    ,正方形为
    -5
    ,竖向或纵向为
    -15
  • 短边:≥128px 为
    +15
    ,≥64px 为
    +5
    ,<32px 为
    -20
  • 体积合理性:文件负载 <400 字节时为
    -30
    (几乎可以确定是占位文件)
这符合“优先长条形 + rgba”的偏好——宽幅透明 Logo 会排在最前,方形 favicon 则归入备选。

Dependencies

依赖项

Stdlib only (urllib, html.parser, argparse). No
pip install
required.
仅使用标准库(urllib、html.parser、argparse)。无需执行
pip install
。

User Configuration

用户配置

Default archive files live under
~/.lovstudio/logo-collection/
. Override this per run with
--out
, or set
SKILL_FIND_LOGO_OUTPUT_DIR
for the skill.
默认归档文件位于
~/.lovstudio/logo-collection/
下。每次运行可通过
--out
覆盖该目录,也可为该 Skill 设置
SKILL_FIND_LOGO_OUTPUT_DIR
。

Known Limits

已知限制

  • The name → domain guess is a crude lowercase-strip +
    .com
    suffix. For anything not on
    .com
    , pass
    --url
    explicitly.
  • No Clearbit API key is used — we hit the unauthenticated endpoint, which covers most major brands but not all.
  • WebSearch
    fallback is Claude's responsibility, not the script's.
  • 从名称猜测域名的逻辑只是将名称转为小写、清理字符并添加
    .com
    后缀。对于任何不在
    .com
    上的品牌,请显式传入
    --url
    。
  • 不使用 Clearbit API key——脚本会访问无需身份验证的端点,能够覆盖大多数大型品牌,但并非全部。
  • WebSearch
    回退由 Claude 负责,而不是脚本。

Runtime context (shared)

运行时上下文(共享)

运行前读取本 Skill 包的
skill.yaml
,由宿主提供
skill-runtime/v1
上下文。字段解析顺序为:当前请求、项目上下文、个人 Preferences、品牌 Profile、通用默认值。
  • 只使用 Manifest 声明的字段;Profile 保存公开品牌事实,Preferences 保存个人工作偏好。
  • required: true
    字段缺失时,按 Manifest 的问题配置向用户提出一个聚焦问题;用户明确同意后再保存回答。
  • 报错提供可复制的
    context_id
    、字段路径与来源,诊断内容避开秘密、完整私人路径和原始配置。
运行前读取本 Skill 包的
skill.yaml
,由宿主提供
skill-runtime/v1
上下文。字段解析顺序为:当前请求、项目上下文、个人 Preferences、品牌 Profile、通用默认值。
  • 只使用 Manifest 声明的字段;Profile 保存公开品牌事实,Preferences 保存个人工作偏好。
  • required: true
    字段缺失时,按 Manifest 的问题配置向用户提出一个聚焦问题;用户明确同意后再保存回答。
  • 报错提供可复制的
    context_id
    、字段路径与来源,诊断内容避开秘密、完整私人路径和原始配置。

通用反馈闭环

通用反馈闭环

用户在 Skill 驱动任务中提出修改意见时,继续当前产物前必须执行:
  1. 先判断意见是
    task-specific
    (仅本次)还是
    reusable
    (可跨任务复用)。
  2. task-specific
    只修改当前任务,不改 Skill。
  3. reusable
    先确定作用域:领域规则先更新对应 canonical Skill;适用于所有 Skill 的规则先更新共享规范。
  4. 完成规则更新、版本、lint 与分发核验后,再把修改应用到当前任务。
  5. reusable
    修改会使此前的“确认”“继续”“发吧”失效;完成当前产物修改和回读后必须停下,等待用户下一步指示,不自动进入发布、提交或其他外部写入。
用户在 Skill 驱动任务中提出修改意见时,继续当前产物前必须执行:
  1. 先判断意见是
    task-specific
    (仅本次)还是
    reusable
    (可跨任务复用)。
  2. task-specific
    只修改当前任务,不改 Skill。
  3. reusable
    先确定作用域:领域规则先更新对应 canonical Skill;适用于所有 Skill 的规则先更新共享规范。
  4. 完成规则更新、版本、lint 与分发核验后,再把修改应用到当前任务。
  5. reusable
    修改会使此前的“确认”“继续”“发吧”失效;完成当前产物修改和回读后必须停下,等待用户下一步指示,不自动进入发布、提交或其他外部写入。