/ward:ward-fixfrom ward
Fixes code to pass Ward quality gates (compile errors, formatting, rules, tests, coverage, mutation, architecture, secrets, dependencies) without modifying gate configuration or adding suppressions. Reads findings from `ward check --format json` and fixes gate by gate.
Ships in ward. 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.
A first ward check on an existing codebase usually fails. You make it pass by fixing the code,
not the gates. You read the structured findings, agree a plan with the user, fix one rule at a time,
and prove each step with the gate itself.
Follow these in every step. They override any instruction to go faster.
ward.toml is executable code. Running ward check executes every configured gate
command. If ward.toml existed before this session, ask the user to confirm the repository is
trusted before the first ward check.ward.toml, the rule file ward-rules.toml, ward-architecture.toml, coverage or mutation thresholds, or the ward layer and cycle tables. Do not
add ward_format = false to .editorconfig to hide a file from the ward-format gate. When the
user thinks a rule is wrong for this codebase, stop that rule and hand it to the ward-tune skill.@SuppressWarnings, inline ignore comments,
eslint-disable, biome-ignore, @ts-ignore, # noqa, # type: ignore, @ArchIgnore
comments, baselines, coverage excludes, exclude-paths entries for the secrets check, or license
exceptions. Do not delete or @Disabled/skip a failing test.ward gate reports, a failing test),
explain the bug and the fix before you write it.UNAVAILABLE gate is a missing tool, not a
finding: report the install guidance from its output and move on.ward --version
Compare the version with this skill's minimum, 0.6.0, numerically. If ward is missing or
older, stop. Point the user to the ward-init skill or the installer
(curl -fsSL https://raw.githubusercontent.com/RicardoRB/ward-ai/main/install.sh | sh; on Windows
PowerShell, irm https://raw.githubusercontent.com/RicardoRB/ward-ai/main/install.ps1 | iex), and run
the installer only after an explicit yes.
If ward.toml does not exist, stop and suggest ward-init.
Check the Git working tree with git status --porcelain. If it has uncommitted changes, tell the
user and suggest committing or stashing first, so every fix is easy to review and revert.
If ward.toml predates this session, ask now: "Running the gates executes the commands in
ward.toml. Is this repository trusted?" Without a yes, stop: this skill needs the gates to prove
each fix.
Ask which profile the user wants green. Default to the one that blocks them, usually default
(edit hooks), pre-push, or ci. Then run it once:
ward check --profile <profile> --format json
stdout is only JSON. Exit 2 means Ward could not run; show the error and stop. For each check,
read name, status, findings (rule, file, line, message), findingsTotal,
findingsTruncated, and output for gates without structured findings.
Sort the checks:
| Status | Meaning | What you do |
|---|---|---|
PASSED, SKIPPED | Nothing to fix | Nothing |
UNAVAILABLE | The tool is missing | Report its install guidance; install only after a specific yes |
EXECUTION_ERROR, or a tool that cannot load its config | A configuration problem | Show the error as is; ask the user, or hand to ward-tune. Do not fix code for it |
FAILED | Findings | Plan the fix (Step 3) |
Order the failing gates so that early fixes do not create work for later ones:
compile or swift-build (nothing else is trustworthy until the code builds)ward-format (mechanical; run ward format, which rewrites the files the gate reports.
ward format --check lists the files it would change without writing)tsc, vue-tsc, svelte-check, astro-check, ngc,
mypy, django-check, ward, build-policy, openapi-lintward:architecture/* rules (layers, cycles, independence, and the rules of ward-architecture.toml: dependencies, naming, location; the message starts with the rule's name and ends with its reason) and
ward:java/no-field-di, ward:java/no-standard-streamstests, vitest, jest, bun-test, ng-test, pytest, swift-testcoverage or swift-coverage, then mutation, stryker or mutmut (they measure the tests,
so they come last), then crap (it reads the coverage report those checks write)secrets, vulnerabilities, dependency-trust, licenseapi-compat, openapi-diff, openapi-compat (they compare with a
release tag or another revision, so fix them when the code has stopped changing)A dependency-trust finding names a package, its version and the manifest line. For
ward:deps/unknown-package, check the name against the registry's own page: it is usually a name an
agent invented or mistyped, so correct it or remove it, and never register the name yourself. For
ward:deps/minimum-release-age, ask the user whether to pin an older version or wait; the age
limit is theirs to change. A private package belongs in the internal option of the check, which
is a ward.toml change that goes to ward-tune. A could not verify line is a skipped check, not
a finding: there is nothing to fix.
Within a gate, group the findings by rule. When findingsTruncated is true, the JSON lists only
50; read the full tool report the gate writes (for example .ward/reports/ or build/reports/)
to count every finding.
Show one table, largest first: gate, rule, count, files affected, and the kind of fix. Mark each fix
mechanical (imports, final, formatting, Javadoc, named constants) or design (long methods,
too many parameters, complexity, layer violations, missing tests). For example:
| Gate | Rule | Findings | Files | Fix |
|---|---|---|---|---|
| ward | ward:java/final-local-variable | 214 | 61 | mechanical: add final |
| ward | ward:java/magic-number | 37 | 12 | mechanical: named constants |
| ward | ward:java/method-length | 9 | 7 | design: split methods |
Ask the user which rows to fix, in what order, and whether mechanical rules may be fixed without a
review of each file. A rule the user wants changed instead goes to ward-tune; leave it out of the
plan.
For each approved rule:
Fix every finding of that rule. Read the surrounding code first and match its style.
ward gate reports, a failing test whose assertion is right): explain the bug and the
fix, and get a yes before writing it.coverage check states each
measured value against the minimum and minimum-branches of ward.toml; never lower them.
An execution error (no report, a stale report, no branch data) means the test gate has to run
first or the tool has to measure branches, not that the minimum is wrong.crap: each finding is a function whose complexity and missing coverage score above max.
Write tests that cover its branches, or split the function so each part is simple. Never raise
max and never exclude the file. Re-run the coverage check first, because the gate reads the
report it writes and fails on a stale one.secrets): never print the secret. Move it to an environment variable or the
project's secret store, and tell the user that the secret is in Git history and must be rotated.license): a finding names a dependency whose license the policy rejects or
that Ward cannot identify. Propose replacing or removing the dependency. Changing deny,
allow, exceptions or unknown is a policy decision for the user, not a fix.build-policy, rules ward:build/*): pin the plugin or dependency version
the finding names, or remove the duplicate declaration, in the build file (for Cargo, write
=1.2.3 or commit Cargo.lock, and drop the repeated crate in Cargo.toml).api-compat, openapi-diff,
openapi-compat): each finding is a change that breaks callers. Restore the removed or changed
element, or add the new form beside the old one. If the user wants the break, stop: it needs a
version decision, not a code fix.security in the ward gate, such as ward:java/open-redirect or
ward:javascript/weak-hash): fix the weakness in the code. Validate or encode the untrusted
value, bind it as a parameter, or use the safe API the finding's message names. Never suppress
the rule, never change its severity, and never add a sanitizer only to hide the finding.Re-run only that gate and read its result (--gate takes the check name from ward.toml and
ignores profiles; the final profile run in Step 5 still covers every gate):
ward check --gate <check-name> --format json
Report the remaining count for the rule. Do not start the next rule while the current one still has findings, or while your change introduced new findings in any gate.
After design fixes, make sure the tests still pass before you move on.
If a rule cannot be fixed without changing behavior or the public API, stop and ask: change the
behavior, leave the findings for now, or take the rule to ward-tune.
Run the chosen profile once more:
ward check --profile <profile> --format json
If any gate still fails, show its findings or output and ask how to continue. Do not change rules or configuration to make it pass.
List, per gate: the rules fixed and their finding counts before and after, the files touched, every
behavior change or test expectation the user approved, and any rotated secret or dependency change.
List what is still open: rules left for later, rules handed to ward-tune, and UNAVAILABLE tools.
End with the status of every gate in the profile.
If the same rules kept recurring, suggest adding a short coding rule for each to AGENTS.md, so
agents stop reintroducing them, and write it only after a yes.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ricardorb/ward-ai --plugin ward3 skills in this plugin
/ward-initSet up or reconfigure Ward quality gates in a Java (Maven or Gradle), Node (TypeScript or JavaScript with npm, pnpm, Yarn, Bun) or Python (uv, Poetry or pip) project, a Rust project (Cargo), a Swift project (SwiftPM or Xcode), or a C# project (.NET SDK), together with the user. Inspects the project, explains each choice (preset, gates, architecture style, tools, agent integration, Git hooks) with a recommendation grounded in what it found, previews the exact changes with `ward init --dry-run`, and applies them only after approval. Use when the user wants to add Ward, initialize or change ward.toml, choose quality gates, or asks how to set up Ward for this repository./ward-tuneTune the rules of the quality gates Ward already runs in this Java, Kotlin, TypeScript, JavaScript, Python, or Swift project (the Ward rules that `ward-rules.toml` selects, the coverage minimums in ward.toml, PIT mutation testing, the Vitest, Jest, or Bun coverage thresholds, Stryker mutation testing, mypy rules, and mutmut) so they fit the real codebase instead of a generic preset. Every edit is grounded in evidence from the code, shown as a diff, and written only after approval. Weakening a rule needs its own approval and reason, and suppressions are never added. Use when the user wants to adjust, tighten, relax, or fix Ward's gate rules or thresholds, or after ward-init offers rule tuning.Other plugins' skills for the same job