swift-find-references

swift-find-references is a skill for Claude Code from drewalth/claude-xcindex. It costs 68 tokens per session (790 once invoked), scanned A, original, MIT.

A Swift and Objective-C reference finder that uses Xcode's code index to locate actual uses of a symbol, rather than matching its name in comments, text, or unrelated code.

In plain words
What is it for?
Use it before changing a Swift or Objective-C symbol to find its definition, callers, and other semantic references, then inspect only the relevant code locations.
Why use it?
It gives a more precise change scope than text search and avoids false matches caused by similarly named symbols.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Part of the xcindex plugin — 4 skills, 2 commands, 1 agent, 3 hooks, 1 MCP server shipped together

Good fit Use it before changing a Swift or Objective-C symbol to find its definition, callers, and other semantic references, then inspect only the relevant code locations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/drewalth/claude-xcindex/swift-find-references
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add drewalth/claude-xcindex --skill swift-find-references
Clone the repo
git clone --depth 1 https://github.com/drewalth/claude-xcindex

Made for: Claude Code.

Or install xcindex, the plugin that ships this one along with the rest of its 4 skills, 2 commands, 1 agent, 3 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-find-references

README.md
[![agentmods](https://agentmods.dev/badge/skills/drewalth/claude-xcindex/swift-find-references/github.svg)](https://agentmods.dev/skills/drewalth/claude-xcindex/swift-find-references)
Your own site
<a href="https://agentmods.dev/skills/drewalth/claude-xcindex/swift-find-references"><img src="https://agentmods.dev/badge/skills/drewalth/claude-xcindex/swift-find-references/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-find-references

Your own site · 80×15
<a href="https://agentmods.dev/skills/drewalth/claude-xcindex/swift-find-references"><img src="https://agentmods.dev/badge/skills/drewalth/claude-xcindex/swift-find-references.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 790 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00068 $0.00790
Opus 5 $0.00034 $0.00395
Sonnet 5 $0.00014 $0.00158
Haiku 4.5 $0.00007 $0.00079

Measured 10d ago against content hash 51e6b3fbdd5f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

swift-find-references scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/swift-find-references/SKILL.md · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What this skill does

Maps a symbol name to its semantic reference set using the Xcode IndexStoreDB. The index distinguishes a UserService class from a userService variable, from a UserService token in a comment, and from UserService defined in another module. Grep cannot.

How to use

  1. Disambiguate first. Call find_symbol with the name to get candidate USRs.

    • Multiple results: pick the one matching the right module/kind, or ask the user which they meant.
    • One result: proceed.
  2. Find references. Call find_references with the symbolName.

    • maxResults: 100 is the default and covers most symbols.
    • Framework entry points or common types: bump to 200–500.
  3. Read surgically. Open only the files in the result, and only ±10 lines around each reported occurrence. Do not read whole files — the index already told you the lines that matter.

Token-saving pattern

BAD:  rg "UserService" --include="*.swift"
      → 40 noisy matches, 8 full file reads, unrelated comment hits
GOOD: find_references("UserService")
      → 6 exact locations, 6 focused ±10-line reads

Example

User: "What calls fetchUser?"

  1. find_symbol(symbolName: "fetchUser") → USR s:9MyApp...fetchUseryySiF
  2. find_references(symbolName: "fetchUser") → 4 call sites
  3. Read those 4 windows. Done.

When it won't help

  • Local symbol used only in its defining file — just read the file.
  • The user is asking about a string literal, log message, or comment — that's a text search, not a symbol search.
  • The index is stale and the user hasn't built recently — find_references will silently miss new sites. The MCP server appends a freshness warning when it detects stale results; honor it.
  • The project has never been built in Xcode (no DerivedData) — there is no index yet.
  • swift-refactor-plan — when the user wants a full plan (sites + risks + recommended next step), not just the reference list.
  • swift-blast-radius — when the unit of analysis is a file, not a symbol.
  • swift-rename-symbol — when the user has committed to renaming and wants the edits applied.

Read the full file on GitHub · 72 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 72 lines · 68 tokens per session scan A 51e6b3fbdd5f

Subscribe to this mod's changes

swift-find-references is a skill published in the GitHub repository drewalth/claude-xcindex (3 stars, last pushed 1mo ago), licensed MIT. It adds 68 tokens to every session and 790 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

null-safety

Use when annotating nullability in Spring Boot 3 / Spring Framework 6 code, integrating Kotlin, or adding static nullability checks without assuming Spring Framework 7 JSpecify defaults.

rrezartprebreza/spring-boot-skills · 41 tokens

swift-concurrency-review

Review Swift 6 strict-concurrency and SwiftUI code for idiom and build-breaking issues - non-Sendable across actor boundaries, @MainActor witness vs nonisolated protocol requirements, Combine/ObservableObject usage, force-unwraps, #Predicate macro limits, the 6.3.x Binding IRGen crash, missing #if os() guards, and…

charlesjones-dev/claude-code-plugins-dev · 94 tokens

swift-ci-scaffold

Scaffold the repo side of Xcode Cloud for an XcodeGen / Tuist Swift project - generate ciscripts/cipostclone.sh (regen + guarded CIBUILDNUMBER stamping), propose a unit-test-only CI scheme, print the exact App Store Connect workflow checklist, and optionally install an opt-in .githooks/pre-push gate. Shows diffs and…

charlesjones-dev/claude-code-plugins-dev · 82 tokens

swift-verify

Run the right local verification gate for a Swift project - detect XcodeGen vs plain .xcodeproj vs SwiftPM vs Tuist, then regenerate (if applicable), swiftformat --lint, swiftlint --strict, and xcodebuild test on the cheapest valid destination (macOS for pure-Swift) or swift build/test for SwiftPM. Reports each stage…

charlesjones-dev/claude-code-plugins-dev · 86 tokens

bitcoin-libraries-bdk

Bitcoin Dev Kit (BDK): high-level Rust wallet library. Descriptor-based wallets, multiple chain backends (Esplora, Electrum, RPC), PSBT, fee estimation, coin selection. Bindings to Swift / Kotlin / Python / Flutter. USE WHEN: building wallets in Rust or via BDK bindings, integrating descriptor wallets into apps.

claude-dev-suite/claude-dev-suite · 81 tokens

solo-ios-dev

Build iPhone/iOS apps — native SwiftUI or Kotlin-Multiplatform hybrid. Use when scaffolding an iOS app, writing SwiftUI/ARKit/MapLibre features, wiring the Claude Code ↔ Xcode workflow, building or installing on a physical device, or setting up a project so it survives its first App Store upload (product name…

fortunto2/solo-factory · 105 tokens