Agent skill

Project Setup

by sd0xdev in sd0xdev/sd0x-harness

Project configuration initialization. An agent skill from sd0xdev/sd0x-harness.

MITAuto-check: notesAgent Workflows

Install Project Setup

skills CLI
$ npx skills add sd0xdev/sd0x-harness --skill project-setup -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sd0xdev/sd0x-harness project-setup --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sd0xdev/sd0x-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/project-setup .claude/skills/project-setup && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
project-setup
GitHub stars
192
Token cost
~7.1k tokens
SKILL.md length
2,163 words
Files
2 (incl. references)
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Project configuration initialization. An agent skill from sd0xdev/sd0x-harness.

  • Works in 10 steps: Detect Project Environment → Confirm Detection Results → 5: Select Ecosystem Blocks → …
  • : first-time setup
  • SKILL.md covers Trigger, When NOT to Use, Workflow and Phase 1: Detect Project…, plus 8 more sections
  • Calls claude and git

What it does

Project Setup is an agent skill from sd0xdev/sd0x-harness. Project configuration initialization. Use when: first-time setup, auto-detecting framework, replacing CLAUDE.md placeholders. Not for: ongoing config checks (use claude-health), skill creation (use skill-creator). Output: configured CLAUDE.md + project settings + rules + hooks.

Its SKILL.md is about 7.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/detection-rules.md`).

It sits in Agent Workflows, covering Agent instruction files and Skill authoring. It works with npm and Node.js. The repository describes itself as: The harness layer for Claude Code — a reference implementation of harness engineering with hook-enforced dual review, state-machine gates that survive context compaction, and… The licence is MIT.

When your agent uses it

  • : first-time setup
  • Auto-detecting framework
  • Replacing CLAUDE.md placeholders

Example prompts

  • “/project-setup”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Read, Grep, Glob, Edit, Write, Bash(node:*), Bash(git:*), Bash(ls:*), Bash(mkdir:*), Bash(diff:*), Bash(chmod:*), Bash(jq:*), Bash(bash:*)

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Detect Project Environment
  2. Confirm Detection Results
  3. 5: Select Ecosystem Blocks
  4. Write to .claude/CLAUDE.md
  5. Verify CLAUDE.md
  6. Install Rules + Backfill CLAUDE.md
  7. Install Hooks
  8. 5: Install Scripts
  9. 7: Configure Environment Variables
  10. Final Verification Report

What it can do on your machine

Read from SKILL.md and the folder at commit a4d4bc1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob
    • Edit
    • Write
    • Bash(node:*)
    • Bash(git:*)
    • Bash(ls:*)
    • Bash(mkdir:*)
    • Bash(diff:*)

    …and 3 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • claude
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Project Setup loads about 7.1k tokens when it runs, and up to ~9k if it reads all its reference files. Until then it costs about 73 tokens; SKILL.md has 2,163 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~7.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:287
    dit\|Write\|NotebookEdit | Block editing .env/.git |

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sd0xdev/sd0x-harness at commit a4d4bc1, republished under its MIT licence (© sd0xdev). 2,163 words, ~7,062 tokens.

Download SKILL.mdSave it as .claude/skills/project-setup/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
project-setup
description
Project configuration initialization. Use when: first-time setup, auto-detecting framework, replacing CLAUDE.md placeholders. Not for: ongoing config checks (use claude-health), skill creation (use skill-creator). Output: configured CLAUDE.md + project settings + rules + hooks.
allowed-tools
Read, Grep, Glob, Edit, Write, Bash(node:*), Bash(git:*), Bash(ls:*), Bash(mkdir:*), Bash(diff:*), Bash(chmod:*), Bash(jq:*), Bash(bash:*)

Project Setup

Trigger

  • Keywords: project setup, init, initialize, configure project, setup CLAUDE.md, customize placeholders

When NOT to Use

  • CLAUDE.md placeholders are already fully replaced (no {...} remaining)
  • Non Node.js/TypeScript project without a recognized manifest file -- run with --detect-only to see what can be auto-detected. Manual configuration may be needed for: {FRAMEWORK}, {CONFIG_FILE}, {BOOTSTRAP_FILE}. Script commands ({TEST_COMMAND}, etc.) can often be detected from manifest files
  • Only want to modify a single placeholder -- just Edit CLAUDE.md directly

Workflow

Phase 1: Detect project environment
    │
    ├─ Read package.json (dependencies, devDependencies, scripts)
    ├─ Detect lockfile (pnpm-lock.yaml / yarn.lock / package-lock.json)
    ├─ Detect entrypoints (glob src/)
    └─ Compile results
    │
Phase 2: Confirm detection results
    │
    ├─ Present detection results table
    └─ Wait for user confirmation or corrections
    │
Phase 3: Write to .claude/CLAUDE.md (unless --detect-only)
    │
    ├─ Read CLAUDE.template.md, filter ecosystem blocks
    └─ Replace placeholders, write to .claude/CLAUDE.md
    │
Phase 4: Verify CLAUDE.md
    │
    ├─ Read .claude/CLAUDE.md to confirm no remaining placeholders
    └─ Output placeholder summary
    │
Phase 5: Install Rules + Backfill CLAUDE.md (unless --no-rules or --lite)
    │
    ├─ Locate plugin rules dir (3-level fallback)
    ├─ mkdir -p .claude/rules/ → copy 13 managed rules + 3 override templates
    ├─ Backfill: ensure .claude/CLAUDE.md has @rules/ references
    └─ Output rules install report
    │
Phase 6: Install Hooks (unless --no-hooks or --lite)
    │
    ├─ Locate plugin hooks dir (3-level fallback)
    ├─ mkdir -p .claude/hooks/ → copy 7 hooks + chmod +x
    ├─ Merge hook definitions into .claude/settings.json
    └─ Output hooks install report
    │
Phase 6.5: Install Scripts (unless --lite or --detect-only)
    │
    ├─ Locate plugin scripts dir (3-level fallback)
    ├─ mkdir -p .claude/scripts/lib → copy 6 scripts
    ├─ Update manifest .sd0x/install-state.json
    └─ Output scripts install report
    │
Phase 6.7: Configure Environment Variables (unless --detect-only or --lite)
    │
    ├─ Detect model context size (1M → recommend auto-compact window)
    ├─ Build env var catalog (model-aware vars; flag retired STOP_GUARD_MODE for removal)
    ├─ Present recommendations, wait for user confirmation
    ├─ Merge into .claude/settings.json env object
    └─ Output env config report
    │
Phase 7: Final Verification Report
    │
    ├─ Summarize all phases
    ├─ Closed-loop check (CLAUDE.md + rules + hooks + env)
    └─ Output next steps
Flag Short-Circuit Semantics
FlagPhase 1-2Phase 3-4Phase 5-6.5Phase 6.7Phase 7
(none)ExecuteExecuteExecuteExecuteFull report
--detect-onlyExecuteSkipSkipSkipDetection results only
--liteExecuteExecuteSkipSkipCLAUDE.md only
--no-rulesExecuteExecuteSkip rulesExecuteReport
--no-hooksExecuteExecuteSkip hooksExecuteReport
--env-onlySkipSkipSkipExecuteEnv report only (skill-level directive)

Phase 1: Detect Project Environment

Execute the following detections in order; see references/detection-rules.md for detailed rules:

Detection Steps
  1. Detect Ecosystem — Glob for manifest files (package.json, pyproject.toml, Cargo.toml, go.mod, build.gradle, pom.xml, Gemfile). Priority order in references/detection-rules.md.
  2. Read manifest — Extract project name, dependencies, scripts (Node.js: package.json; others: ecosystem manifest)
  3. Detect Package Manager — Lockfile detection (Node.js only): pnpm-lock.yaml → pnpm, yarn.lock → yarn, else npm (priority order per references/detection-rules.md)
  4. Detect Framework — From dependencies. See references/detection-rules.md#framework
  5. Detect Database — From dependencies. See references/detection-rules.md#database
  6. Detect Entrypoints — Glob framework-specific candidates. See references/detection-rules.md#entrypoints
  7. Detect Scripts — From manifest scripts field. See references/detection-rules.md#scripts. Missing scripts → # N/A (no script found)

For non-Node.js ecosystems, skip Node-specific steps and use ecosystem-specific detection from references/detection-rules.md.

Phase 2: Confirm Detection Results

Present a table of all 9 auto-detected placeholders with | Placeholder | Detected Value | Source | columns. Additional manual placeholders ({TICKET_PATTERN}, {ISSUE_TRACKER_URL}, {TARGET_BRANCH}) may remain if not auto-detectable — these are acceptable and should be noted as "manual" in Phase 4 verification. Wait for user confirmation before proceeding to Phase 3.

Phase 2.5: Select Ecosystem Blocks

Based on detected manifest (from Phase 1.0):

ManifestEcosystem tag
package.jsonnode-ts
pyproject.tomlpython
go.modgo
Cargo.tomlrust
Gemfileruby
pom.xml / build.gradlejava

Phase 3: Write to .claude/CLAUDE.md

Prerequisite: User has confirmed, and not in --detect-only mode.

  1. Read CLAUDE.template.md (if not found, fallback to CLAUDE.md)
  2. Remove <!-- block:X -->...<!-- /block --> sections NOT matching detected ecosystem
  3. Remove remaining block markers (<!-- block:... -->, <!-- /block -->)
  4. Execute Edit for each placeholder (using replace_all: true)
  5. Write to .claude/CLAUDE.md (create directory if needed)

If .claude/CLAUDE.md does not exist, create it from the rendered template.

Phase 4: Verify CLAUDE.md

  1. Read .claude/CLAUDE.md
  2. Grep: \{[A-Z_]+\} — confirm no remaining auto-detected placeholders. Exclude ${...} shell variable matches (e.g., ${CLAUDE_PLUGIN_ROOT}) from the count — these are intentional env var references, not unfilled placeholders.
  3. Output summary table with all placeholder values and remaining count

If --detect-only or --lite, skip to Phase 7.

Phase 5: Install Rules + Backfill CLAUDE.md

Skip if: --no-rules or --lite or --detect-only.

5.1 Locate Plugin Rules Directory

Find the plugin's rules/ directory using this priority (short-circuit on first match):

  1. Glob search — search known Claude plugin locations:

    Glob: ~/.claude/plugins/**/sd0x-dev-flow/rules/auto-loop.md
    Glob: ${REPO_ROOT}/node_modules/sd0x-dev-flow/rules/auto-loop.md
  2. Plugin-relative fallback — try reading @rules/auto-loop.md to confirm accessibility. If readable, derive the rules directory.

  3. Not found → hard error for this phase (do not silently skip). Output explicit failure with remediation steps:

    ⛔ Rule source not found. Auto-loop rules cannot be installed.
    
    Remediation (choose one):
    1. Install the plugin — run these two slash commands one after the other (they are
       Claude Code commands, not shell commands, so `&&` chaining does not apply):
       /plugin marketplace add sd0xdev/sd0x-harness
       /plugin install sd0x-dev-flow@sd0xdev-marketplace
    2. Copy rules manually from a machine that has the plugin installed
    3. Re-run with --no-rules to skip (rules layer will be missing)

    Then skip Phase 5 and continue to Phase 6. Phase 7 will report this as ⚠️ Partial.

5.2 Copy Rules
  1. mkdir -p ${REPO_ROOT}/.claude/rules/

  2. Copy all 13 managed rules:

    RulePurpose
    auto-loop.mdAuto review loop (behaviour-layer contract; hooks remind, nothing blocks)
    codex-invocation.mdCodex independent research requirement
    discretion.mdInstruction tiers: Anchor / Default / Guidance
    scope-discipline.mdScope axis orthogonal to severity; out-of-scope deferral
    testing.mdTest structure and requirements
    security.mdOWASP security checklist
    git-workflow.mdGit branch and commit conventions
    logging.mdStructured logging standards
    docs-writing.mdDocumentation writing conventions
    docs-numbering.mdDocument numbering scheme
    self-improvement.mdSelf-improvement loop
    context-management.mdData-driven context monitoring
    override-contract.mdResolution order and heading tables for the user-owned override files (path-scoped to .claude/rules/*-project.md)
  3. Create override template (unmanaged, not manifest-tracked):

    • auto-loop-project.md · testing-project.md · git-workflow-project.md — user-owned override templates, copied when absent and stamped Based on: <base> @ <installed base hash> exactly as /install-rules Phase 4.5 does (never a byte copy of the shipped stamp)
  4. Conflict strategy:

    ScenarioAction
    File does not existInstall
    File exists, content identicalSkip
    File exists, content differsSkip + warn as conflict
  5. After copying, collect hashes and write manifest:

    • Compute git hash-object --no-filters for each managed rule (installed + already-identical skipped)
    • Read .sd0x/install-state.json (create {} if not exists)
    • Update schema_version: 1, installed_at, plugin_version (source priority: .claude-plugin/plugin.json → package.json → "unknown"), rules key — hash for each file in managed state (both newly installed and already-identical). Structure: rules[filename] = { "hash": "<sha1>" }
    • Preserve ALL other top-level keys from existing manifest (e.g. hook_scripts, scripts, sd0x_version, agents_md_hash, hooks_installed — do NOT drop unknown keys)
    • Write updated manifest via Write tool

Note: /project-setup uses fresh-install semantics (install new / skip identical / warn on conflict; no smart merge). For smart merge (section merge, legacy migration, --legacy-strategy), run /install-rules directly. After rule installation, /install-rules automatically creates each override template (auto-loop-project.md, testing-project.md, git-workflow-project.md — user-owned) if it doesn't exist. See skills/install-rules/SKILL.md.

5.3 Backfill CLAUDE.md (Closed-Loop Guarantee)

Ensure .claude/CLAUDE.md contains @rules/ references so the auto-loop engine can activate:

  1. Grep .claude/CLAUDE.md for @rules/auto-loop.md
  2. Found → for each override template, check whether its line is also present, in the form the template uses — @rules/auto-loop-project.md after auto-loop.md, @rules/git-workflow-project.md after git-workflow.md, and the plain `rules/testing-project.md` reference after `rules/testing.md` (path-scoped: a legacy @rules/testing.md or @rules/testing-project.md line counts as present but is rewritten to the template's plain reference, since an @ import loads it at launch):
    • Present → skip that template (configured)
    • Base line present, override line missing → insert the override's line from CLAUDE.template.md ## Rules directly after its base line (e.g. - @rules/git-workflow-project.md -- Project-specific git overrides (user-owned)). A path-scoped template (testing-project.md) and its base are inserted as the template's plain rules/<file> references, never as @ imports — an import would load them at launch
    • Base line missing too → insert both lines from CLAUDE.template.md ## Rules — the base line, then the override line — at the end of the file's ## Rules list. An installed override whose base is unreferenced is not configured; never report it as present
  3. Not found but file exists → append ## Rules block at end of file (16 rule references — 11 @rules/ imports and 5 path-scoped plain references (13 managed + 3 override templates) from CLAUDE.template.md ## Rules section)
  4. File does not exist (edge case: Phase 3 was skipped) → extract from CLAUDE.template.md: ## Required Checks through the ### Auto-Loop section (up to the next ## heading) + ## Rules section → create minimal .claude/CLAUDE.md

When extracting from template, remove ecosystem block markers and leave unresolved placeholders as {PLACEHOLDER}.

5.4 Output Rules Report
markdown
## Rules Install Report

**Source**: <plugin-rules-path>
**Target**: <repo-root>/.claude/rules/

| Rule | Status |
|------|--------|
| auto-loop.md | ✅ Installed |
| ... | ... |

**Installed**: N / **Skipped**: M / **Conflicts**: K
**Manifest**: .sd0x/install-state.json
**CLAUDE.md backfill**: ✅ @rules/ references present

Phase 6: Install Hooks

Skip if: --no-hooks or --lite or --detect-only.

6.1 Locate Plugin Hooks Directory

Same 3-level fallback as Phase 5.1, but search for hooks/pre-edit-guard.sh:

  1. Glob: ~/.claude/plugins/**/sd0x-dev-flow/hooks/pre-edit-guard.sh

  2. Glob: ${REPO_ROOT}/node_modules/sd0x-dev-flow/hooks/pre-edit-guard.sh

  3. Plugin-relative fallback: @hooks/pre-edit-guard.sh

  4. Not found → hard error for this phase (do not silently skip). Output explicit failure with remediation steps:

    ⛔ Hook source not found. The reminder-layer hooks cannot be installed.
    
    Remediation (choose one):
    1. Install the plugin — run these two slash commands one after the other (they are
       Claude Code commands, not shell commands, so `&&` chaining does not apply):
       /plugin marketplace add sd0xdev/sd0x-harness
       /plugin install sd0x-dev-flow@sd0xdev-marketplace
    2. Copy hooks manually from a machine that has the plugin installed
    3. Re-run with --no-hooks to skip (reminder hooks will be missing)

    Then skip Phase 6 and continue to Phase 7. Phase 7 will report this as ⚠️ Partial.

6.2 Copy Hook Scripts
  1. mkdir -p ${REPO_ROOT}/.claude/hooks/

  2. Copy 7 hooks (exclude namespace-hint.sh — plugin-only):

    HookEventMatcherPurpose
    pre-edit-guard.shPreToolUseEdit|Write|NotebookEditBlock editing .env/.git
    pre-bash-codex-launch-guard.shPreToolUseBashBlock a Codex dispatch launched with its progress redirected away from the task panel
    post-edit-format.shPostToolUseEdit|Write|NotebookEditAuto-format reminder
    post-skill-auto-loop.shPostToolUseSkillPost-review reminder (next gate)
    stop-guard.shStop—Reminder: open gates at stop (markdown, exit 0)
    user-prompt-review-guard.shUserPromptSubmit—Per-prompt [AUTO_LOOP_STATE] fact line
    post-compact-auto-loop.shSessionStartcompactRe-inject auto-loop reminders after compaction
  3. chmod +x each installed script.

  4. Conflict strategy: same as Phase 5.2.

6.3 Merge Hook Definitions into Settings

Target: ${REPO_ROOT}/.claude/settings.json

Hook definition mapping (uses $CLAUDE_PROJECT_DIR for portability):

json
{
  "hooks": {
    "PreToolUse": [
      {"matcher": "Edit|Write|NotebookEdit", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-edit-guard.sh"}]},
      {"matcher": "Bash", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-bash-codex-launch-guard.sh"}]}
    ],
    "PostToolUse": [
      {"matcher": "Edit|Write|NotebookEdit", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post-edit-format.sh"}]},
      {"matcher": "Skill", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post-skill-auto-loop.sh"}]}
    ],
    "Stop": [
      {"matcher": "", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-guard.sh"}]}
    ],
    "UserPromptSubmit": [
      {"matcher": "", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/user-prompt-review-guard.sh"}]}
    ],
    "SessionStart": [
      {"matcher": "compact", "hooks": [{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/post-compact-auto-loop.sh"}]}
    ]
  }
}

Note: Environment variables are configured in Phase 6.7 (independent of hook installation). Phase 6.3 only handles hook definition merging.

Merge strategy:

  • Read existing settings file (create {} if not exists)
  • Legacy migration: scan for bare .claude/hooks/<name>.sh paths → upgrade to "$CLAUDE_PROJECT_DIR"/.claude/hooks/<name>.sh
  • For each event: append-only merge (skip if same command path exists)
  • Coexistence detection: if hooks/hooks.json exists at repo root (= plugin source repo), warn that plugin hooks and installed hooks may coexist. Runtime arbitration handles dedup automatically
  • Write updated settings back (hook definitions only — env vars deferred to Phase 6.7)
Show full SKILL.md (910 more words)Show less
6.4 Output Hooks Report
markdown
## Hooks Install Report

**Source**: <plugin-hooks-path>
**Scripts**: <repo-root>/.claude/hooks/
**Settings**: <repo-root>/.claude/settings.json

| Hook | Script | Settings | Status |
|------|--------|----------|--------|
| pre-edit-guard.sh | ✅ Copied | ✅ Added | Installed |
| ... | ... | ... | ... |

**Installed**: N / **Skipped**: M / **Conflicts**: K

Phase 6.5: Install Scripts

Skip if: --lite or --detect-only.

6.5.1 Locate Plugin Scripts Directory

Same 3-level fallback as Phase 5.1, but search for scripts/precommit-runner.js:

  1. Glob: ~/.claude/plugins/**/sd0x-dev-flow/scripts/precommit-runner.js
  2. Glob: ${REPO_ROOT}/node_modules/sd0x-dev-flow/scripts/precommit-runner.js
  3. Plugin-relative fallback: @scripts/precommit-runner.js

Not found → warn + skip Phase 6.5. Phase 7 will report ⚠️ Partial.

6.5.2 Copy Scripts
  1. mkdir -p ${REPO_ROOT}/.claude/scripts/lib
  2. Copy 6 scripts:
ScriptPurposeDependencies
precommit-runner.jsPrecommit runner for /precommit, /precommit-fast; notes its own pass/fail via review-state.jslib/utils.js, review-state.js
verify-runner.jsVerify runner for /verifylib/utils.js
review-state.jsReminder-state checker/noter (single slot per plane under ~/.cache/sd0x-dev-flow/) read by the locally installed hooks and by /remind, /next-step, /pre-pr-auditlib/tree-digest.js
lib/utils.jsShared utilitiesNone
lib/tree-digest.jsPer-plane content digests (binds a noted verdict to the tree that earned it)None
protected-branches.shProtected-branch resolver (defaults ∪ git-workflow-project.md additions) read by /push-ci, /epic-merge, /gh-stack; without it an installed override makes every branch read as protectedNone
  1. Conflict strategy: same as Phase 5.2.
ScenarioAction
File does not existInstall
File exists, content identicalSkip
File exists, content differsSkip + warn as conflict
6.5.3 Update Manifest
  1. Read .sd0x/install-state.json (create {} if not exists)
  2. Read plugin version from .claude-plugin/plugin.json or package.json
  3. Update: schema_version: 1, installed_at, plugin_version, scripts key
  4. Compute hash per file: git hash-object --no-filters .claude/scripts/<name>
  5. Preserve all existing top-level keys (e.g. rules, hook_scripts, and any unknown keys)
  6. Write back to .sd0x/install-state.json
6.5.4 Output Scripts Report
markdown
## Scripts Install Report

**Source**: <plugin-scripts-path>
**Target**: <repo-root>/.claude/scripts/

| Script | Status |
|--------|--------|
| precommit-runner.js | Installed/Skipped/Conflict |
| verify-runner.js | Installed/Skipped/Conflict |
| review-state.js | Installed/Skipped/Conflict |
| lib/utils.js | Installed/Skipped/Conflict |
| lib/tree-digest.js | Installed/Skipped/Conflict |
| protected-branches.sh | Installed/Skipped/Conflict |

**Installed**: N / **Skipped**: M / **Conflicts**: K

Phase 6.7: Configure Environment Variables

Skip if: --detect-only or --lite. Run exclusively with: --env-only (skip all other phases, jump directly to 6.7 → 7).

Purpose: Write recommended environment variables to .claude/settings.json env object, independent of hook installation. This phase runs even when --no-hooks is specified.

6.7.1 Env Var Catalog
VariableDefaultConditionDescription
CLAUDE_CODE_AUTO_COMPACT_WINDOW3200001M context model detectedAuto-compact window size (tokens) — delays compaction to preserve more context
Legacy Recommendations (auto-upgrade prompt)

When an existing setting matches a previously recommended value (not the current one), flag it as Upgrade in the interactive table so the user can explicitly confirm the change. Never rewrite silently.

VariableLegacy value(s)Current recommendedRetired on
CLAUDE_CODE_AUTO_COMPACT_WINDOW4560003200002026-04-17
STOP_GUARD_MODEstrict, warn (any value)Remove — the Stop hook is reminder-only since hook-lightweighting; the setting is dead config2026-08-13
6.7.2 Large Context Model Detection

Determine whether CLAUDE_CODE_AUTO_COMPACT_WINDOW should be recommended:

  1. Self-awareness check: Claude can inspect its own system environment description for "1M context" indicators (e.g. model description includes "1M context" or "(with 1M context)")
  2. Detected → include CLAUDE_CODE_AUTO_COMPACT_WINDOW: "320000" in recommendations with note: "1M context model detected"
  3. Not detected or uncertain → ask user: "Are you using a 1M context model? (e.g. Claude Opus 4.6 1M)" — include in recommendations only on confirmation
  4. User declines → omit CLAUDE_CODE_AUTO_COMPACT_WINDOW from recommendations
6.7.3 Interactive Flow
  1. Read existing env values from both .claude/settings.local.json and .claude/settings.json (create {} if not exists). Runtime precedence: settings.local.json > settings.json

  2. Build recommendations table showing effective current value:

    markdown
    ## Environment Variables
    
    Only one row per variable appears at a time; the examples below are **alternatives** for the same variable, selected by its current state.
    
    Example A — first-time install (variable not yet set):
    
    | Variable | Current (effective) | Source | Recommended | Action |
    |----------|---------------------|--------|-------------|--------|
    | CLAUDE_CODE_AUTO_COMPACT_WINDOW | (not set) | — | 320000 | Add (1M model) |
    
    Example B — upgrade path (variable already set to a legacy value):
    
    | Variable | Current (effective) | Source | Recommended | Action |
    |----------|---------------------|--------|-------------|--------|
    | CLAUDE_CODE_AUTO_COMPACT_WINDOW | 456000 | settings.json | 320000 | **Upgrade** (legacy value, retired 2026-04-17) |
  3. Present to user for confirmation — user may accept all, modify values, or skip specific vars. For rows marked Upgrade, display the retirement date and reason so the user can make an informed decision.

  4. Apply confirmed changes to .claude/settings.json (default) or .claude/settings.local.json (with --local)

6.7.4 Merge Strategy
  • Read existing settings file (create {} if not exists)
  • Merge env vars into env object:
    • If key does not exist → Add
    • If key exists and value matches current recommended → Skip
    • If key exists and value matches a Legacy value listed in 6.7.1 → Upgrade (surface retirement date + reason; apply only after user confirmation, never silently overwrite)
    • If key exists and value is user-custom (neither current nor legacy) → Update (only after user confirmation; default to preserving)
  • Preserve all existing env keys not in the catalog (do not drop unknown keys)
  • Preserve all non-env keys in settings (hooks, etc.)
  • Write updated settings back
6.7.5 Interaction with Phase 6.3 and /install-hooks
  • Phase 6.3 (within /project-setup) defers env writes to Phase 6.7
  • When both run in the same session, Phase 6.7 runs after Phase 6 and writes to the same target file
  • --no-hooks skips Phase 6 but Phase 6.7 still runs → env vars are always configured
6.7.6 Output Env Config Report
markdown
## Environment Config Report

**Target**: <repo-root>/.claude/settings.json (or settings.local.json with --local)

| Variable | Value | Effective Source | Status |
|----------|-------|-----------------|--------|
| CLAUDE_CODE_AUTO_COMPACT_WINDOW | 320000 | settings.json | ✅ Added (1M model) — or ✅ Upgraded (456000 → 320000, legacy retired 2026-04-17) when upgrading |

**Model**: Opus 4.6 (1M context) → auto-compact window recommended
**Precedence note**: Runtime resolves env > settings.local.json > settings.json > default

Phase 7: Final Verification Report

Summarize all phases and perform closed-loop check:

Closed-Loop Check
ConditionCheckRequired
CLAUDE.md behavior textRequired Checks section exists✅
@rules/ references@rules/auto-loop.md in .claude/CLAUDE.md✅
Rule files.claude/rules/auto-loop.md exists✅
Hook remindersstop-guard in .claude/settings.json✅
Script runners.claude/scripts/precommit-runner.js exists✅ (unless --lite or --detect-only)
Auto-compact windowenv.CLAUDE_CODE_AUTO_COMPACT_WINDOW in target settings file✅ (1M model only)
Output
markdown
## Project Setup Complete

| Phase | Status |
|-------|--------|
| Detection | ✅ Framework: X, PM: Y, DB: Z |
| CLAUDE.md | ✅ Configured (0 remaining placeholders) |
| Rules | ✅ 13/13 managed rules + 3 override templates |
| Hooks | ✅ 7/7 installed + settings merged |
| Scripts | ✅ 6/6 scripts installed |
| Env Config | ✅ AUTO_COMPACT_WINDOW=320000 (1M) |

### Closed-Loop Status
✅ Auto-loop reminder loop fully configured
(or ⚠️ Partial — missing: hooks (reminder layer inactive))
(or ⚠️ Partial — missing: rules)
(or ⚠️ Partial — missing: scripts (runner not installed))
(or ℹ️ Auto-compact window not set — standard context model detected)

### Next Steps
- Run `/repo-intake` for a full project scan
- Use `HOOK_BYPASS=1` as emergency escape hatch
- Use `/install-rules --force` to upgrade rules later

Verification

  • All 9 auto-detected placeholders detected or marked N/A
  • User confirmed detection results before writing
  • No remaining auto-detected {UPPER_CASE} placeholders in .claude/CLAUDE.md after setup (manual placeholders like {TICKET_PATTERN} are acceptable)
  • .claude/rules/ contains 16 .md files (13 managed + 3 override templates) (unless --no-rules or --lite)
  • .claude/hooks/ contains 7 .sh files with execute permission (unless --no-hooks or --lite)
  • .claude/settings.json contains hook definitions (unless --no-hooks or --lite)
  • .claude/scripts/ contains precommit-runner.js, verify-runner.js, review-state.js, lib/utils.js, lib/tree-digest.js, and protected-branches.sh (unless --lite or --detect-only)
  • .claude/CLAUDE.md contains @rules/auto-loop.md reference (unless --lite)
  • env.CLAUDE_CODE_AUTO_COMPACT_WINDOW is set in target settings file when 1M model detected (unless --detect-only or --lite)

References

See detection rules: detection-rules.md

© sd0xdev, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/project-setup of sd0xdev/sd0x-harness.

  • SKILL.md
  • references/detection-rules.md

Open the folder on GitHubat commit a4d4bc1

Compare with similar skills

Project Setup next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Project Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Project Setup this skillsd0xdev/sd0x-harness192—~7.1kAutomated safety check: NotesMIT
Harness Agent Team Designerrevfactory/harness9.1k—~4.5kAutomated safety check: PassApache-2.0
Harness Evolution Feedback Looprevfactory/harness9.1k—~855Automated safety check: PassApache-2.0
Skill Creatorccusage/ccusage19k—~1.1kAutomated safety check: PassCustom licence
Workflow Schema Tuningbreaking-brake/cc-wf-studio5.4k—~1.3kAutomated safety check: PassCustom licence
Skill Base CLIginuim/skill-base1201 repos~1.9kAutomated safety check: PassNone

Similar skills

  • Harness Agent Team Designer

    revfactory/harness

    Designs a project-specific agent harness: defines specialist agents, writes the skills they follow, picks an execution mode and model for each, and keeps the setup maintained.

    9.1k GitHub stars~4.5k tokensUpdated 10 days ago
    Agent WorkflowsAuto-check passed
  • Collects feedback on how an agent harness performed, generalizes it, and updates the harness agents, skills and orchestrator along with a change-history table.

    9.1k GitHub stars~855 tokensUpdated 10 days ago
    Agent WorkflowsAuto-check passed
  • Skill Creator

    ccusage/ccusage

    Guides repo-local skill creation and updates. An agent skill from ccusage/ccusage.

    19k GitHub stars~1.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Workflow Schema Tuning

    breaking-brake/cc-wf-studio

    Guides edits to cc-wf-studio's workflow schema so AI agents generate better workflows, treating schema text as prompt engineering rather than validation.

    5.4k GitHub stars~1.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Skill Base CLI

    ginuim/skill-base

    Uses the skb command to search, install, update, delete, publish and import skills on a Skill Base site, including curated collections and GitHub imports.

    120 GitHub starsUsed in 1 repo~1.9k tokens
    Agent WorkflowsAuto-check passed
  • ShellLM Skill Author

    laude-institute/headlong

    Scaffolds new ShellLM skills with the right frontmatter, directory layout and agent-facing writing style, so an agent can extend its own capabilities.

    1.2k GitHub stars~1.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from sd0xdev/sd0x-harness

All 89 skills in this repo
  • Adr

    sd0xdev/sd0x-harness

    Write an Architecture Decision Record (ADR) for a feature — Context / Decision / Status / Consequences / Alternatives, filed as docs/features/<feature/adr-<NNN-<title.md with a 3-digit zero-padded…

    192 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Load PR Review

    sd0xdev/sd0x-harness

    Load GitHub PR review comments into AI session — analyze, triage, plan.

    192 GitHub stars~4.4k tokensUpdated today
    Auto-check passed
  • Next Step

    sd0xdev/sd0x-harness

    Change-aware next step advisor. An agent skill from sd0xdev/sd0x-harness.

    192 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Obsidian CLI

    sd0xdev/sd0x-harness

    Obsidian vault integration via official CLI. An agent skill from sd0xdev/sd0x-harness.

    192 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Orchestrate

    sd0xdev/sd0x-harness

    Agent-driven workflow orchestration (v1 report-only). An agent skill from sd0xdev/sd0x-harness.

    192 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • PR Comment

    sd0xdev/sd0x-harness

    Post friendly review comments to a GitHub PR — prepare locally, preview, then submit as atomic review.

    192 GitHub stars~1.5k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Project Setup

What does Project Setup do?

Project configuration initialization. An agent skill from sd0xdev/sd0x-harness. Project Setup is an agent skill from sd0xdev/sd0x-harness. Project configuration initialization.

When should I use Project Setup?

Project Setup fits situations like: : first-time setup; auto-detecting framework; replacing CLAUDE.md placeholders.

How do I install Project Setup in Claude Code?

Run `npx skills add sd0xdev/sd0x-harness --skill project-setup -a claude-code`. Or copy the skill folder (skills/project-setup in sd0xdev/sd0x-harness) into .claude/skills/project-setup in your project. Claude Code loads it when a task matches its description.

How do I install Project Setup in Codex?

Run `npx skills add sd0xdev/sd0x-harness --skill project-setup -a codex`. Or copy the skill folder (skills/project-setup in sd0xdev/sd0x-harness) into .agents/skills/project-setup in your project. Codex loads it when a task matches its description.

Can I use Project Setup in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sd0xdev/sd0x-harness --skill project-setup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/project-setup, .gemini/skills/project-setup, .github/skills/project-setup and .opencode/skills/project-setup in your project.

What does Project Setup need to run?

Going by SKILL.md and its folder, Project Setup needs the command-line tools its instructions call (claude and git). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read, Grep, Glob, Edit, Write, Bash(node:*), Bash(git:*), Bash(ls:*), Bash(mkdir:*), Bash(diff:*), Bash(chmod:*), Bash(jq:*), Bash(bash:*).

Does Project Setup access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Project Setup safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Project Setup use?

Project Setup is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Project Setup use?

About 7.1k tokens (SKILL.md is roughly 28k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2k tokens, read only when the agent opens those files.

What are the alternatives to Project Setup?

Skills that share tags, products or a category with Project Setup: Harness Agent Team Designer (revfactory/harness, 9.1k stars), Harness Evolution Feedback Loop (revfactory/harness, 9.1k stars), Skill Creator (ccusage/ccusage, 19k stars) and Workflow Schema Tuning (breaking-brake/cc-wf-studio, 5.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Project Setup?

sd0xdev (a GitHub user) maintains it in sd0xdev/sd0x-harness, which has 192 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 8, 2026.

Source: sd0xdev/sd0x-harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.