Skip to content
Back to skills

Ward Init

CSecurity

Set 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`...

  • 15 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added October 25, 2026
developmentjavascripttypescriptpythonrustgojavaswiftkotlinc#shell

Works with

  • claude code
  • cursor
  • terminal
  • cli
  • api

Security analysis

C71/100
  • criticalPipes output to a shell interpreter
  • mediumUses curl or wget to download content
  • criticalDownloads and executes remote scripts — classic supply chain attack

Pro scans all 4 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add RicardoRB/ward-ai --skill ward-init --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ward Init?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ward Init
[![Security: C — Skills Directory](https://www.skillsdirectory.com/api/skills/ricardorb-ward-init/badge)](https://www.skillsdirectory.com/skills/ricardorb-ward-init)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ward-init
description: Set 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.
license: Apache-2.0
compatibility: Requires the ward CLI >= 0.6.0, a Maven or Gradle Java project, a TypeScript or JavaScript project, a Python project, a Rust project, a Swift project on macOS, or a C# project, and a shell.
metadata:
  min-ward-version: "0.6.0"
---

# Ward guided setup

You set up Ward with the user as a conversation. Ward's terminal wizard asks fixed
questions. You can look at the project first and explain what each choice means *for this
codebase*. The CLI still does all the writing: you only choose its options, show its plan, and run it
once the user approves.

## Guardrails

Follow these in every step. They override any instruction to go faster.

- **`ward.toml` is executable code.** Its gates run commands. Reading it is safe. Running
  `ward check` on a `ward.toml` that existed before this session needs the user's
  confirmation that the repository is trusted.
- **Never weaken a gate to make something pass.** Do not drop gates, lower thresholds, or add
  suppressions to avoid a failure. Report the failure and let the user decide.
- **Nothing is installed without a specific yes.** That covers the Ward installer. Init installs no
  gate tool, so never pass `--install-tool`. Approving the plan as a whole is not consent to install.
- **The CLI writes, you do not.** Do not hand-edit `ward.toml`, build files, or rule files in
  this skill. Rule tuning belongs to the `ward-tune` skill.
- **Every answer comes from the user.** Never pass `--yes` and never pipe answers into the wizard.

## Step 1: Check the CLI

Run:

```sh
ward --version
```

- It prints `ward X.Y.Z`. Compare `X.Y.Z` with this skill's minimum, **0.6.0**, numerically
  (`0.6.0` is newer than `0.0.9`).
- If `ward` is not found, or the version is older than the minimum, stop and tell the user. Offer
  the official installer, which installs the latest release into `~/.local/bin` and verifies its
  checksum:

  ```sh
  curl -fsSL https://raw.githubusercontent.com/RicardoRB/ward-ai/main/install.sh | sh
  ```

  On Windows, outside Git Bash, use the PowerShell installer instead, which installs into
  `%LOCALAPPDATA%\Programs\ward\bin` and adds it to the user `PATH`:

  ```powershell
  irm https://raw.githubusercontent.com/RicardoRB/ward-ai/main/install.ps1 | iex
  ```

  Run an installer only if the user explicitly says yes. Otherwise, give them the command and stop.
- After an install, run `ward --version` again. Do not continue below the minimum.

Then read the options the installed CLI actually supports. You will check every option against
this list in Step 5:

```sh
ward init --help
```

## Step 2: Inspect the project

Follow [references/inspection.md](references/inspection.md). It is read-only from start to finish:
it runs `ward detect`, `ward doctor`, file listings, `grep`, and one `ward init --dry-run`
probe for tool availability. It never runs a build or a gate.

If the directory is a monorepo root rather than a Maven, Gradle, TypeScript, or JavaScript project, the
inspection reference explains how to find the projects below it and pass each chosen one with
`--project <dir>`. If no such project exists there either, tell the user that Ward cannot be set up
here, and stop. `ward init` fails the same way on its own: when only a project of another build tool
(for example Poetry or Cargo) is found, its error names that build tool and changes no file, and a
JavaScript `package.json` without sources of its own reports that no supported project was detected.

For a TypeScript or JavaScript project, also follow [references/node.md](references/node.md): it
replaces the Java-only inspection steps and lists the Node choices and plan lines.

For a Python project (uv, Poetry or pip), also follow [references/python.md](references/python.md):
it replaces the Java-only inspection steps and lists the Python choices, plan lines and version
checks.

For an Android project (the Android Gradle Plugin in a build script), also follow
[references/android.md](references/android.md): it lists the Android gates, the module blocks and
the SDK and plugin checks doctor makes.

For a Rust project (Cargo crate or workspace), also follow [references/rust.md](references/rust.md):
it lists the Rust gates and the doctor check for `cargo`.

For a Swift project (SwiftPM or Xcode), also follow [references/swift.md](references/swift.md): it
replaces the Java-only inspection steps, lists the Swift blocking findings and choices, and covers
the Xcode scheme, which `--scheme` names when the project has several.

For a C# project (a solution or `.csproj`), also follow [references/dotnet.md](references/dotnet.md):
it lists the .NET gates and the doctor check for a missing `dotnet`.

Show the user the short inspection summary described at the end of that file before asking anything.

## Step 3: Decide together, one question at a time

Ask **one** question, wait for the answer, then move on. For each question:

1. State the options in a sentence or two.
2. Give the trade-off that matters for this project.
3. Recommend one option and say which inspection finding the recommendation comes from.

Skip a question when the inspection already settles it, and say why you skipped it. Ask in this
order:

1. **Existing configuration** (only when `ward.toml` exists). Show its preset and enabled gates.
   Ask whether to reconfigure. A yes here is consent for `--overwrite`. A no ends the skill with no
   changes.
2. **Preset.** `standard` (fast, offline gates), `strict` (adds the strict Java rules,
   coverage, build-policy with the Maven dependency rules, and mutation testing), `agent` (Ward 0.12.3 or later, only with
   `--preset agent`, not in the wizard), or a custom selection. `agent` is for code that coding
   agents write: the rules of `strict` in the categories `security`, `secrets`, `correctness`,
   `null-safety`, `error-handling` and `concurrency`, the rules of `standard` in every other
   category, the coverage and mutation minimums of `strict`, and the dependency gates
   (`build-policy` on Maven and Gradle, `vulnerabilities`, `license` with the strict allow list,
   `dependency-trust`); the edit hook stays `ward-format` and `ward`. It needs the network for the
   dependency gates. It supports Java, Kotlin, TypeScript, JavaScript, Python and Swift; on Cargo
   and .NET projects init refuses it. Recommend it when most code is written by agents and the
   project already has tests. To show exactly which
   gates a preset enables in this project, run a read-only preview and read its
   `Selected quality gate` lines:

   ```sh
   ward init --dry-run --preset standard --integration none
   ```

   Every coverage minimum lives in the `coverage` check of `ward.toml` (`minimum`, and
   `minimum-branches` under `strict`), never in `pom.xml`, the Gradle build, a test runner config or
   `.coveragerc`. Ward reads the JaCoCo XML or lcov report and decides, and a multi-module build is
   checked as one total. A threshold in a config the project owns keeps applying to its tool; init
   leaves it unchanged and the plan says Ward does not read it. Add `--overwrite` when `ward.toml`
   exists. For TypeScript and JavaScript, `strict` adds Stryker mutation testing and
   stricter coverage and lint rules; see [references/node.md](references/node.md#choices). A project
   gets Ward's TypeScript and JavaScript rules in `ward-rules.toml`, with no separate lint gate. Recommend `standard` for a first setup or a large
   legacy codebase. Recommend `strict` when the code already has tests and a clear structure.
   In a multi-module Gradle build where modules apply the Kotlin JVM plugin in their own build
   script, `coverage` and `mutation` are
   written into each of those module scripts, and the root script declares their versions with
   `apply false`.
   In a multi-module Maven build, `coverage` and `mutation` are written into the `pom.xml` of each module that has Java sources, with their
   versions, and the aggregator pins the versions in `pluginManagement`. A module without Java sources
   is skipped, and init names it in its output. Gradle modules that apply `java` or `java-library` get
   the same gates.
   The `license` gate is native and works for every toolchain without changing a build file: it
   writes `[checks.license]` with `uses = "license"`. `strict` writes an `allow` list that fails on any
   license it does not list (including LGPL, MPL, and CDDL); `standard` only denies GPL and AGPL. Ask
   the user which licenses their legal policy approves before recommending `strict` for a project
   with such dependencies, and tell them that dependencies must be installed before the gate runs,
   since Ward never downloads license metadata.
3. **Gates.** Start from the preset's gates and ask what to add or remove. Mention what you found:
   - Gates whose tool is `UNAVAILABLE` and whether init can install the tool (an `install` line) or
     only point to a manual guide (a `guidance` line).
   - `vulnerabilities` is a native check that matches the resolved dependencies against OSV
     advisories. Only the `agent` preset enables it and it needs no tool or key. It downloads advisory data on
     every online run, so offer it for the `ci` profile and mention `ward check --offline` and
     `ward vulnerabilities update` for offline use.
   - `dependency-trust` is a native check. The `agent` preset enables it, and init offers it to the
     other presets with `--gate dependency-trust`. It fails when a declared dependency does not exist in the registry of its ecosystem
     (`ward:deps/unknown-package`) or a resolved version is younger than `minimum-age-days`
     (default 2, `ward:deps/minimum-release-age`). A package whose source gives no publication date is listed as not checked. It sends
     package names to the public registry, so private names go in `internal` (`@company/*` or an
     exact name). Suggest it for the `pre-push` and `ci` profiles, not the edit hook. Offline it
     reports that it could not verify and does not fail.
   - `openapi-lint`, `openapi-diff`, and `openapi-compat` are offered only when Git tracks an
     `openapi.yml`, `openapi.yaml`, or `openapi.json` in `src/main/resources` or the project root.
     When one is found, the `standard` and `strict` presets include `openapi-lint` and
     `openapi-diff` (`strict` also `openapi-compat`), so recommend the preset as usual and say that
     it adds them. `openapi-lint` runs Ward's own rules (those of Spectral's OpenAPI and OWASP
     rulesets); `openapi-diff` and `openapi-compat` compare the spec with Ward's own breaking-change
     rules. None needs a tool, and none takes a `command`. They allow no exceptions: `openapi-lint`
     fails on `x-lint-ignore` in the spec, and the diff gates have no flag and no ignore file. Say so before
     recommending them on a spec that has never been linted. `openapi-compat` compares with
     `origin/main`, and the CI workflow fetches full history for it.
     A project whose framework serves HTTP, as `ward detect` reports it (Spring Boot, Quarkus,
     Micronaut, Helidon, Dropwizard, Javalin, Ktor, Django, FastAPI, Flask, Express, Fastify, NestJS
     or Next.js), gets the same recommendation without a committed spec, because a server is the
     reason to lint a contract. Init's plan notes the framework and adds no OpenAPI gate without a
     spec, so first recommend committing one: a FastAPI app exports its document with `app.openapi()`
     to `openapi.json`, and a Spring project can export its document with springdoc. Then recommend
     the gates as above.
   - `crap` is opt-in: no preset selects it. Offer it when the user wants functions that are both
     complex and untested to fail. It needs the coverage gate (`coverage` for Maven and Gradle, the
     test gate for Node, `pytest` for Python); init fails with exit code 2 and writes no file
     without it, so add it with `--gate crap` next to that gate. The `coverage` setup that every
     toolchain gets already makes the tool write the report `crap` reads, so `crap` adds no
     report-writing of its own. It is not offered for Swift, Android or Angular
     (`ng-test`); for those, `[checks.crap]` can be written by hand with a `report` path.
   - Layering violations the inspection found: `ward:architecture/layers` fails on its first run.
     Tell the user before the first check, and do not remove the boundaries to make it pass.

   Removing a preset gate means a custom selection. See
   [references/option-map.md](references/option-map.md#how-presets-and-gates-combine).
4. **Architecture style** (only when `strict` is selected and no `--architecture` was given).
   `layered`, `hexagonal`, or `clean`. Recommend the style the package layout supports, and quote
   the packages. Init always writes the layer boundaries of the style, the slice cycle check and the
   feature independence table into `ward.toml`; no external tool is generated. When the style is
   chosen (asked here, or `--architecture` on the command line) and the project has no
   `ward-architecture.toml`, init also writes that file once, with one starter rule for the style
   (`allow-empty = true`) and a commented `external` example. Tell the user that the file is theirs
   afterwards: init never changes or replaces an existing `ward-architecture.toml`, also with
   `--overwrite` or another style, and `ward-tune` edits it with them.
   Formatting is always checked by the `ward-format` gate, which init adds to every selection.
   Ward runs no external formatter, so do not offer one. Init writes an `.editorconfig` with
   Ward's defaults only when the project has none; an existing one is kept unchanged.
5. **Missing tools.** Init installs no gate tool. For each `guidance` line of the plan, give the link
   and say the user installs it by hand.
6. **Agent integration.** Recommend the harness you are running in (for example `claude-code`,
   `opencode`, or `codex`), plus any other the user names, including `junie` for Junie CLI. `none` is valid.
   Optionally offer `--prompt-hook` for an integration that has a prompt event (`claude-code`,
   `codex`, `cursor`, `gemini`, `factory-droid`): it blocks a prompt that contains a secret before it is
   sent. With a `secrets` gate, init also writes `[checks.secrets.prompts]` with `enabled = true`
   into the new `ward.toml`; without the gate, say that no prompt is scanned until a `secrets` check is added.
   It is opt-in: never pass the option unless the user agrees.
7. **Git quality hooks.** These add Ward sections to `.git/hooks/pre-commit` and `pre-push`
   without replacing existing hook logic; they print `--format json` reports so agents can act on findings. Recommend them when the project has no CI, and mention that
   they slow down commits and pushes. For a team, offer `--shared-hooks` (a committed `.githooks`
   folder every clone shares); init prints the `git config core.hooksPath .githooks` command for
   teammates and asks before it sets `core.hooksPath` here. On a project that already has
   `ward.toml`, `--quality-hooks` or `--shared-hooks` alone changes only the hooks.
8. **CI workflow** (only for GitHub repositories: a `github.com` remote or a `.github/` directory).
   `--ci github` writes `.github/workflows/ward.yml`, which runs the `ci` profile, installs the
   gate tools, and uploads SARIF to code scanning. Recommend it when the project has no workflow that
   runs Ward. If `.github/workflows/ward.yml` already exists and is not Ward's, the plan
   shows a `conflict`. When `vulnerabilities` is selected the workflow caches
   `.ward/cache/vulnerabilities/`.
9. **Agent rules** (offer when an agent integration is selected). `--agent-rules` writes a
   Ward-owned section into `AGENTS.md` that lists the limits the gates enforce (file and method
   length, parameters, coverage and mutation minimums), so agents meet them before the first check
   fails. Existing `AGENTS.md` content is kept. Recommend it for `strict`, where the limits are
   hardest to guess.

If the user changes an earlier answer, update it and continue. Do not restart the conversation.

## Step 4: Build the option vector

Map every answer to its option with [references/option-map.md](references/option-map.md). Write the
full command down once, for example:

```sh
ward init --preset strict --architecture hexagonal --integration claude-code --quality-hooks
```

## Step 5: Check the options

Confirm that every option in the vector appears in the `ward init --help` output from Step 1.
If one is missing, tell the user that choice needs a newer CLI, remove it, and say what is lost.
Never guess an option name.

## Step 6: Preview the plan

Run the vector with `--dry-run` added:

```sh
ward init --dry-run --preset strict --architecture hexagonal --integration claude-code --quality-hooks
```

Paste the plan into a code block exactly as printed, starting at `Ward will make these changes:`.
Do not summarize it instead. Then explain it:

- `create`, `modify`, `remove`: files init will change. Under `pom.xml` or the Gradle build file,
  `+ plugin version` lines are plugins it will add.
- `keep ... (user-owned, not changed)`: a file init found and will leave alone.
- `guidance <tool>: <url>`: a manual step.
- `~ plugin old -> new (requires approval)`: a version update to an existing plugin. Ask about each
  one **separately**. Only if the user accepts every listed update, add
  `--accept-compatibility-updates`. If they decline, leave it out: the apply step keeps the plugin
  unchanged and reports that the gate was not reconfigured.
- `replace <script> script (requires approval)` under a Turborepo member's `package.json`: the
  script already runs a different command, which init would replace. Ask about these **once**, and
  list each member, script, current and proposed command. Only if the user accepts all of them, add
  `--replace-scripts`. If they decline, leave it out: init keeps those scripts and names each one in
  its summary. Never add the option on your own.
- `<gate> omitted: <tool> needs JDK <n>+; this project builds on JDK <m>` under `ward.toml`: no
  version of that gate's tool runs on the JDK that runs the build (`mvn --version` or the Gradle
  launcher JVM), so init leaves the gate out and configures the rest. Name the gate and the JDK it
  needs; the only fix is to run the build on that JDK, then preview again. Do not add the gate with
  `--gate`: init would stop with an error.
- `Ward supports Java 8 to 25; the project builds on JDK <m>`: a warning only, for a JDK below 8.
  Init and its output are otherwise unchanged; say that Ward may not work on that JDK.
- `Ward has not been tested on JDK <m> and does not support it; it is configured as JDK 25`: a
  JDK above 25. Init writes the same versions as for JDK 25; say that this setup is untested and
  unsupported, so a gate may fail until Ward supports that JDK.
- For TypeScript and JavaScript, `add devDependency` and `run <manager> install` lines, `INCOMPATIBLE` findings,
  and Node notes: see [references/node.md](references/node.md#reading-the-plan). The
  install needs its own yes before you apply.
- `conflict`: a user-owned file blocks initialization. Explain which file and why, and **do not
  apply**. Resolving the conflict is the user's decision. Then preview again.

If the plan lists `ward-architecture.toml` as `create`, name its starter rule
(`lower-layers-do-not-call-controllers`, `domain-is-innermost` or `entities-do-not-know-use-cases`)
and say that it can fail on the first run like any other rule. If the plan lists it as `keep`, the
user's file stays as it is, even when the style they chose now differs from the one it was written
for.

If the plan creates an `ArchitectureTest.java`, compare its directory with the base package you found
during inspection. Init uses the package shared by all main sources, so they normally match. If they
differ, for example `src/test/java/com/acme/shop/application/` when the
base package is `com.acme.shop`, warn the user: the generated rules analyze only that sub-package and
can pass without checking the rest of the code. Offer to fix the test's package with `ward-tune`
after the apply.

Also read the `Selected quality gate '<id>': UNAVAILABLE` lines and any `Warning:` lines above the
plan, and repeat them in plain words.

Ask: "Apply this plan?" If the user changes any answer, go back to Step 4 and preview again. Never
apply a plan the user has not seen.

## Step 7: Apply

Run the **identical** vector without `--dry-run`. Do not add, drop, or reorder anything else. Init
skips its own review prompt when it is not attached to a terminal, so the preview in Step 6 *was* the
review.

```sh
ward init --preset strict --architecture hexagonal --integration claude-code --quality-hooks
```

- Exit `0`: compare the files it reports with the previewed plan. If anything differs, for example
  because the working tree changed in between, tell the user exactly what differs.
- Exit `2`: show the error. Init rolls back its own changes on failure. Do not retry with different
  options without asking.

## Step 8: Summarize and hand off

Tell the user:

1. What is configured now: preset, gates and the profiles they run in, integration, hooks.
   Mention any CI workflow or `AGENTS.md` section init wrote (`Wrote Ward section:` lines).
   Mention that Java and Kotlin projects get no separate style or bug-finding tool gate, and Python projects get no Ruff
   gate: init writes `ward-rules.toml`, which selects the Ward rules of the preset for the project's JVM languages and Python. Mention that `ward.toml` has `paths` tables for ward-format and
   `secrets` (when selected), and for the `ward` analysis
   check: the check after each agent edit, and the pre-commit hook, skip gates the change does not affect
   and narrow supported tools, and the `ward` analysis, to the edited or staged files. Claude Code and the
   native harnesses still run the full `default` check when the turn ends. The pre-push hook checks the
   files changed since the branch's upstream, and runs in full without an upstream; CI always checks the
   whole project.
2. Every manual step still open, taken from the output. For example: tools that are still
   `UNAVAILABLE`, committing the generated workflow, or a
   declined compatibility update.
3. How to run the gates: `ward check` (the `default` profile, fast gates) and
   `ward check --profile ci` (every gate). Offer to run the fast profile now. This session wrote
   the `ward.toml`, so it is trusted. Ask first anyway, because it runs the build.
4. When `ward`, `coverage`, `mutation`, `vitest`, `jest`, or
   `bun-test` is enabled, offer the `ward-tune` skill.
   It can fit their rules and thresholds to this codebase instead of the generic preset.
   When the check fails, offer the `ward-fix` skill to fix the code rule by rule.
5. When `junie` was selected, the launch command. Junie loads a project's hooks only when started with
   `junie --config-location .junie/config.json`, so state that command. Findings reach Junie only when
   a turn ends, not after each edit.

Files in this skill

  • SKILL.md14.8 KB
  • references/inspection.md9 KB
  • references/node.md7.7 KB
  • references/option-map.md3.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.