Harness initialize project

From Intense-Visions/harness-engineering · View interactive version

Harness initialize project is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Scaffold a new harness-compliant project, migrate an existing project to the next adoption level, or bootstrap an existing project that just got the harness marketplace plugin installed (no `harness

How to use this skill

Skill file

Initialize Harness Project

Scaffold a new harness-compliant project, migrate an existing project to the next adoption level, or bootstrap an existing project that just got the harness marketplace plugin installed (no harness setup). Ground the project in a strategic anchor (STRATEGY.md) first, then assess current state, scaffold or migrate, configure, validate, instrument (baselines / telemetry / Tier-0 integrations), and finalize.

When to Use

Plugin-only callout

If the user installed only the harness-claude (or sibling harness-cursor/harness-gemini/harness-codex) marketplace plugin, no harness shell binary is in their PATH. Prefix every CLI invocation in this skill with npx @harness-engineering/cli:

# instead of: harness validate
npx @harness-engineering/cli validate
# instead of: harness check-arch --update-baseline
npx @harness-engineering/cli check-arch --update-baseline

Detect plugin-only state by checking whether harness resolves on PATH (command -v harness). If not, use the npx form. First call is slow; subsequent calls within ~24h hit the npx cache.

Process

Prompt the human in plain text — every framework confirmation, migration check, and telemetry-identity question in this skill is plain text only. Do not elevate to AskUserQuestion: the framework list (~10 options) exceeds its 4-option cap and natural headers like "Confirm framework" exceed its 12-char cap, rendering the call as ERR.

Phase 0: GROUND — Capture the Strategic Anchor

Run this before anything else — it is the first thing init does and the first question it asks the human.

Offer to capture STRATEGY.md, the durable upstream product anchor read by harness-brainstorming,

harness-ideate, and harness-roadmap-pilot. _Think first (strategy), build second (scaffold)._

Ask in plain text in your reply, same as the design-system step (Phase 3 step 5b) — never via emit_interaction, AskUserQuestion, or any tool (the human won't see a tool-routed prompt; only plain text reaches them across Claude Code, Cursor, Codex, and Gemini CLI). State your recommendation, then STOP and wait for the human's reply:

### Capture strategic anchor (STRATEGY.md) now?

|            | A) Yes — run the strategy interview                                                                                        | B) No — this project does not need a strategy doc                           | C) Not sure yet                                                       |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| **Pros**   | Grounds brainstorm/ideate/roadmap-pilot in product-level context; durable across milestones and phases (peer of README.md) | Permanent decline recorded; init does not re-ask on rerun                   | Decision deferred without commitment; can run /harness:strategy later |
| **Cons**   | Adds an interview (10-20 minutes) to init                                                                                  | Re-running init will not re-offer; user must run /harness:strategy manually | No decline flag set; init may re-offer on rerun                       |
| **Risk**   | Low                                                                                                                        | Low                                                                         | Low                                                                   |
| **Effort** | Medium                                                                                                                     | Low                                                                         | Low                                                                   |

**Recommendation:** A) Yes — run the strategy interview (confidence: medium) — strategy grounds brainstorm/ideate/roadmap-pilot; value compounds as the project grows.

Before prompting, check whether STRATEGY.md already exists at repo root. Three cases:

Guards:

step 5 test-suite classification and the step-6 dispatch, identical in reach to the legacy step.

strategy doc — distinct from the .harness/-based adoption-level classification in Phase 1: ASSESS,

which Phase 0 must not pre-empt.

This mirrors the ask-once-record-the-answer pattern also used by the i18n and design-system prompts in Phase 3.

Phase 1: ASSESS — Determine Current State

  1. Check for existing harness configuration. Look for .harness/ directory, AGENTS.md, harness.config.json, and any skill definitions. Their presence determines whether this is a new project or a migration.
  1. For new projects: Gather project context — language, framework, test runner, build tool. Ask the human if any of these are undecided. Do not assume defaults.

2b. For existing projects with detectable frameworks: Run harness init without flags first. The command auto-detects frameworks (FastAPI, Django, Gin, Axum, Spring Boot, Next.js, React+Vite, Vue, Express, NestJS) by scanning project files. Present the detection result to the human and ask for confirmation before proceeding. If detection fails, ask the human to specify --framework manually.

  1. For existing projects: Run harness validate to see what is already configured and what is missing. Read AGENTS.md if it exists. Identify the current adoption level:
  1. Recommend the target adoption level. For new projects, recommend load-bearing-minimum — the minimum tier that keeps its guarantees when the senior reviewer disappears for two weeks (ESLint + layer enforcement, complexity cap 15, module-size cap, multi-persona review, and the outcome-eval ship gate wired into a scaffolded CI workflow), without the full advanced-tier surface area. Offer basic as an explicit opt-down for teams that want the lightest possible touch or are brand new to harness. For existing projects, suggest one level up from current. Present the guidance and wait for confirmation.
  1. Classify the project shape — product/service or test-suite? Check these signals; if any match, the project is a test suite and the rest of this skill's flow changes:

If a test suite: complete Phase 2 (scaffolding) here, then dispatch to initialize-test-suite-project for Phase 3 configuration and Phase 4 verification, then return here for Phase 4 step 4+ (knowledge graph, roadmap question, final commit). The test-suite skill owns archetype selection, layer variants, tags, reporters, and the custom report.

If a product/service: continue with the rest of this skill as written.

Phase 2: SCAFFOLD — Generate Project Structure

  1. Run harness init with the appropriate flags:

Supported frameworks: nextjs, react-vite, vue, express, nestjs, fastapi, django, gin, axum, spring-boot

Supported languages: typescript, python, go, rust, java

  1. Review generated files. harness init creates:
  1. Do not blindly accept generated content. Read the generated AGENTS.md and harness.config.json. Flag anything that looks wrong or incomplete. The scaffolded output is a starting point, not a finished product.

Phase 3: CONFIGURE — Customize for the Project

  1. Persist the Phase 0 grounding decision. SCAFFOLD has now created .harness/. If the user declined

the strategic anchor in Phase 0: GROUND (answered "No", or chose "ignore" on a present-but-invalid

STRATEGY.md), write init.strategy.declined: true to .harness/state.json (merge into existing JSON;

do not clobber). If the user answered "Yes" or "Not sure" in Phase 0, write nothing. This is the deferred

half of the Phase 0 offer: Phase 0 captures the answer, this step records the decline once .harness/

exists — so the relocation never fabricates .harness/ early and never misclassifies a new project as a

migration in Phase 1: ASSESS.

  1. Configure personas. Run harness persona generate to create persona definitions based on the project's stack and team structure. Personas define how agents should behave in this project — coding style, communication preferences, constraint strictness.
  1. Customize AGENTS.md. The generated template needs project-specific content:
  1. For intermediate and above: Define layer boundaries. Which modules belong to which layers? What are the allowed import directions? Document these in harness.config.json and ensure they match the actual codebase structure.
  1. For advanced: Configure state management (.harness/state.json schema), learnings capture (.harness/learnings.md conventions), and CI integration hooks.
  1. Configure i18n (all levels). Ask: "Will this project support multiple languages?" Based on the answer:

5b. Configure design system (non-test-suite projects). Mirror the i18n step's three-way response shape.

Ask directly in your reply. Do NOT route this question through emit_interaction, AskUserQuestion, or any tool. emit_interaction records the prompt but does not display it to the human — the client collapses the call to "Called harness" and the rendered text only returns to the model, so the human sees nothing. AskUserQuestion is Claude-Code-only and caps headers at 12 chars / 4 options. Plain text in your own message is the only channel that reliably reaches the human across every tool (Claude Code, Cursor, Codex, Gemini CLI). State your recommendation, then STOP and wait for the human's reply:

```markdown

### Will this project have a UI requiring a design system?

| | A) Yes — capture design intent now | B) No — this project has no UI | C) Not sure yet |

|---|---|---|---|

| Pros | Records platforms in harness.config.json; harness-design-system fires automatically on first design-touching feature | No future design nudges; permanent decline recorded | Decision deferred without commitment; can run harness-design-system later |

| Cons | One extra follow-up question (which platforms) | Re-running init is required if a UI is added later | No design.enabled flag set; on_new_feature will prompt later |

| Risk | Low | Low | Low |

| Effort | Low | Low | Low |

Recommendation: A) Yes — capture design intent now (confidence: medium) — most product/service projects benefit from a centralized design system.

```

Based on the answer:

Skip this step entirely if Phase 1 step 5 classified the project as a test suite. Test-suite projects will be dispatched at step 6 below to initialize-test-suite-project and have no UI to govern.

  1. Test-suite projects only — dispatch to initialize-test-suite-project. If Phase 1 step 5 classified this as a test suite, invoke initialize-test-suite-project now and let it own archetype selection, shared-library decision, layer variants (A self-contained vs B consumer), ESLint flat-config fix, tag taxonomy, reporter stack, custom report, and the "prove the guards fire" verification. Return here for Phase 4 step 4+ (knowledge graph, roadmap, commit). Product and service projects skip this step entirely.

Phase 4: VALIDATE — Confirm Everything Works

  1. Run harness validate to verify the full configuration. This checks:
  1. Fix any validation errors before finishing. Do not leave the project in a half-configured state.
  1. Run harness check-deps (intermediate and above) to verify dependency constraints match the actual codebase. If there are violations, decide with the human: update the constraints or fix the code.

Phase 5: INSTRUMENT — Capture Baselines and Wire Integrations

This phase closes the parity gap that the marketplace plugin install does not cover: knowledge graph, architecture/perf baselines, telemetry identity, legacy-layout migrations, and Tier-0 MCP integrations. For npm + harness setup users most of this was already wired during setup; the steps are still safe to re-run idempotently.

  1. Build the initial knowledge graph. Required for graph-based MCP tools (get_impact, find_context_for, compute_blast_radius, detect_anomalies):

```bash

harness scan

```

Populates .harness/graph/ with dependency and relationship data. Skip only if the project explicitly disables graph use in harness.config.json.

  1. Capture the architecture baseline. Records the current layer-violation, circular-dep, and complexity counts so future runs of harness check-arch can detect regressions:

```bash

harness check-arch --update-baseline

```

Writes .harness/arch/baselines.json. Re-run after large refactors. CI (refresh-baselines job in .github/workflows/ci.yml on this repo) auto-refreshes on main for harness-developing projects; downstream projects do this manually here.

  1. Capture the performance baseline (intermediate and above, or any project that wants regression detection on coupling and size budgets):

```bash

harness check-perf

```

First invocation captures the baseline; subsequent runs compare against it. Updates can be applied via the update_perf_baselines MCP tool when the human confirms a regression is intentional.

  1. Configure telemetry identity (optional but recommended for teams). Anonymous telemetry is default-enabled by the standard hook profile; identity tagging adds project/team/alias to events for filtering. Ask the human:

```bash

harness telemetry identify --project <project-name> --team <team-name>

```

Writes .harness/telemetry.json.

  1. Surface legacy layout warnings. If the project predates the current harness layout (docs/plans/, .harness/architecture/, etc.), the migrate command surfaces and optionally fixes them:

```bash

harness migrate --dry-run

```

If migrations are needed, ask the human before running harness migrate (without --dry-run). Skip silently when the dry-run reports nothing.

  1. Wire Tier-0 MCP integrations. Tier-0 is zero-config (no API keys): context7 (live library docs), sequential-thinking (structured reasoning), playwright (browser automation). On npm + harness setup they're auto-wired during step 4 of setup; on plugin-only installs they are NOT, since the plugin can't mutate the user's project .mcp.json.

List current state, then offer to wire:

```bash

harness integrations list

# then for each missing Tier-0 integration:

harness integrations add context7

harness integrations add sequential-thinking

harness integrations add playwright

```

For Tier-1 integrations (Linear, Slack, Perplexity, etc.), surface availability with harness integrations list and let the human decide — they require API keys and are out of scope for an automated bootstrap.

Phase 6: FINALIZE — Roadmap and Commit

  1. Set up project roadmap. docs/roadmap.md tracks features, milestones, and status across your specs and plans.

Ask in plain text in your reply, same as Phase 0: GROUND and Phase 3 step 5b — never via emit_interaction, AskUserQuestion, or any tool (the human won't see a tool-routed prompt; only plain text reaches them across Claude Code, Cursor, Codex, and Gemini CLI). State your recommendation, then STOP and wait for the human's reply:

```markdown

### Set up a project roadmap now?

| | A) Yes — create docs/roadmap.md now | B) No — skip for now |

| ---------- | ----------------------------------------------------------------------- | ------------------------------------------------ |

| Pros | Roadmap visible from day one; future specs auto-discovered on next sync | Smaller initial footprint |

| Cons | Adds one file to the initial commit | Run /harness:roadmap --create later when ready |

| Risk | Low | Low |

| Effort | Low | Low |

Recommendation: A) Yes — create docs/roadmap.md now (confidence: medium) — validation has just passed; a tangible "project works" signal is the right moment to introduce planning artifacts.

```

Based on the answer:

  1. Commit the initialization. All generated, configured, and instrumentation files in a single commit. Include harness.config.json, AGENTS.md, .harness/arch/baselines.json, .harness/telemetry.json (if created), updates to project .mcp.json (if Tier-0 integrations were wired), and any roadmap files.

Harness Integration

Success Criteria

Rationalizations to Reject

| Rationalization | Why It Is Wrong |

| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "The generated AGENTS.md template looks fine -- no need to customize it" | Phase 3 says do not blindly accept generated content. Without project-specific descriptions, agents receive generic instructions. |

| "We should start at the advanced level since we want full coverage" | The skill recommends load-bearing-minimum for new projects — enough to hold when the senior reviewer is away, without the full advanced surface area. Each level builds on the previous; jumping straight to advanced creates misconfigured rules. |

| "I will skip the i18n question to keep setup fast" | Phase 3 requires asking about i18n and recording the decision. Skipping creates ambiguity about whether the omission was intentional. |

| "I will skip the design-system question to keep setup fast" | Phase 3 step 5b requires asking about design and recording the answer in design.enabled. Skipping creates ambiguity about whether the omission was intentional and bypasses the linkage between init and the deferred harness-design-system invocation on on_new_feature. |

| "I will skip the strategy question — it's just paperwork" | Phase 0: GROUND is the only point in the workflow where init asks the user to capture the strategic anchor. Skipping bypasses the grounding signal that brainstorming, ideate, and roadmap-pilot read; downstream skill output degrades silently. Even a "no" or "not sure" answer is better than no answer because it locks in the decision (or absence of one). |

| "STRATEGY.md exists already, so I should re-run the interview to refresh it" | When STRATEGY.md is present and valid, Phase 0: GROUND skips the prompt silently. Refreshing strategy mid-init is out of scope — that is what the standalone /harness:strategy update flow is for. Surface a one-line detection note and continue. |

| "STRATEGY.md is present but invalid, so I should block init" | Phase 0: GROUND explicitly does NOT block. It surfaces the validation error, offers three repair paths (fix now / move-to-bak / ignore), and continues based on the user's choice. Init is the wrong place to gate on strategy correctness. |

| "Validation passed, so the project is ready" | Phase 5 captures baselines, configures telemetry identity, surfaces legacy warnings, and wires Tier-0 integrations. Validation alone is not sufficient. |

| "Plugin install means setup is done" | The marketplace plugin ships skills, slash commands, subagents, hooks, and MCP — but it cannot mutate the user's project state. harness.config.json, baselines, telemetry identity, and Tier-0 integrations require running this skill once per project. |

| "Skip Phase 5 if we already ran harness setup" | Phase 5 is idempotent. It safely no-ops where setup already wired things and fills gaps where it didn't (common case: setup ran once, then a new Tier-0 integration was added or a layout was migrated). Re-running is the right behavior. |

| "This is a test suite, we'll configure layers in this skill" | Phase 3 step 6 dispatches to initialize-test-suite-project for archetype selection, layer variants, and the rest. Do not inline test-suite-specific configuration here — the sub-skill owns it and carries the gotchas. |

Examples

Example: New TypeScript Project (Basic Level)

ASSESS:

Human: "I'm starting a new TypeScript API project using Express and Vitest."
Check for .harness/ — not found. This is a new project.
Recommend: load-bearing-minimum (the default — holds when the senior reviewer is away).
Human opts down: "Keep it light for now — basic is fine."

SCAFFOLD:

harness init --level basic --framework express
# Creates: harness.config.json, .harness/, AGENTS.md (template)

CONFIGURE:

Edit AGENTS.md:
  - Add project description: "REST API for widget management"
  - Add stack: TypeScript, Express, Vitest, PostgreSQL
  - Add conventions: "Use zod for validation, repository pattern for data access"
  - Add constraints: "No direct SQL queries outside repository layer"
  - Ask: "Will this project support multiple languages?"
  - Human: "Yes, Spanish and French."
  - Run harness-i18n-workflow configure (source: en, targets: es, fr)
  - Run harness-i18n-workflow scaffold (creates locales/ directory structure)

VALIDATE:

harness validate  # Pass — basic level checks satisfied
git add harness.config.json .harness/ AGENTS.md
git commit -m "feat: initialize harness project at basic level"

Example: New TypeScript Web App with Design and Roadmap

GROUND (Phase 0 — asked first, before ASSESS/SCAFFOLD):

Phase 0 (strategy): "Capture strategic anchor (STRATEGY.md) now?"
  Human: "Yes."
  Delegate to harness-strategy → first-run interview → STRATEGY.md written.
  Result: STRATEGY.md exists at repo root, doc-validated via validate_strategy (StrategyDocSchema);
  no project-level harness validate runs in Phase 0.

ASSESS:

Human: "I'm starting a new Next.js web app. Single-language, but it definitely needs a design system."
Check for .harness/ — not found. Suggested tier: load-bearing-minimum (the standard starting point). Human opts down to basic for the first pass.
Phase 1 step 5 classification: not a test suite (Next.js app with src/, no playwright/cypress).

SCAFFOLD:

harness init --level basic --framework nextjs

CONFIGURE (Phase 3):

Step 0 (persist grounding): user answered "Yes" in Phase 0 → STRATEGY.md already written; nothing to persist.

Step 5 (i18n): "Will this project support multiple languages?"
  Human: "No, English only."
  Result: i18n.enabled = false in harness.config.json.

Step 5b (design): "Will this project have a UI requiring a design system?"
  Human: "Yes."
  Follow-up: "Which platforms? web, mobile, or both?"
  Human: "Web."
  Result: design.enabled = true, design.platforms = ["web"] in harness.config.json.
  Inform: "Design tokens will be generated when you start your first design-touching
  feature — harness-design-system fires automatically via on_new_feature."

Step 6 (test-suite dispatch): skipped (not a test suite).

VALIDATE (Phase 4):

Step 1: harness validate — pass.
Step 3: harness check-deps — pass (basic level, no constraints yet).
Build initial knowledge graph: harness scan — graph populated.

Step 4 (roadmap): "Set up a project roadmap now?"
  Human: "Yes."
  Invoke harness-roadmap (or /harness:roadmap --create) — docs/roadmap.md created.
  design.enabled === true detected → manage_roadmap action: add
    feature: "Set up design system"
    status: planned
    milestone: Intake
    summary: "Run harness-design-system to define palette, typography, and generate W3C DTCG tokens..."
  Result: docs/roadmap.md contains the planned design item.

Step 5: commit.
git add harness.config.json .harness/ AGENTS.md docs/roadmap.md
git commit -m "feat: initialize harness project with design and roadmap"

Final state: harness.config.json has design.enabled: true + design.platforms: ["web"]; docs/roadmap.md lists "Set up design system" as a planned item under Intake; on the first feature touching UI, on_new_feature fires harness-design-system which reads design.enabled and runs the full discover/define/generate/validate flow.

Example: Migrating Existing Project from Basic to Intermediate

ASSESS:

Read harness.config.json — level: basic
Read AGENTS.md — exists, has project-specific content
Run: harness validate — passes at basic level
Recommend: intermediate (add layers and dependency constraints)
Human confirms: "Yes, we're ready for layers."

SCAFFOLD:

harness init --level intermediate --migrate
# Preserves existing harness.config.json and AGENTS.md
# Adds: layer definitions template, dependency constraints template

CONFIGURE:

Define layers in harness.config.json:
  - presentation: src/routes/, src/middleware/
  - business: src/services/, src/models/
  - data: src/repositories/, src/db/

Define constraints:
  - presentation → business (allowed)
  - business → data (allowed)
  - data → presentation (forbidden)
  - presentation → data (forbidden — must go through business)

Update AGENTS.md with layer documentation.

VALIDATE:

harness validate      # Pass — intermediate level checks satisfied
harness check-deps    # Pass — no constraint violations in existing code
git add -A
git commit -m "feat: migrate harness project to intermediate level with layers"

Example: Plugin-only Bootstrap (Existing Project, No Prior Harness Setup)

The user installed harness-claude from the marketplace. They have an existing TypeScript repo with no .harness/ directory. Goal: get them to a working harness install without asking them to npm install -g.

GROUND (Phase 0 — asked first, before ASSESS/SCAFFOLD):

Phase 0 (strategy): "Capture strategic anchor (STRATEGY.md) now?"
  Human: "Not sure."
  Result: no STRATEGY.md written, no init.strategy.declined flag; /harness:strategy stays available later.

ASSESS:

Check for .harness/ — not found.
Check `command -v harness` — not on PATH. Plugin-only install confirmed.
All CLI invocations below will be prefixed with `npx @harness-engineering/cli`.

Detect framework: package.json has "express" — auto-detection will pick this up.
Suggested tier: load-bearing-minimum (the standard starting point). Human opts down: "Basic is fine for this first pass."

SCAFFOLD:

npx @harness-engineering/cli init --level basic  # explicit opt-down; auto-detects framework
# Creates: harness.config.json, .harness/, AGENTS.md (template)

CONFIGURE:

Phase 3 step 0 (persist grounding): user was "Not sure" in Phase 0 → nothing to persist.
Customize AGENTS.md with project-specific content.
Phase 3 step 5 (i18n): "No, English only." → i18n.enabled = false.
Phase 3 step 5b (design): "No, this is a backend service." → design.enabled = false.
Phase 3 step 6 (test-suite dispatch): not a test suite, skipped.

VALIDATE:

npx @harness-engineering/cli validate    # Pass
npx @harness-engineering/cli check-deps  # Pass (basic level, no constraints yet)

INSTRUMENT (Phase 5 — the work that harness setup would have done):

# 1. Knowledge graph
npx @harness-engineering/cli scan
# 2. Architecture baseline
npx @harness-engineering/cli check-arch --update-baseline
# 3. Performance baseline (basic level: structural only)
npx @harness-engineering/cli check-perf --structural
# 4. Telemetry identity — ask the human
#    Human: "Yes, project=acme-api, team=platform"
npx @harness-engineering/cli telemetry identify --project acme-api --team platform
# 5. Legacy layouts — dry-run reports nothing for a fresh repo
npx @harness-engineering/cli migrate --dry-run
# 6. Tier-0 MCP integrations
npx @harness-engineering/cli integrations list
npx @harness-engineering/cli integrations add context7
npx @harness-engineering/cli integrations add sequential-thinking
npx @harness-engineering/cli integrations add playwright

FINALIZE:

Phase 6 step 1 (roadmap): "Yes, create docs/roadmap.md."
Invoke harness-roadmap or run `npx @harness-engineering/cli` equivalent — docs/roadmap.md created.

Phase 6 step 2 (commit):
git add harness.config.json AGENTS.md .harness/ .mcp.json docs/roadmap.md
git commit -m "feat: bootstrap harness on existing project (plugin install)"

Final state: plugin user now has the same starting state as if they'd run npm install -g @harness-engineering/cli && harness setup. Subsequent slash commands, subagents, hooks, and MCP tools all have the project state they need.

Example: Adoption Level Progression

Basic (start here):

Intermediate (add structure):

Advanced (full integration):

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.