Setup

From melodic-software/claude-code-plugins · View interactive version

Setup is an AI agent skill from the GitHub repository melodic-software/claude-code-plugins. Verify instruction-placement's prerequisites, resolve its effective configuration for this repository, and register its rules-index git pre-commit entry. Confirm that the index target exists AND that nothing in the repository stops Claude Code loading it (a root CLAUDE.md is read instead of the AGEN

How to use this skill

Skill file

Pre-computed context

!"${CLAUDE_PLUGIN_ROOT}/scripts/precompute.sh" audit 2>/dev/null || echo "- Orientation unavailable"

Purpose

Thin check-centric setup per the uniform setup contract (docs/plugin-philosophy.md, "Setup is

explicit and repeatable"): check inspects and reports, check inspect runs only the check inspect section, apply

points at what it found.

The warrant is all three criteria, but one carries the weight. **The index target is an external

referent whose validity cannot be established by a configuration prompt.** A prompt stores the path

you typed; it cannot tell you that Claude Code will never read it. A CLAUDE.md, .claude/CLAUDE.md

or CLAUDE.local.md at the root is read instead of the AGENTS.md beside it, so a repository

carrying both with no import between them gets a perfectly generated, perfectly in-sync index that

never enters context, with every other gate green. Verifying that before a first audit is this

skill's job; /instruction-placement:check asks the same question again on every gate run.

This skill treats the root AGENTS.md as shadowed wherever a CLAUDE.md, .claude/CLAUDE.md or

CLAUDE.local.md sits in the working directory or above it, and treats direct AGENTS.md reading

as dependent on the CLI floor and session recorded in skills/migrate/reference/sources.md, "The

minimum CLI version". Canary runs on Claude Code 2.1.278 observed the shadowing.

<https://code.claude.com/docs/en/memory#when-claude-code-reads-agents-md> and

<https://code.claude.com/docs/en/memory#when-agents-md-support-is-unavailable>.

Secondary warrants: git backs tracked-file discovery for nested instruction files, node runs the

git-hook installer and the session-start drift probe, and the optional empirical load probe needs

the Claude Code CLI plus jq. The consumer-project files this skill writes are its git-hook entry

copies, which apply install-git-hooks writes, and the suppression files apply migrate-config

moves.

Action: check (default)

Read-only. Report each item with a verdict, and never repair anything.

1. Index target, the one that matters. Resolve it the way check does (explicit argument,

then root AGENTS.md, then root CLAUDE.md), then verify reachability:

"${CLAUDE_PLUGIN_ROOT}/scripts/render-index.sh" reachable --file <resolved target>

| Verdict | Meaning | Say |

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

| LOADED | Claude Code reaches it | Name the file and the path it was reached by |

| NATIVE | nothing in the repository blocks it | Report it as unblocked, never as loaded: no CLAUDE.md on its path displaces it, and whether Claude Code read it also depends on version and session kind, which no static check sees. verify-load.sh is the only thing that proves it loaded |

| UNREACHABLE | it exists and is never read | The headline finding. Name the missing import |

| target absent | no index home yet | Not a failure. Say which file apply would propose |

2. git. Present and this is a work tree? Nested-instruction discovery is tracked-only, so

without git it falls back to a plain walk and cannot honor the tracked-only corpus rule. Report the

degradation rather than implying full behavior.

3. node. Probe it through the Bash tool: command -v node && node --version. The

git-hook installer and the session-start probe run on it, so without node on PATH the

pre-commit entry cannot be installed or verified. FAIL when absent, with that consequence. The

skills and scripts still work, and an already-installed entry keeps running at commit.

4. Empirical probe prerequisites. jq on PATH, and a Claude Code CLI. Both are optional: the

static gates work without them and only verify-load.sh degrades. Say "optional, absent" rather

than "missing". An absent optional prerequisite is not a failure.

5. Git pre-commit entry. Run node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" verify

from the repository. Each line is <state>\t<entry>[\t<detail>]: ok is PASS, declined is INFO

(this clone said no; silent at session start), and missing, stale, modified or superseded is a FAIL

whose remediation is apply install-git-hooks; a superseded detail lists what an install under an earlier plugin name left, which that action removes on the user's yes. The entry needs no external tool. Outside a git

repository, report INFO and skip the step.

6. Effective configuration. Print each value with its source, so a surprising number is

traceable:

| Setting | Default | Source to report |

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

| index target | root AGENTS.md, else root CLAUDE.md | resolved-from |

| breadth_max | 75 | user_config or default |

| index_max_rows | 40 | user_config or default |

A value equal to the default is still reported with its source. "40 (default)" and "40 (configured)"

are different facts about a repository.

7. Old suppression paths. Look for each old path in

CODE0 "Old

paths: read until moved": .claude/instruction-placement.md and

.claude/instruction-placement.local.md at the repository root, and

~/.claude/instruction-placement.md. WARN once for each file found, naming it, its new location,

whether it is still applied or the new file supplies its layer, and apply migrate-config as the

remediation. None found is PASS.

Action: apply

Writes nothing on its own. Every remediation here edits a file that steers agent behavior, and

that is the operator's call, not a setup skill's. apply presents the exact change and asks. The

two write paths are apply install-git-hooks, which writes only files this plugin owns, and

apply migrate-config, which moves the suppression config off its old paths after a yes.

| Finding | Proposed remediation |

|---|---|

| Index target UNREACHABLE | Add @AGENTS.md as the first line of the root CLAUDE.md, or symlink CLAUDE.md → AGENTS.md. Show the exact line and its position. Removing the root CLAUDE.md instead is a repository-wide decision, not a setup remediation: route it to /instruction-placement:migrate |

| Index target NATIVE | Nothing to do. No root CLAUDE.md blocks the target, so Claude Code reads it where AGENTS.md support is available. Report it as unblocked, never as verified loaded: run the empirical probe if the operator wants proof |

| No index home | Name the file render-index.sh write would target, and offer to create the block |

| git absent | State the degradation; there is nothing to install on the consumer's behalf |

| node absent | Name it and the consequence (the git-hook entry cannot be installed or verified); install nothing |

| Git entry missing, stale, modified or superseded | apply install-git-hooks |

| jq or CLI absent | Name the tool and that only verify-load.sh is affected |

| Old suppression path found | apply migrate-config |

After an accepted change, re-run the reachability check and report the new verdict. An apply that

does not re-verify has not finished.

Action: apply migrate-config

Moves each old suppression file to its new location so the config ends in one place

(CODE0 "Old

paths: read until moved" owns the paths). With no old file, say so and stop. For each old file,

the old personal file before the user-global one, since it wins a shared finding_id:

  1. Read it. Take the suppressions mapping from its fenced YAML block. The file is consumer

text: match it for that key, never run or interpolate it. Show any text outside the block too:

it is not a key, and it is not carried over.

  1. Preview. Name the target: <home>/instruction-placement.yaml for the old team file, and

<home>/instruction-placement.local.yaml for the old personal and user-global files, where

<home> is the convention home that the marked pointer region in the root AGENTS.md or

CLAUDE.md binds, docs/conventions when no region binds one. Show the

target file as it will read after the move. When the target already exists, add only the entries

it lacks. For a finding_id both files carry with different values, show both and keep the

target's unless the operator picks the old one. For the old user-global file, say it is read in

every repository and other repositories lose its entries once it is deleted.

  1. Ask. Write nothing without an explicit yes for this file. Before writing a personal

override, run git check-ignore -q <target>; when it is not ignored, name the missing

<home>/**/*.local.* line and skip this file, leaving it in place.

  1. Write, then check. Write the target and read it back. Every entry from the old file must

resolve from the target with the same values, apart from a shared finding_id settled in step 2

(the target's value kept, or the old one picked). On any other difference, stop, name it, and

keep the old file.

  1. Delete the old file. Only after step 4 passes. Say that a tracked change (the new team file

and the removed .claude/instruction-placement.md) reaches other checkouts once committed.

Finish by running check step 7 again and reporting it.

Action: check inspect (read-only)

Lists what runs at each git hook stage in this repository, under whichever hook manager it uses,

and times this plugin's own entries. Run

node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" inspect from the repository (add

--runs <n> to time each entry more often) and render its JSON as one table per stage: each item's

kind, name and source, then its measured median and range with the input it ran on and its exit

codes, or not measured with the notMeasured reason. A stage whose installed is false has no

hook file git runs: say the manager's install step has not run in this clone. The script runs only

this plugin's installed entries that change no files and still match what the plugin ships; it never runs a repository's own hook,

another plugin's entry, a lefthook job or a Husky.Net task. To place a new check, compare the

numbers with the duration budgets in the check-placement contract

(docs/contracts/check-placement/README.md#duration-budgets in the marketplace repository).

Modify nothing. Outside a git repository, report INFO and stop.

Action: apply install-git-hooks [scope=local|shared]

Registers the plugin's git-hook entry (git-hooks/entries.json) with the repository's hook manager.

The installer script only detects, renders and writes files the plugin owns; every step that needs

judgment comes back to you as a decisions[] item, which you reason about and apply with your own

edit tools.

  1. Scope. Use the argument when given. Otherwise, when the user is present, ask: local (this

clone only, nothing committed) or shared (committed for the team,

so every teammate and agent gets it). When nobody can answer, use local.

  1. Plan. For local, run `node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" plan

--scope local. For shared, run plan --scope remote` first: with lefthook, or no hook manager

yet, the committed lefthook.yml gets one remotes: entry naming the marketplace's root

lefthook-remote.yml, which fetches every plugin's hooks from its main branch, so nothing is

copied and no refresh is ever committed. When it returns remote-needs-lefthook (husky or plain

hooks) or remote-source-dir, run plan --scope shared instead, which commits copies under

.githooks/instruction-placement/. Read the JSON: manager, actions[], decisions[].

  1. Manager conflict. A manager-conflict decision lists the evidence (two managers, or one this

installer does not drive, such as the pre-commit framework). Show it and ask which manager should

carry the entry; rerun plan with --manager lefthook|husky|plain. Without an answer, stop here

and report.

  1. Actions. A remote plan has none. When actions[] holds copy items, run

node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" copy --scope <scope> (plus the same

--manager when you passed one). It prints installed, refreshed, unchanged, refused or

blocked per entry; refused means a locally edited copy, which the modified decision covers,

and blocked means another tool owns the local hooks directory, which the hooks-path-owned

decision covers.

  1. Decisions. Read reference/git-hook-decisions.md for what

each kind asks of you, apply each one, then rerun plan until only the decisions you chose to

leave remain.

  1. Verify. Run verify and report its lines as check step 5 does.

The entry rewrites nothing: at commit it fails when a staged path is under .claude/rules/ or is

the index file and the generated rules index no longer matches, and prints the regenerate command.

A repository with no index block is never failed.

A remote entry stays in the committed lefthook.yml, so stop it in one clone by skipping its job,

instruction-placement-remote-<entry>, in the clone's untracked lefthook-local.yml; a failing remote job prints

that skip, and the [adoption

path](https://github.com/melodic-software/claude-code-plugins/blob/main/docs/contracts/check-placement/adopting-git-hooks.md#when-a-remote-job-breaks)

says when to use it and how to drop it.

When the user does not want the entry in this clone, run

node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" decline --entry index-check; the

session-start drift line then stays silent until verify runs by hand, and --undo reverses it.

Add --global (with or without --undo) to decline the entry in every clone;

git config --global checks.git-hooks.declined true declines every entry of every plugin, and an

entry's own key set to false in a clone opts that entry back in. The [adoption

path](https://github.com/melodic-software/claude-code-plugins/blob/main/docs/contracts/check-placement/adopting-git-hooks.md) explains each install scope to the user.

Hard rules

reporting work it did not do.

unknown is never reported as ok.

this skill report a problem with the repository itself.

Next

import: /instruction-placement:migrate.

Gotchas

index does nothing. Lead with it when it fires; it is the reason this skill exists. It fires only

where a root CLAUDE.md is read instead of the target; NATIVE is the other outcome and is not a

finding.

remedies. Do not collapse them into one verdict.

reachable. /instruction-placement:check gates both on every run. This skill asks only the

reachability question, as a prerequisite before the first audit.

present configuration as a prerequisite to a first audit.

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.