Fix at the Boundary
Activation guard
Use this skill when a reported bug's root cause is a pattern — a function
shape, a write sequence, a device/permission check, a duplicated literal, a
copy-pasted helper — rather than a fact unique to the one file named in the
report.
If the bug is genuinely local (a typo, a value that only makes sense for that
one app, a one-time data fix), say so explicitly — "this is local to
<file>, no sweep needed" — and skip the rest of this skill. Don't sweep as
theater.
Do NOT skip the sweep in these situations
- "The report only names one file, I'll patch that and move on." A stale-diff
write race, a mic-device resolution order, a missing scoped-access check —
these are usually copy-pasted everywhere the same operation is implemented.
- "I found 3 callers and fixed those, that's probably all." Enumerate every
hit from the search before editing anything — stopping at the first few
you notice is how instances 4–9 survive.
- "Grepping the whole repo will take too long." A few
rg calls take
seconds; rediscovering the same fix across four more user reports doesn't.
- "This looks like the same bug in an area I don't own, but that's not what I
was asked to fix." Still enumerate it — just don't edit it (see below).
- "I fixed the shared helper, callers will pick it up automatically." Only
true if every sibling actually calls it — confirm with the same search.
Workflow
- Derive the fingerprint from the symptom, not the file: the exact
function/hook name, the anti-pattern shape (read stale state → write
without re-checking), a literal string, or an import path.
- Search before editing:
# exact call/hook, whole repo
rg -n "computeDiffBase\(|stashLocalDiffBase\(" --type ts -g '!**/node_modules/**'
# duplicated literal (device id, action name, config key)
rg -n "'design-native-asset'" -g '*.ts' -g '*.tsx'
# same shape copy-pasted across template apps
rg -n "getUserMedia" templates/*/app templates/*/src 2>/dev/null
Widen the pattern (drop args, add -C 3, try a sibling term like
diffBase vs diff_base) until confident no caller phrases it slightly
differently.
- Enumerate every hit before touching any file — write the list in your
response so step 5 is checkable.
- Decide where the fix lives. A shared helper some callers bypass →
fix the helper and point bypassers at it. No shared helper and N ≥ 3
duplicate sites → consider extracting one instead of pasting a 4th time.
- Apply the fix to every in-scope hit.
Ownership boundaries
Enumerating isn't editing. A hit inside a path this task's DO NOT TOUCH
list assigns to another agent gets listed as found-but-out-of-scope and
flagged via spawn_task or a direct note — never silently edited or
silently dropped. See concurrent-agents.
Reporting the sweep
Report the full blast radius, not just what you changed:
Fixed the stale-diff-base race in:
- insert-design-native-asset.ts (as reported)
- insert-asset.ts, apply-a11y-fix.ts, generate-design.ts (same pattern)
Found but out of scope (owned by another agent this task): apply-visual-edit.ts
in templates/design/** — flagged via spawn_task.
No other callers of computeDiffBase().
Why this exists
- "apply-visual-edit.ts has the same stale-diff-base write-race bug that was
just fixed in insert-design-native-asset.ts, insert-asset.ts,
apply-a11y-fix.ts ... and generate-design.ts" — one defect, 9 files, fixed
one report at a time instead of once.
- Mic-device resolution was independently fixed in four different Clips
surfaces (
useMediaDevices.ts, media-capture-constraints.ts,
offscreen.ts, recorder-engine.ts).
- "i want to make sure universally cmd+click works ... can we do a quick
sweep of other apps" — the user had to ask for a sweep across 4 templates
that should have happened proactively.
- "remember - if any other apps like in our core repo templates/ does this
wrong, fix that too" — exists only because the first fix didn't already
answer it.
Related Skills
- concurrent-agents — why an out-of-scope sibling gets flagged, not edited.
- adding-a-feature — the four-area checklist a proper fix should satisfy.
1---2name: fix-at-the-boundary3description: How to find every sibling instance of a reported bug before fixing it. Use whenever a bug report names one file but the defect is a call pattern, hook, duplicated literal, or copy-pasted helper that plausibly exists in other files, apps, or templates.4---56# Fix at the Boundary78## Activation guard910Use this skill when a reported bug's root cause is a **pattern** — a function11shape, a write sequence, a device/permission check, a duplicated literal, a12copy-pasted helper — rather than a fact unique to the one file named in the13report.1415If the bug is genuinely local (a typo, a value that only makes sense for that16one app, a one-time data fix), say so explicitly — "this is local to17`<file>`, no sweep needed" — and skip the rest of this skill. Don't sweep as18theater.1920### Do NOT skip the sweep in these situations2122- "The report only names one file, I'll patch that and move on." A stale-diff23 write race, a mic-device resolution order, a missing scoped-access check —24 these are usually copy-pasted everywhere the same operation is implemented.25- "I found 3 callers and fixed those, that's probably all." Enumerate every26 hit from the search *before* editing anything — stopping at the first few27 you notice is how instances 4–9 survive.28- "Grepping the whole repo will take too long." A few `rg` calls take29 seconds; rediscovering the same fix across four more user reports doesn't.30- "This looks like the same bug in an area I don't own, but that's not what I31 was asked to fix." Still enumerate it — just don't edit it (see below).32- "I fixed the shared helper, callers will pick it up automatically." Only33 true if every sibling actually calls it — confirm with the same search.3435## Workflow36371. **Derive the fingerprint from the symptom**, not the file: the exact38 function/hook name, the anti-pattern shape (read stale state → write39 without re-checking), a literal string, or an import path.402. **Search before editing:**41 ```bash42 # exact call/hook, whole repo43 rg -n "computeDiffBase\(|stashLocalDiffBase\(" --type ts -g '!**/node_modules/**'44 # duplicated literal (device id, action name, config key)45 rg -n "'design-native-asset'" -g '*.ts' -g '*.tsx'46 # same shape copy-pasted across template apps47 rg -n "getUserMedia" templates/*/app templates/*/src 2>/dev/null48 ```49 Widen the pattern (drop args, add `-C 3`, try a sibling term like50 `diffBase` vs `diff_base`) until confident no caller phrases it slightly51 differently.523. **Enumerate every hit before touching any file** — write the list in your53 response so step 5 is checkable.544. **Decide where the fix lives.** A shared helper some callers bypass →55 fix the helper and point bypassers at it. No shared helper and N ≥ 356 duplicate sites → consider extracting one instead of pasting a 4th time.575. **Apply the fix to every in-scope hit.**5859### Ownership boundaries6061Enumerating isn't editing. A hit inside a path this task's `DO NOT TOUCH`62list assigns to another agent gets listed as found-but-out-of-scope and63flagged via `spawn_task` or a direct note — never silently edited or64silently dropped. See **concurrent-agents**.6566## Reporting the sweep6768Report the full blast radius, not just what you changed:6970```71Fixed the stale-diff-base race in:72- insert-design-native-asset.ts (as reported)73- insert-asset.ts, apply-a11y-fix.ts, generate-design.ts (same pattern)74Found but out of scope (owned by another agent this task): apply-visual-edit.ts75in templates/design/** — flagged via spawn_task.76No other callers of computeDiffBase().77```7879## Why this exists8081- "apply-visual-edit.ts has the same stale-diff-base write-race bug that was82 just fixed in insert-design-native-asset.ts, insert-asset.ts,83 apply-a11y-fix.ts ... and generate-design.ts" — one defect, 9 files, fixed84 one report at a time instead of once.85- Mic-device resolution was independently fixed in four different Clips86 surfaces (`useMediaDevices.ts`, `media-capture-constraints.ts`,87 `offscreen.ts`, `recorder-engine.ts`).88- "i want to make sure universally cmd+click works ... can we do a quick89 sweep of other apps" — the user had to ask for a sweep across 4 templates90 that should have happened proactively.91- "remember - if any other apps like in our core repo templates/ does this92 wrong, fix that too" — exists only because the first fix didn't already93 answer it.9495## Related Skills9697- **concurrent-agents** — why an out-of-scope sibling gets flagged, not edited.98- **adding-a-feature** — the four-area checklist a proper fix should satisfy.