home / skills / swiftzilla / skills / swiftzilla

swiftzilla skill

/skills/swiftzilla

This skill analyzes Swift dependency graphs and provides impact insights and expert guidance from a curated Swift and iOS knowledge base.

npx playbooks add skill swiftzilla/skills --skill swiftzilla

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
2.1 KB
---
name: swiftzilla
description: >-
  Swift/iOS static analysis CLI. Use `depgraph` to find who calls a function,
  what breaks if you change a file, track call sites and blast radius before
  refactoring, and map symbol dependencies across files. Use `ask` to consult
  Swift/iOS/tvOS/watchOS/macOS documentation and best practices.
license: Proprietary
compatibility: Requires macOS 13+. The binary is a universal macOS executable (arm64 + x86_64).
metadata:
  author: SwiftZilla
  version: "ee6338f"
---

# SwiftZilla CLI

Swift/iOS static analysis and knowledge base:

1. **`depgraph`** — Find who calls a function, what breaks if you refactor, track call sites and blast radius
2. **`ask`** — Consult Swift/iOS/tvOS/watchOS/macOS documentation and best practices

## Installation

The `swiftzilla` binary is in `{workspace_or_agent_folder}/swiftzilla/scripts/`. Make it executable:

```bash
chmod +x ./{workspace_or_agent_folder}/swiftzilla/scripts/swiftzilla
```

## When to use SwiftZilla

| Situation | Command |
|-----------|---------|
| First run in a new project | `depgraph index --path .` |
| Who calls this function/method? | `depgraph impact <file> --lines start:end` |
| What breaks if I change these lines? | `depgraph impact <file> --lines start:end` |
| What does this code depend on? | `depgraph impact <file> --lines start:end` |
| Ask Swift/iOS best-practice questions | `ask "your question"` |

## Quick Start

```bash
# 1. Build dependency index (re-run after structural file changes)
swiftzilla depgraph index --path .

# 2. Analyze blast radius — who calls this, what depends on it
swiftzilla depgraph impact UserService.swift --lines 10:30

# 3. Ask the Swift/iOS knowledge base
swiftzilla ask "how to use async/await with actors"
```

## Detailed References

- [DepGraph Reference](references/depgraph.md) — dependency indexing and impact analysis
- [Ask Reference](references/ask.md) — curated Swift/iOS knowledge lookup

## Requirements

- macOS 13 (Ventura) or later
- A Swift project with `.swift` source files for `depgraph`
- `SWIFTZILLA_API_KEY` for `ask` (see [Ask Reference](references/ask.md))

Overview

This skill analyzes Swift project dependency graphs and estimates change impact with the depgraph commands, and provides a curated Swift/iOS knowledge base via the ask command. It’s a lightweight CLI-focused assistant for developers who need quick dependency insight and targeted implementation guidance. Use it to plan safe refactors and get practical Swift/iOS answers tied to modern patterns.

How this skill works

The depgraph component indexes Swift source files to build a dependency graph, then lets you query transitive dependencies or compute blast radius for specific file ranges. The impact command maps which files and symbols a change would touch. The ask command queries a curated Swift/iOS knowledge base using an API key to return implementation guidance and best-practice answers.

When to use it

  • Before refactoring a file or function to estimate blast radius
  • When mapping transitive dependencies for architecture reviews
  • To inspect what symbols a file depends on or who depends on it
  • When onboarding into a new Swift project to build a dependency index
  • To get concise, curated answers about Swift concurrency, patterns, or iOS APIs

Best practices

  • Run depgraph index at project root before queries to ensure up-to-date graphs
  • Limit query depth when exploring large graphs to avoid noise
  • Use impact with precise line ranges to focus analysis on real change sets
  • Keep SWIFTZILLA_API_KEY secure and scoped for readonly access to the knowledge base
  • Combine depgraph results with code review to validate architectural assumptions

Example use cases

  • Index a repository and generate a map of module/file dependencies prior to a major refactor
  • Estimate which files will be affected by changing a method signature in UserService.swift using impact with line ranges
  • Investigate why changing a private helper triggers widespread rebuilds by querying transitive dependents
  • Ask how to use async/await with actors for a safe concurrency implementation pattern
  • Find recommended practices for dependency injection on iOS components

FAQ

Do I need special permissions to run depgraph?

No special permissions are required beyond read access to the project files; depgraph reads .swift sources and builds an index locally.

What platforms are supported?

The CLI requires macOS 13 or later and a Swift project with .swift files. The ask command also needs SWIFTZILLA_API_KEY configured for the knowledge base.