zero-in

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Zero In

精准聚焦

<purpose> The #1 search failure: jumping straight to grep without thinking. You search "auth", get 200 results, grep again with "login", still garbage. The problem isn't the search - it's that you didn't zero in first. This skill forces the targeting that should happen BEFORE you hit enter. </purpose>
<purpose> 排名第一的搜索失败原因:不思考就直接使用grep搜索。你搜索“auth”,得到200条结果,再用“login”缩小范围,结果还是没用。问题不在于搜索本身——而是你没有先聚焦目标。这个技能会强制你在按下回车前完成目标定位。 </purpose>

When To Activate

激活时机

<triggers> - "Where is the..." - "Find the code that..." - "Search for..." - "How does X work in this codebase?" - About to explore an unfamiliar codebase - Previous search returned too many/wrong results - User says "I can't find..." </triggers>
<triggers> - “……在哪里?” - “找到处理……的代码” - “搜索……” - “X在这个代码库中是如何工作的?” - 即将探索不熟悉的代码库时 - 之前的搜索返回结果过多或结果不符时 - 用户表示“我找不到……”时 </triggers>

Instructions

操作步骤

Before ANY Search

搜索前必做

Answer these four questions:
<scope>
回答以下四个问题:
<scope>

1. What exactly am I looking for?

1. 我到底要找什么?

State it in one sentence. Be specific.
BAD:  "authentication stuff"
GOOD: "the function that validates JWT tokens on API requests"
If you can't state it in one sentence, you don't know what you're looking for. </scope>
<shape>
用一句话明确说明。要具体。
错误示例:“认证相关的东西”
正确示例:“在API请求中验证JWT令牌的函数”
如果你无法用一句话表述,说明你还不清楚自己要找什么。 </scope>
<shape>

2. What would the answer look like?

2. 答案会是什么样子?

Describe what you expect to find:
  • File type? (
    .ts
    ,
    .py
    ,
    .go
    , config file?)
  • Function, class, or config?
  • Roughly how big? (one-liner vs module?)
  • What would it import/use?
Example: "Probably a middleware function in TypeScript, imports jsonwebtoken
or jose, has 'verify' or 'validate' in the name, 20-50 lines"
</shape> <where>
描述你预期找到的内容:
  • 文件类型?(
    .ts
    ,
    .py
    ,
    .go
    , 配置文件?)
  • 是函数、类还是配置?
  • 大致规模?(单行代码 vs 模块?)
  • 会导入/使用什么?
示例:“可能是TypeScript编写的中间件函数,导入jsonwebtoken或jose库,名称包含'verify'或'validate',代码长度20-50行”
</shape> <where>

3. Where would it live?

3. 它可能存放在哪里?

Based on project conventions:
  • Which directory? (
    src/
    ,
    lib/
    ,
    middleware/
    ,
    utils/
    ?)
  • What would the file be named?
  • Near what other code?
Example: "Likely in src/middleware/ or src/auth/, file probably named
auth.ts, jwt.ts, or middleware.ts"
Check the project structure first if unsure:
bash
ls -la src/
find . -type d -name "*auth*" -o -name "*jwt*"
</where> <aliases>
根据项目约定判断:
  • 哪个目录?(
    src/
    ,
    lib/
    ,
    middleware/
    ,
    utils/
    ?)
  • 文件名可能是什么?
  • 会和哪些其他代码放在一起?
示例:“可能在src/middleware/或src/auth/目录下,文件名可能是auth.ts、jwt.ts或middleware.ts”
如果不确定,先查看项目结构:
bash
ls -la src/
find . -type d -name "*auth*" -o -name "*jwt*"
</where> <aliases>

4. What else might it be called?

4. 它还有哪些其他称呼?

List synonyms, abbreviations, variations:
Example for JWT validation:
- verify, validate, check, authenticate
- jwt, token, bearer, authorization
- middleware, handler, guard, interceptor
Your first search term is rarely the one the codebase uses. </aliases>
列出同义词、缩写、变体:
JWT验证的示例:
- verify, validate, check, authenticate
- jwt, token, bearer, authorization
- middleware, handler, guard, interceptor
你的第一次使用的搜索词很少是代码库中实际使用的术语。 </aliases>

Then Search

然后进行搜索

Now search, using insights from scoping:
bash
undefined
现在,结合定位的信息进行搜索:
bash
undefined

Start with WHERE + ALIASES

从位置+别名开始搜索

grep -r "verify.*token" src/middleware/ grep -r "jwt" src/auth/
grep -r "verify.*token" src/middleware/ grep -r "jwt" src/auth/

If needed, broaden

如果需要,扩大范围

grep -r "token" src/ --include="*.ts"
undefined
grep -r "token" src/ --include="*.ts"
undefined

Verify The Result

验证结果

Before declaring "found it":
  • Does this match what I described in step 2?
  • Is this THE thing, or just A thing that mentions it?
  • If it's a function, trace who calls it
  • If it's config, trace what uses it
在宣布“找到”之前:
  • 这是否符合我在步骤2中描述的样子?
  • 这正是我要找的东西,还是只是提到它的某个无关内容?
  • 如果是函数,追踪调用它的对象
  • 如果是配置,追踪使用它的对象

Output Format

输出格式

markdown
undefined
markdown
undefined

Search Scope

搜索范围

Looking for: [one sentence]
Would look like: [description]
Likely location: [directories/files]
Search terms: [list of aliases]
要找的内容: [一句话描述]
预期形态: [描述]
可能位置: [目录/文件]
搜索词: [别名列表]

Search Results

搜索结果

Found: [file:line]
Verified: [Yes/No - why]
undefined
Found: [file:line]
Verified: [Yes/No - why]
undefined

NEVER

绝对不要做的事

  • Start grepping without answering the four questions
  • Search for vague terms ("stuff", "thing", "code")
  • Stop at the first result without verifying it's THE answer
  • Broaden search before narrowing location
  • Ignore project structure/conventions
  • 不回答四个问题就直接使用grep搜索
  • 搜索模糊术语("stuff", "thing", "code")
  • 不验证结果是否符合需求就停留在第一个结果
  • 先扩大搜索范围再缩小位置
  • 忽略项目结构/约定

ALWAYS

必须做的事

  • State what you're looking for in one sentence first
  • Check project structure before searching
  • List 3+ aliases/synonyms for your search term
  • Verify the result matches your expected shape
  • Narrow by location before broadening by term
  • 先用一句话明确你要找的内容
  • 搜索前先查看项目结构
  • 列出3个以上搜索词的别名/同义词
  • 验证结果是否符合预期形态
  • 先缩小位置范围,再扩大搜索词范围

Example

示例

User: "Find where we handle rate limiting"
Scoping:
Looking for: The middleware or function that tracks request counts and returns 429 when limit exceeded
Would look like: Middleware function, probably uses Redis or in-memory store, has "rate" or "limit" or "throttle" in name, checks request count, returns 429
Likely location:
src/middleware/
, maybe
src/api/
, file named
rateLimit.ts
or
throttle.ts
Search terms: rate, limit, throttle, 429, tooMany, requests
Search:
bash
undefined
用户: “找到我们处理速率限制的地方”
定位过程:
要找的内容: 追踪请求次数并在超出限制时返回429状态码的中间件或函数
预期形态: 中间件函数,可能使用Redis或内存存储,名称包含"rate"、"limit"或"throttle",检查请求次数,返回429
可能位置:
src/middleware/
,也可能在
src/api/
,文件名可能是
rateLimit.ts
throttle.ts
搜索词: rate, limit, throttle, 429, tooMany, requests
搜索操作:
bash
undefined

Check structure first

先查看结构

ls src/middleware/
ls src/middleware/

Found: auth.ts, cors.ts, rateLimit.ts <-- bingo

找到:auth.ts, cors.ts, rateLimit.ts <-- 命中目标

Verify

验证

grep -n "429|rate|limit" src/middleware/rateLimit.ts

**Result:** `src/middleware/rateLimit.ts:23` - `rateLimiter` middleware using Redis, returns 429 after 100 req/min.

**Verified:** Yes - matches expected shape (middleware, uses Redis, returns 429).
grep -n "429|rate|limit" src/middleware/rateLimit.ts

**结果:** `src/middleware/rateLimit.ts:23` - 使用Redis的`rateLimiter`中间件,每分钟超过100次请求后返回429。

**验证结果:** 是 - 符合预期形态(中间件、使用Redis、返回429)。

The Failure That Spawned This Skill

催生这个技能失败案例

Grepping "auth" in a 50k line codebase. 200+ results. Refined to "login". Still 80 results. Spent 20 minutes reading wrong files. Finally found it in
src/middleware/session.ts
- wasn't called "auth" or "login" anywhere. Should have asked "where would session validation live?" first.
在一个5万行代码的库中搜索“auth”,得到200+结果。缩小到“login”后仍有80条结果。花了20分钟查看错误文件,最后在
src/middleware/session.ts
中找到目标——文件里根本没有“auth”或“login”的字样。当初应该先问“会话验证会存放在哪里?”