원클릭으로
find-repetition
Scan file(s) for repeated code patterns and suggest functions to encapsulate them
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Scan file(s) for repeated code patterns and suggest functions to encapsulate them
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | find-repetition |
| description | Scan file(s) for repeated code patterns and suggest functions to encapsulate them |
| argument-hint | <file or glob> |
Scan $ARGUMENTS for two kinds of issues:
For each pattern found, show the locations where it appears, explain what the shared logic is doing, and suggest a function signature that would encapsulate it. Only flag repetition that is genuinely worth extracting -- three or more occurrences, or two that are complex enough that a helper would meaningfully reduce the maintenance surface. Do not suggest abstractions for simple one-liners or cases where the repetition is coincidental rather than structural.
Read .claude/helpers.md first. Then scan the target files for code that manually implements logic already covered by a helper in the index. For each instance found, cite the helper from .claude/helpers.md that should replace it and show a before/after sketch.
Common patterns to watch for in this codebase:
var new: OptionalHandle = .none; try shimmerToX(...); handle.swapIfNew(new); when an in-place wrapper like getInteger, getFloat, getBoolean, getIndex, shimmerToList, getListLength, getCodepointLength, or resolveHash already exists on Interp.dictLookupFollowRefs or dictGetTable when Interp.getDictValue, getDictValueOrError, getDictValueRecursively, getDictValueRecursivelyOrError, putDictValue, putDictValueRecursively, removeDictValue, removeDictValueRecursively, getDictValueInPlace, or putDictValueInPlace would handle the shimmer and error plumbing.createObject + manual field initialization when newList, newListWithCapacity, or listAppendAssumeCapacity would suffice.createString + setNormalString when newString, newStringFmt, newStringToFill, or setStringOwning would work.incrRefCount/decrRefCount pairs when borrow(), dupOrRef(), reference(), or referenceTakeOwnership() express the intent more directly.ErrorDetails and passing it through multiple layers when interp.wrapError or interp.wrapShimmerFn could collapse the boilerplate.Heap.ListIndex.asAbsoluteIndex, Range.fromIndexes, getRange, or getRangeInPlace already exists.evalExpression, evalExpressionInPlace, or getBoolFromExpression should be used.captureScope or captureCurrentScope already does it.When reporting a subsumed pattern, include:
.claude/helpers.md.Be conservative: only flag cases where the replacement is clearly equivalent and actually shorter or clearer. Do not suggest replacing code that uses the helper's internals intentionally or that has subtle behavioral differences.