/ward:ward-tunefrom ward
Tunes Ward quality gate rules and thresholds to fit a real codebase instead of a generic preset. Adjusts ward-rules.toml, ward.toml coverage minimums, PIT/Stryker/mutmut mutation testing, Vitest/Jest/Bun coverage thresholds, and mypy rules. Every change is evidence-based, shown as a diff, and requires approval.
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.
Read when SKILL.md points to them.
Ward presets ship generic rules. You fit them to this codebase. You find what the code already does, propose rules that match it or move it forward, and change files only with the user's approval. The goal is gates the team trusts, not gates that pass at any cost.
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.@SuppressWarnings, inline ignore comments, suppression
files, @ArchIgnore, or coverage <excludes> added only to clear
findings. Fix the code, or propose a reviewed rule change instead.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.
Read ward.toml as text. If it does not exist, stop and suggest ward-init.
To see which rules the project selects, and what each one takes, use ward rules list --selected --format json and ward rules show <id> --format json. Use them instead of reading the rule
reference. The JSON output is one document on stdout.
Every rule has one category, named after what the rule checks (naming, complexity, security
and so on), not after a tool. ward rules list --category <category> lists one category, and
categories under [select] in ward-rules.toml keeps only the listed ones. Read the category
names from the ward rules list output of the installed version; do not guess them.
Under preset = "agent" the category also decides the preset: security, secrets,
correctness, null-safety, error-handling and concurrency take the rules of strict, every
other category those of standard. To tighten one style rule, include it; do not switch the
whole file to strict. To relax a rule of a defect category, exclude it only with its own approval
and reason, as for any weakening.
List the gates with enabled = true. This skill tunes these:
| Gate id | What you tune | Reference |
|---|---|---|
coverage, swift-coverage, android-coverage | The minimum and minimum-branches of the coverage check in ward.toml, and the Swift and Android coverage minimums | references/coverage.md |
mutation | PIT threshold, target classes, and threads | references/mutation.md |
mypy | mypy strict mode and the pydantic and Django plugins in mypy.ini | references/mypy.md |
mutmut | mutmut's source paths and its 60% minimum | references/mutation.md |
ward | The Ward rules that ward-rules.toml selects for the project's languages (Java, Kotlin, TypeScript, JavaScript, Python, Swift), their severities and options | references/ward-rules.md |
ward (architecture) | [[checks.ward.layers]] boundaries, [checks.ward.cycles] source roots and [[checks.ward.independence]] module lists, written by ward init; the layer, slice cycle and feature independence rules | Not tuned here; edit the tables by hand or re-run ward init. The project's own architecture rules (ward:architecture/dependencies, naming and location) are [[rule]] tables of ward-architecture.toml. ward init writes that file once for a chosen style and never changes it afterwards, so it is the user's: edit it here with them, with the same evidence, diff and approval as any other rule. A rule that forbids a library uses must-not-depend-on = { external = ["org.springframework"] }: package or module names without *, matched with everything below them. Deleting a rule, or adding allow-empty = true or an exclude-paths entry to make a finding go away, is weakening and needs its own approval |
vitest, jest, bun-test | Their coverage minimums are on the coverage check, not on the test gate | references/coverage.md |
stryker | Stryker's thresholds.break and run settings | references/mutation.md |
crap | max on the crap check in ward.toml (default 30). Raising it is a weakening | The gates page of the Ward docs, CRAP gate |
build-policy, openapi-lint | The build.* and openapi.* rules that ward-rules.toml selects, and their severities | references/ward-rules.md |
secrets | exclude-paths on the check, and entropy or exclude-paths of one rule in ward-rules.toml. Every exclusion is a weakening: a path that is left out is never read | The secret detection page of the Ward docs |
license | deny or allow, exceptions, scopes and unknown on the check. This is the project's license policy: propose a change only when the user asks for one | The gates page of the Ward docs, License gate |
vulnerabilities | minimum-severity and max-age-days on the check. Raising minimum-severity hides findings and is a weakening | The vulnerabilities page of the Ward docs |
api-compat, openapi-diff, openapi-compat | Nothing: they compare with a baseline and have no threshold | Not tuned here |
Ask which of the enabled ones the user wants to tune, or offer all of them. If the user asks for a
gate that is not enabled, say so, suggest ward-init to add it, and change nothing. This skill
never enables or disables gates in ward.toml.
Load only the references for the gates in scope.
Also review each enabled gate's optional [checks.<name>.paths] table when tuning per-edit
checks. match and full control relevance, while args, item, and separator control safe
path narrowing. Narrowing match is a weakening of the per-edit check only; it does not weaken
the full check or the turn-end check, so propose it separately with evidence and a reason. Verify
custom path rendering against the real tool because an unsupported argument can falsely pass.
If ward.toml predates this session, ask now: "Running the gates executes the commands in
ward.toml. Is this repository trusted?" Without a yes, use only read-only evidence (files,
grep, existing reports under target/ or build/) and say that the findings may be stale.
With trust confirmed, run every gate once:
ward check --profile ci --format json
stdout is only JSON. Read each in-scope check by its name: status, findings (rule, file,
line, message), findingsTotal, and, for gates without structured findings, output. Then
collect the gate-specific evidence that each reference describes: per-rule counts from the full XML
reports, measured coverage ratios, and the package dependency table.
If a gate reports hundreds of findings, for example after a first strict setup on an existing
codebase, do not propose rules one finding at a time. See Step 5a.
A gate whose tool cannot even load its configuration, for example a rule file that fails to parse, is a configuration problem, not a finding. Report the tool's error as is, and fix the configuration with the user before tuning anything else.
For each rule file you might edit, read its first line:
<!-- managed-by: ward preset=<id> --> (or // managed-by: ward in vitest.config.mjs, jest.config.mjs
and stryker.config.mjs, # managed-by: ward in .coveragerc) means Ward owns the file. The next ward init
run refreshes it to the preset's content and silently undoes any tuning.keep.Before the first edit to a managed file, explain this and ask: "Should this file become yours, so
that later ward init runs keep your tuned rules?" A yes means you remove the marker line in
the same approved edit as the tuning. A no means the file is not edited at all. Never edit a
managed file and keep its marker.
Build files (pom.xml, build.gradle(.kts)) carry no marker.
Init does not rewrite an existing JaCoCo configuration, and it holds no coverage minimum.
Turn the evidence into proposals. Put each one in a class, using the tables in the references:
ward.toml.Present strengthening and neutral proposals first, then weakenings. For each proposal, show:
ward:java/magic-number: 41 findings, e.g. Order.java:7, Pricing.java:33, or
domain → infrastructure imports: 0.For a weakening, also show the old and new values, and ask for a reason in one sentence. Ask for
approval of that single change. When a finding can be fixed in the code, offer that first. Put the
reason in a comment next to the change, so reviewers see why it was made: a # comment in
ward-rules.toml or ward.toml, an XML comment in pom.xml.
Write a change only after the user approves it. If the user declines, leave the file untouched and move on to the next proposal. Never batch several weakenings into one approval.
When a gate has more findings than the user can review one by one (as a rule of thumb, more than
50) and the user wants the code fixed, hand off to the ward-fix skill. It plans and fixes the
backlog rule by rule. Propose rule changes here only for the rules the user wants changed, through
Step 5 as usual. Never use a baseline, an "ignore existing findings" file, or a suppression to shrink
the backlog. These are suppressions under the guardrails.
To turn a rule on or off in ward-rules.toml, use ward rules enable <id>... or ward rules disable <id>... after the user approves it. They take the printed id
(ward:java/method-length) and write it as java.method-length, the name the file uses. They
change only the include and exclude lists and keep the file's comments; they do not change [rules.<language>.<rule-name>] tables, which you still edit as text.
Edit only the approved files, exactly as shown. Keep the file's existing formatting and indentation. If a managed file's ownership was transferred, the marker line is removed in this same edit.
If an edit touches ward.toml, for example a Gradle coverage gate command or a layer boundary, tell the user that a later ward init --overwrite regenerates ward.toml, and
that this edit would then need to be made again.
If AGENTS.md has a <!-- ward-owned: agent-rules v1 begin --> section and an approved change
alters a value it states (for example a method length, a coverage minimum, or the mutation
threshold), propose updating that line in the same approval, so agents keep working to the real
limit. Tell the user that ward init --agent-rules rewrites the section from the preset.
Run the gates again:
ward check --profile ci --format json
Report each tuned gate's status, and compare its findings with Step 3. If a tuned gate fails:
List each change with its class, the files it touched, and every weakening with its reason. Mention
any files that changed ownership, and that ward init will now keep them. Mention any
ward.toml edits that a later --overwrite would undo, and any AGENTS.md rules section lines
that a later ward init --agent-rules would reset. End with the current status of every
tuned gate.
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-fixFix the code so the quality gates Ward already runs in this Java, Kotlin, TypeScript, JavaScript, Python, or Swift project pass (compile errors, ward-format, Ward rules, failing tests, coverage, mutation testing, architecture rules, secrets, and vulnerable dependencies). Reads the findings from `ward check --format json`, plans the fixes gate by gate and rule by rule, fixes the code without changing behavior, and re-runs the gate after each step. It never changes rules, thresholds, or ward.toml, and never adds suppressions. Use when `ward check` fails, after ward-init sets Ward up on an existing codebase, or when the user asks to fix Ward findings or make the gates pass./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.Other plugins' skills for the same job