# Swift Context

> Use this skill for semantic codebase analysis and mapping local code dependencies. It provides a semantic engine to query local code context. Use when asking "where is X implemented", "what depends on Y", "find all usages of Z", "what breaks if I change this", or any question about your local project's code structure, dependencies, or impact analysis.

- Skill: `swiftzilla/swift-context` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add swiftzilla/swift-context`
- Raw SKILL.md: https://api.skillmd.com/api/skills/swiftzilla/swift-context/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Proprietary
- Author: swiftzilla (https://skillmd.com/u/swiftzilla)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/swiftzilla/swift-context

---


# Swift Context: Local Semantic Intelligence

Use this skill to map your project's code structure through semantic indexing.

## Commands

### sync

Rebuilds the encrypted semantic index. Run when files have changed significantly.

```bash
scripts/swift_context sync --path <PROJECT_ROOT>
```

### query

Semantic search across the indexed codebase.

```bash
scripts/swift_context query "<NATURAL_LANGUAGE_QUERY>"
```

### impact

Analyzes the blast radius of a planned change.

```bash
scripts/swift_context impact "<INTENTION_OR_COMPONENT_NAME>"
```

## When to Sync

Run `sync` in these cases:

1. **Missing cache**: No corresponding `.bin` file exists in `~/.swiftzilla/cache`
2. **Stale index**: Project files are newer than the cached index
3. **Unexpected results**: After a refactor, `query` returns irrelevant results

## Gotchas

- The index is encrypted and cached in `~/.swiftzilla/cache` — if you switch projects, the old cache may still be used. Always `sync` with the correct `--path` after switching projects.
- `query` returns semantic matches, not exact text matches. If you need exact string search, use standard grep/find tools instead.
- After major refactors, always re-sync before running `impact` — stale indexes produce incorrect dependency maps.

## Workflow

1. **Sync**: Run `sync` if the index is missing or stale
2. **Query**: Use `query` to find relevant code locations and understand implementation details
3. **Impact**: Use `impact` before making changes to understand what else will be affected

