Psalm is a static analyzer that finds bugs and security vulnerabilities in PHP code. This plugin gives an agent:
- MCP tools to check files or the whole project (
psalm_check), to see the types Psalm infers (psalm_inspect), to find where a symbol is used (psalm_references), and to read the documentation of an issue (psalm_explain); - a skill to run Psalm, fix its issues and annotate code, which is the one the Psalm of your project ships;
- in Claude Code, the language server, which shows Psalm's errors after each edit.
The plugin runs the Psalm of your project on your machine, with php. Psalm loads the project's autoloader and Psalm
plugins, so use it in projects you trust. Code leaves your machine only if you agree to upload a snippet to psalm.dev
for a bug report.
Install Psalm in the project with composer require --dev vimeo/psalm, and create its config with
vendor/bin/psalm --init. Then install the plugin, in Claude Code:
/plugin marketplace add psalm/agent-plugins
/plugin install psalm@psalm
Gemini CLI: gemini extensions install https://github.com/psalm/agent-plugins
OpenCode: opencode plugin add github:psalm/agent-plugins
Two environment variables change what the plugin runs:
PSALM_PHP: the PHP binary that runs Psalm;PSALM_PROJECT_DIR: the project, if several directories have apsalm.xml.
Other agents: Using Psalm with AI agents.
Set the same version in .claude-plugin/plugin.json, gemini-extension.json and package.json, and tag it.