逐日AI

面试题库

共 328 题,当前筛选 1 题。

7 天 Agent Skills:把经验做成可复用能力

D2 写第一个 skill:description 的触发词怎么写、结构怎么分层、怎么装进客户端

  • 项目级和用户级的 skill 同名时该怎么处理?为什么各家客户端在这一点上会有不同的选择?How should a client resolve a name collision between a project-level and a user-level skill, and why do clients differ here?
    国内高频海外高频深入#agent-skills#client-integration

    分析过程 · 先想清楚再作答

    1. 这题看起来是细节题,实际在考你有没有真的装过、有没有踩过。标准答案背后有一个分歧,能说出分歧的人一眼就是实操过的。
    2. 先给通行约定:跨客户端的普遍做法是**项目级压过用户级**,理由是离手头这份代码越近的配置越具体,理应赢。同一作用域内两个目录撞名,先找到还是后找到都行,但必须固定一种并保持一致。
    3. 再给分歧:具体客户端可以有自己的层级。Claude Code 的文档给出的顺序是企业级、个人级、项目级由高到低——**个人级压过项目级**,理由是不希望一个仓库带进来的 skill 悄悄覆盖掉你自己配的同名 skill。
    4. 把两种设计的取舍讲清楚,这是本题真正的区分度:项目优先换来的是「团队约定自动生效」,用户优先换来的是「不被陌生仓库劫持」。它们各自解决的是不同的风险。
    5. 顺势带出信任问题:项目级 skill 可能来自一个你刚 clone 的陌生仓库,等于让它往你的会话里注入指令。所以多数客户端把项目级加载挂在「信任这个目录」的开关后面。
    6. 可预期的追问是「撞名了怎么发现」。答案是客户端一般会打一条被遮蔽的警告,那条日志是排查的第一现场;实现方也应该在这种时候记录诊断信息而不是静默丢弃。

    How to reason about it · think before answering

    1. It looks like trivia but it tests whether you have actually installed skills. There is a real disagreement here, and naming it marks you as someone who has hit it.
    2. Start with the common convention: project-level overrides user-level, because configuration closer to the code at hand is more specific. Within one scope, first-found or last-found are both acceptable as long as you pick one and stay consistent.
    3. Then the divergence: Claude Code documents enterprise, then personal, then project, so personal wins over project, so that a cloned repository cannot silently shadow the skill you configured yourself.
    4. Explain the trade-off, which is where the marks are: project-first buys automatic team conventions, user-first buys protection from hijacking by an unfamiliar repository.
    5. Bring in trust: project-level skills can arrive with a freshly cloned repository and inject instructions into your session, which is why most clients gate them behind a folder-trust check.
    6. Expected follow-up: how do you notice a collision? Clients normally log a shadowed-skill warning, and implementers should record diagnostics rather than dropping the skill silently.

    答题要点

    • 通行约定是项目级压过用户级,同作用域内固定一种顺序并保持一致。
    • 具体客户端可以不同,比如 Claude Code 的顺序是企业级、个人级、项目级。
    • 项目优先换来团队约定自动生效,用户优先换来不被陌生仓库劫持。
    • 项目级 skill 可能来自不可信仓库,加载应挂在目录信任检查后面。
    • 撞名要打警告并记录诊断,不能静默遮蔽。

    Key points

    • The common convention is project over user, with a fixed, consistent rule inside a single scope.
    • Clients may differ: Claude Code documents enterprise, then personal, then project.
    • Project-first gives automatic team conventions; user-first prevents hijacking by an unfamiliar repository.
    • Project-level skills can come from untrusted repositories, so gate them behind a folder trust check.
    • Log a warning and record diagnostics on a collision instead of silently shadowing.