Running a Scan
Set up with your agent
Section titled “Set up with your agent”The recommended way to set up Periphery is with your coding agent and the Periphery skills. Install the skills from your project directory:
npx skills add periphery-pro/skillsThen ask your agent to set up Periphery for your project with the periphery-scan-setup skill. The agent installs or updates Periphery, helps you sign in, works out the right options for your project with you, saves them to a .periphery.yml configuration file, and runs your first scan. Once Periphery is set up, ask your agent to run a scan whenever you want to find and remove unused code. See Removing Unused Code.
Set up manually
Section titled “Set up manually”To set up without an agent, install Periphery, sign in, and start the guided setup from your project directory:
periphery scan --setupThe guided setup detects your project type and configures a few options. After answering a few questions, Periphery prints the full scan command and runs it.
The guided setup is intended to get you started. Run periphery help scan to see all available scan options.
How a scan works
Section titled “How a scan works”Periphery builds your project to generate an index store, combines it with information parsed from the source files, and maps the relationships between declarations. It then reports declarations that cannot be reached from the project’s entry points.
If your project consists of one or more standalone frameworks that do not also contain some kind of application that consumes their interfaces, you need to tell Periphery to assume that all public declarations are used with the --retain-public option.
For projects that are mixed Objective-C & Swift, it’s highly recommended you read about the implications this can have on your results.
Next Steps
Section titled “Next Steps”Once you’ve settled upon the appropriate options for your project, persist them in a YAML configuration file so you can simply run periphery scan. See Configuration for the full list of options, and Removing Unused Code for guidance on removing code.
To use Periphery in CI, see Continuous Integration. If your project already contains a lot of unused code, Baselines let you report only newly introduced results.