dresscode
БесплатноБез исполняемых скриптовНе проверенHow to run and configure DressCode, the PHP code style checker and fixer that also rewrites code for newer PHP and library versions. Use when running…
от nette★ 47 звёзд на GitHubОб этом скилле
DressCode
DressCode checks and fixes the style of PHP code and, in the same run, rewrites it for newer PHP versions and library APIs. It works on a lossless syntax tree, so the lines nothing touches stay byte for byte the same. The php-fixer hook already runs it on every PHP file you edit (the php-auto-fixer skill); this skill is about running it yourself and changing what it does.
The manual is at https://dresscode.run (see Documentation), but the installed tool describes itself more precisely, for exactly its version and this project's configuration (see Ask the Tool).
How It Thinks
- The configuration names decisions, never rules. Every key is a thing in the code and its value says how it is written:
braces: {position: {class: nextLine}},spacing: {call: 'foo($a, $b)'},hygiene: {is_null: forbidden}. A decision has a path (braces.position.class), and that path is what a finding is reported under, whatexplainexplains and what a suppression names. The rules behind the decisions are never named. - It has no style of its own. Without a configuration file or
--use <standard>it refuses to run. The look of the code comes from one standard:perCs(PER Coding Style 3.1, four spaces),psr12,nette(PER Coding Style with tabs, the layout of the Nette libraries and much of the hygiene),symfonyorlaravel(the preset laravel of Laravel Pint). - Sets say what is wanted beyond the looks, and there are exactly six:
modernizations,deprecations,cleanup,correctness,types,compilerOptimizations. A set goes intouseafter the standard (use: [nette, modernizations]) and decides nothing about the layout. A decision the project cannot use yet (its PHP is too old, it needs types, the library is missing) waits silently. No standard usesmodernizationsordeprecations. - Two PHP versions. DressCode itself needs PHP 8.4 or newer. The version the code is written for is the lowest one
require.phpincomposer.jsonallows, and no fix writes syntax that version lacks. The header lineTarget PHP 8.2 from composer.jsonsays which one applies. - A risky fix may change what the code does. It is never made without consent; DressCode reports it together with what would decide it.
- The configuration is searched from the working directory upwards, not from the checked files. Run DressCode from the project root, or name the file with
--config.
Running It
Use the project's vendor/bin/dresscode when there is one: only that copy sees the project's PHPStan and rule packages. Otherwise use the global one, dresscode on the PATH or php "<composer global config home>/vendor/bin/dresscode". Run it as php vendor/bin/dresscode … from the directory holding dresscode.neon. When DressCode is not installed, tell the user; installing it is their decision, and the user can run the install-php-fixer skill for it.
| command | what it does |
|---|---|
check [paths] |
reports violations, writes nothing |
check --diff [paths] |
shows what fix would change, writes nothing |
fix [paths] |
fixes what it can and reports the rest |
config [--file <path>] |
the decisions as the run resolves them, in the shape of the file, each with the layer that set it and why it takes no effect where it does not |
explain [path] |
what a decision or a section is for, its values, its value here and in the five standards; every decision the configuration makes without a path |
catalogue |
every decision there is, those the configuration makes marked *, with the names of other tools each covers |
init |
measures the project's code and writes dresscode.neon |
baseline [paths] |
writes the violations a fix leaves into the baseline file |
migrate config [file] |
translates a PHP CS Fixer, PHP_CodeSniffer or Laravel Pint configuration, without a file the one the project runs; what was not carried over is said in a block closing the file, the run ending with exit code 0 all the same, --dry-run prints the file instead of writing it, --format json gives the result as data |
migrate suppressions [paths] |
rewrites phpcs: suppression comments to dresscode:; --dry-run shows the diff instead, --format json gives the result as data |
Without paths, a command takes paths of the configuration; a directory containing configured paths is narrowed to them.
Exit codes: 0 clean; 1 violations remain (also a file that does not parse, a refused baseline, or more warnings than --max-warnings), which is a finding, not a failure of the tool; 2 a file failed (a rule threw, rules did not converge, the file changed during the fix); 3 a mistake on the command line or in the configuration (unknown key or decision, no configuration); 4 an upgrade waits for a step outside DressCode, Composer or a human. Judge a run by its exit code, never by filtering its output.
Switches for one run, none of which touches the configuration file:
Установить dresscode в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл dresscode?
How to run and configure DressCode, the PHP code style checker and fixer that also rewrites code for newer PHP and library versions. Use when running `dresscode` yourself (check, fix, config, explain, catalogue, init, baseline, upgrade), writing or changing `dresscode.neon` or `dresscode.php`, reading its report (violations, risky fixes, exit codes), changing a decision, silencing a finding or adding a baseline, choosing a standard or a set, setting DressCode up in CI or a Git hook, or upgrading a project to a newer PHP or library version with it. Ordinary PHP edits do not need it; the php-auto-fixer skill covers the hook that fixes them.
Как установить скилл dresscode?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dresscode запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic