AI Productivity / Agent Skills

在 Codex 里安装 answer-me-with-html 并把它调成按需触发:两层防线(skill 描述 + 全局规则)、skills 路径不一致的坑,以及一套可复现的验证方法。

answer-me-with-html

工具的触发时机是产品决策,不该是默认值。

为什么做

Why this exists

我想要的是一个"需要时才出现"的工具,而不是一个"每次回答都顺手带一页"的工具。answer-me-with-html 能把复杂问题变成一页可读的讲解,但它的上游默认姿态是尽量多用:描述里明确写着"没被要求也要用、拿不准就用"。在普通问答里,这种主动性会变成噪音——我只是想知道 Redis 和 Memcached 的取舍,却被附带了一整页。

I wanted a tool that appears when the task needs it, not one that attaches a page to every answer. answer-me-with-html turns a complex question into a readable single page, but its upstream default posture is eager: the description literally asks for it to fire even when nobody asked. On ordinary Q&A that eagerness becomes noise.

能力越主动的工具,越需要一条明确的"什么时候不许动"的规则。

The more eager a tool is, the more it needs an explicit rule about when it must not fire.

这件事的本质不是"装一个 skill",而是把触发时机从模型的默认倾向,改成一个由我定义、并且能被验证的策略。

The real work is not installing a skill. It is turning the trigger condition into a policy I define and can verify.

三个具体问题

Three problems to solve

  1. 01

    默认姿态过于宽松

    An eager default

    skill 描述决定它会不会被自动选中。上游写的"主动且宽松地使用",等于把决定权交给了模型的即时判断。

    The skill description decides whether it gets selected automatically. An upstream description that says "use it proactively" hands that decision to the model's momentary judgement.

  2. 02

    装了却看不见

    Installed but invisible

    安装器把 skill 放在 ~/.agents/skills/,而 Codex 读的是 ~/.codex/skills/。路径不一致时,装完不会报错,只是永远不触发。

    The installer writes to ~/.agents/skills/, while Codex reads ~/.codex/skills/. When the paths disagree nothing errors — the skill simply never fires.

  3. 03

    只改描述不够稳

    Editing the description is not enough

    skill 更新会用上游版本覆盖描述文件。任何"只靠改描述"的方案,都会在下一次更新时被静默回退。

    A skill update overwrites the description with the upstream copy, so any fix that lives only there is silently reverted the next time you update.

安装与路径

Install and path

用官方安装器装到全局,装完先做安全扫描的确认:Socket 0 alerts、Snyk low risk。真身落在 ~/.agents/skills/answer-me-with-html。

Install globally with the official installer, then confirm the security scan reports (Socket 0 alerts, Snyk low risk). The real files land in ~/.agents/skills/answer-me-with-html.

npx skills add QingYunA/answer-me-with-html -g -y -a codex npx skills add QingYunA/answer-me-with-html -g -y -a codex # 安装器落在 ~/.agents/skills/,Codex 读的是 ~/.codex/skills/,需要一条软链 # The installer writes to ~/.agents/skills/; Codex reads ~/.codex/skills/, so link the two ln -s ~/.agents/skills/answer-me-with-html ~/.codex/skills/answer-me-with-html ln -s ~/.agents/skills/answer-me-with-html ~/.codex/skills/answer-me-with-html ls -l ~/.codex/skills/answer-me-with-html   # 确认链接指向真身 ls -l ~/.codex/skills/answer-me-with-html   # confirm the link target

用软链而不是复制,是因为以后 npx skills update 更新的是真身,链接自动跟着新版本走。复制一份的话,第一次更新就会产生两个版本,而你调用的可能还是旧的。

Prefer a symlink over a copy: npx skills update refreshes the real directory and the link follows. A copy diverges on the first update, and the stale one may be the one that gets loaded.

两层触发防线

A two-layer trigger policy

关键是分清楚两件事:模型"想不想得起来用它"和"能不能自己决定用它"。前者由 skill 描述决定,后者由规则决定。两层一起做,才不会互相抵消。

Separate two questions: whether the model thinks of the tool, and whether the model is allowed to use it on its own. The skill description controls the first; a rule controls the second. Both layers are needed.

01安装到全局Install globally真身 + 软链,先让它看得见Real files plus symlink, so Codex sees it
02收紧描述Tighten the description只在你要求时使用,不主动附带Fire only on request, never attach unasked
03加全局规则Add a global rule写进 AGENTS.md,更新也不会被动Written to AGENTS.md, survives updates
04新会话验证Verify in a new session反例不出页面,正例正常出页面No page when it should not, a page when it should

第一层:skill 描述

Layer one: the description

描述决定 skill 会不会被自动选中,属于软约束。把它改成"只在你要求页面、图示、可视化或视频,或点名这个 skill 时使用;不要自作主张给普通回答附带页面"。

The description decides automatic selection, so it is a soft control. Rewrite it to: fire only when asked for a page, diagram, visual explanation or video, or when named directly; never attach a page to an ordinary answer.

第二层:全局规则

Layer two: the global rule

在 ~/.codex/AGENTS.md 里加一条按需触发条款。它不随 skill 更新变化,是描述被改回宽松版之后的唯一防线。

Add an on-demand clause to ~/.codex/AGENTS.md. It does not change when the skill updates, so it is the backstop for the day the description is restored upstream.

写进全局规则的那条:除非我明确要求生成页面、图示、可视化讲解或视频,否则不要使用 answer-me-with-html skill,也不要在普通回答里附带生成好的页面。

The clause that went into the global rules: unless a page, diagram, visual explanation or video is explicitly requested, do not use the answer-me-with-html skill and do not attach a generated page to an ordinary answer.

怎么验证

How to verify

只测"该出页面时出了页面"是不够的——那可能只是 skill 根本没装上。验证要同时覆盖反向:不该触发的时候,既不出页面,也不产生任何副作用。

Testing only the positive case is not enough: a missing skill also produces no page. Verification must cover the negative case too — no page and no side effects.

测试Test期望Expected实测结果Observed
新会话里问"讲讲 TCP 三次握手和四次挥手"(上游默认配置下必然出页面的题目)A new session asks about the TCP three-way handshake (a question that always produced a page under the default config) 不出页面,且不产生文件No page, no files 没出页面,~/.answer-me-with-html 目录没有被创建No page, and the page directory was never created
新会话里说"用 HTML 讲一下 Redis 和 Memcached 怎么选"A new session asks for an HTML explanation of Redis versus Memcached 正常出页面,写作检查通过A page renders and passes the writing check 出了页面:7 个面板、sheet + blueprint 主题、STE 写作检查 0 警告Page rendered: seven panels, sheet plus blueprint theme, zero writing warnings
新会话的 skill 清单Skill list in a new session 能看见这个 skillThe skill is listed 已包含 answer-me-with-htmlanswer-me-with-html is present
  • 用"目录有没有被创建"当客观信号,比"我觉得没出页面"硬得多——它是可复查的副作用。
  • Use "was the output directory created" as the objective signal. It is a checkable side effect, not an impression.
  • 第三条不能省:没有它,"没触发"也可能只是"没装上",前两条就都失去意义。
  • Do not skip the third check. Without it, "did not fire" may simply mean "was never installed".
  • skill 清单在会话启动时读取,所以改完必须新开会话才算真正验证。
  • The skill list is read when a session starts, so the verification only counts in a new session.

怎么用

How to use it

要页面就直接说,不需要记住任何命令;不想经过 Agent 时,也可以直接用 CLI 渲染本地草稿。

Ask in plain language when you want a page. When you would rather skip the agent, render a local draft straight from the CLI.

用 HTML 讲一下 X / 画个图 / 出个页面 / 没看懂,给我看一页 Explain X in HTML / draw it / make a page / I do not get it, show me one page 做个 3b1b 风格视频 Make a 3b1b-style video AM=~/.codex/skills/answer-me-with-html/scripts/am.mjs   # CLI 入口 AM=~/.codex/skills/answer-me-with-html/scripts/am.mjs   # CLI entry point node $AM render notes.md --no-open -o out.html node $AM render notes.md --no-open -o out.html node $AM config   # 主题、是否自动开浏览器、写作检查强度、配音 node $AM config   # theme, auto-open, writing-check level, narration node $AM help flow   # 组件语法,如 flow / sequence / tree node $AM help flow   # component syntax such as flow, sequence, tree

边界与注意事项

Limits and caveats

更新会覆盖描述

Updates overwrite the description

跑 npx skills update answer-me-with-html -y 之后,描述会变回"主动且宽松"。全局规则仍然拦得住,但第一层退化成软约束,需要重新收紧一次。

After npx skills update answer-me-with-html -y the description returns to the eager upstream wording. The global rule still holds, but layer one becomes soft again.

安装器有 Node 版本门槛

The installer needs a newer Node

skills@1.7.0 要求 Node 不小于 22.20.0,本机 v22.15.0 只报了警告,安装照常完成。以后再遇到奇怪的安装错误,先升级 Node 再排查。

skills@1.7.0 asks for Node 22.20.0 or newer. The local v22.15.0 only produced a warning and the install completed; treat the version as the first suspect for odd install errors.

可以更严格

You can go stricter

在 skill 目录下加 agents/openai.yaml,写 policy: allow_implicit_invocation: false,模型就完全不会自主调用,只有点名才生效。代价是"用 HTML 讲一下"这类自然语言也不再触发。

Add agents/openai.yaml in the skill directory with policy: allow_implicit_invocation: false and the model can never invoke it on its own. The cost is that plain-language requests stop working too.

页面目录按需创建

The page directory appears on demand

第一次真正出页面时才会创建 ~/.answer-me-with-html/。验证过程会临时写到隔离目录,不污染家目录;清理前可以先用 am clean --dry-run 看会删什么。

The real page directory is created the first time a page is produced. Verification writes to an isolated temp home instead; run am clean --dry-run before deleting anything.

可迁移的经验

What generalises

  • 工具的触发时机是产品决策。同一个能力,"什么时候用"要和"怎么用"一起设计,否则能力越强噪音越大。
  • Trigger policy is a product decision. Design when a capability fires alongside how it works, or stronger tools only add noise.
  • 配置和规则要分工:声明式描述决定"想不想得起来",硬规则决定"能不能自己动手"。只做一层,迟早被更新或误判冲掉。
  • Split the responsibilities: the declarative description controls recall, a hard rule controls autonomous action. One layer alone gets eroded by updates or bad judgement.
  • 验证要挑可复查的信号(目录、文件、清单),而不是感觉。反向用例和正向用例同等重要。
  • Verify with checkable signals — directories, files, lists — not impressions, and treat the negative case as equal to the positive one.