/harmonize:run-harmonizefrom harmonize
Runs Harmonize architectural lint rules for Swift projects and explains how to fix violations from the JSON report. Use after writing or changing Swift code.
Ships in harmonize. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Harmonize is a Swift architectural linter. Its rules are unit tests. This skill runs the rules and interprets the results. It works in any project that uses Harmonize.
.harmonize.yaml.Package.swift with a test target that depends on Harmonize. Run grep -rl --include=Package.swift "Harmonize" . and ignore the Harmonize library itself.If the project has its own runner script or skill (for example run-harmonize.sh or a project run-harmonize skill), use it. It can filter the output or use a prebuilt workspace. The rest of this skill is the portable fallback.
Run from the repository root. Send the log to a file. Request the JSON report with one environment variable:
rm -rf .harmonize-out && mkdir -p .harmonize-out
HARMONIZE_VIOLATIONS_FILE="$PWD/.harmonize-out/violations.json" \
swift test --package-path <rules-package> > .harmonize-out/test.log 2>&1
echo "exit code: $?"
--filter <RuleTestClassName> to the swift test command. This does not work for Quick specs on macOS. A Quick spec is a rule class that extends QuickSpec. With Quick specs, --filter selects no tests, and swift test --parallel skips them without an error. Build the tests with swift build --build-tests, find the bundle in swift build --show-bin-path, and run xcrun xctest -XCTest <Module>.<RuleTestClassName> <bundle>. With xcodebuild, use -only-testing:<Module>/<RuleTestClassName>.xcodebuild, name the variable TEST_RUNNER_HARMONIZE_VIOLATIONS_FILE. The prefix makes the variable reach the test process.HARMONIZE_VIOLATIONS_FILE="$PWD/.harmonize-out/". Each process then writes its own violations-<pid>.json file. Read all of them..harmonize-out/ to .gitignore.Read the log only when this section tells you to.
violations.json contains [].Executed 0 tests and has no Test run with ... line from Swift Testing: no rule ran. The filter matched no test, or the Quick specs did not run. Do not treat the result as a pass. Run the command again without --filter and without --parallel, or run the bundle as described above.violations.json has entries: read the file. Each entry has:
ruleId and title: the rule that failed.file, line, column, name: the location of the violating declaration.message: the rationale of the rule.howToFix: how to correct the code."kind": "assertion" is a rule-level failure, for example a stale baseline. A stale baseline entry is a known violation that now passes the rule. Remove the entry from the baseline list of the rule. Do not change production code for it.violations.json is missing or []: the rules did not run, or a test failed outside Harmonize. Search the log for error:. Fix the build first.howToFix. If you need the examples, open the rule page of the generated skill: references/*/<ruleId>.md. If the project has no generated skill, open the rule source. Its file name is the rule id in PascalCase, unless the rule sets an explicit id.baseline entry. Use the baseline only for violations that existed before the rule.--filter <RuleName>, or the bundle command for a Quick spec. Then run the full suite.If the project has a generated harmonize skill, use it before you write code. Its SKILL.md lists one reference file per layer. Open the file of the layer you will change. It lists the rules of that layer. Each rule links to a page with the rationale, the fix, and a bad and a good example. The skill does not list rules with .deferred disclosure, but Harmonize enforces them. Their test failures explain the fix.
The skill is generated from the rule sources. The generator does not build or run the tests:
swift package --package-path <rules-package> --allow-writing-to-package-directory \
--allow-writing-to-directory <skills-dir> harmonize-skills
The output directory and the skill name come from .harmonize.yaml (skills: { output: ..., name: ... }). Projects usually run this from a pre-commit hook when rule files change. A CI check makes sure that the committed skill is current.
What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
npx claudepluginhub perrystreetsoftware/harmonize --plugin harmonizeOther plugins' skills for the same job