/craftsman:setupfrom craftsman
Interactive setup and onboarding wizard that configures a project by analyzing conventions, generating project skills, and warming codemap caches. Use on first run, when changing stacks, or when healthcheck reports config issues.
Ships in craftsman. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The commands below call
craftsman-path, which prints an absolute path inside this installation. The plugin'sbin/is on PATH in the Claude Code Bash tool; on a host where it is not, call it by its full path (<plugin root>/bin/craftsman-path). Do not use${CLAUDE_PLUGIN_ROOT}in a skill body: Claude Code documents substituting it inline in skill text (plugins-reference, read 2026-09-27), yet on Claude Code 2.1.278 a skill that relied on it ransource "/hooks/lib/config.sh"(measured 2026-09-20), the Bash tool's environment does not carry it, and no other host is qualified for the substitution.
| Command | Description |
|---|---|
/craftsman:setup | Full interactive setup (default) |
/craftsman:setup --quick | Zero-question auto-setup with smart defaults |
/craftsman:setup --refresh | Regenerate observed artifacts (conventions skill, codemap) |
/craftsman:setup --global | Workshop profile: asked once per machine, inherited by every project |
Every mode (including --quick) ends with the observation step. The repository answers most setup questions itself; only ask the user what observation cannot determine (strictness preference, pack opt-ins).
bash "$(craftsman-path bin/craftsman-helper)" conventions analyze
--quick and --refresh), generate the project conventions skill:
bash "$(craftsman-path bin/craftsman-helper)" conventions generate "$PWD/.claude/skills" # Codex reads "$PWD/.agents/skills" instead
This writes .claude/skills/project-conventions/SKILL.md (.agents/skills/... on Codex; user-invocable: false, loaded as background knowledge, shareable via git, freely editable).bash "$(craftsman-path bin/craftsman-helper)" codemap >/dev/null
Regeneration is always explicit (--refresh), never silent: the generated file records its generation date and inputs.
--global)Asked once per machine, then never again. It records how this developer usually works, not what the current project is. The answers are written to ~/.claude/.craft-config.yml and every project inherits them through the 3-level config (global, then project, then directory).
Two questions, no more:
Which stack(s) do you usually work in? Propose what is already installed on the machine, and map the answer to packs.
Which quality tools do you like in each stack? Propose the community standards from the tooling detector catalog:
python3 "$(craftsman-path hooks/lib/tooling_detect.py)" "$PWD" --json
The detector reports both what is declared here and what it suggests per stack (linters, architecture checkers, test runners, and the security section: secret scanners, dependency audit). For the workshop profile only the suggestion catalog matters, not this repository.
Record the answers under a preferred_tools: key:
preferred_tools:
php: ["PHPStan", "Deptrac", "PHPUnit"]
javascript: ["ESLint", "Vitest"]
security: ["Gitleaks"]
Nothing is ever installed (ADR-0019). A preference is a proposal that project init will offer later. Say this out loud when you write the profile so nobody expects a composer require or an npm install to have run.
The default flow when /craftsman:setup runs inside a project. Observe first, then ask at most four short questions. Never ask what the repository has already answered.
bash "$(craftsman-path bin/craftsman-helper)" conventions signals
It prints one JSON line:
{"existing_project": true, "commit_count": 412, "has_tests": true, "has_ci": false, "legacy_signal": true}
Read it as: existing_project becomes true past 20 commits, legacy_signal is true when an existing project has no tests or no CI. These are prefills, not decisions. The user still confirms.
One AskUserQuestion call, every answer prefilled from the signals. Wording matters: these questions are read by people who have never heard of a ratchet, a baseline, or a doctrine. No jargon, no rule codes, no acronyms. Ask exactly these four and nothing else:
| Question | Prefilled from | What it decides |
|---|---|---|
| Existing project or a new one? | existing_project | how the baseline is taken, AND the strictness ceiling |
| Prototype or heading to production? | legacy_signal, has_tests | strictness, within that ceiling |
| Solo or team? | has_ci | whether a CI template and a doctrine export are proposed |
| Maximum help or maximum autonomy? | nothing, ask plainly | guided: true or guided: false |
Offer plain answers, never internal vocabulary:
Mapping, applied silently:
| Answer | Effect |
|---|---|
| Already exists | photograph the current state as the baseline, and cap strictness at moderate |
| Starting right now | baseline starts empty, zero tolerance from the first file |
| Prototype | strictness: moderate |
| Going to production, on a NEW project | strictness: strict |
| Going to production, on an EXISTING one | strictness: moderate |
| Alone | no CI proposal |
| Several | propose craftsman-ci init (pipeline template) and craftsman-ci export (shareable doctrine) |
| Explain every blocked change | guided: true |
| Just block, stay short | guided: false |
Question 1 outranks question 2, and this is the single most important line in
the mapping. It is enforced by config_default_strictness in
hooks/lib/config.sh, not by this table: a decision that opens or closes the
front door of the gate cannot depend on a model following prose. A codebase with three years of history is in production, so the
truthful answer to question 2 is "going to production", and mapping that
straight to strict selects the setting that refuses most of the repository on
the first edit. Measured on a real Symfony application, 400 files sampled: 98%
have no declare(strict_types=1) and 88% are not final.
moderate relaxes design and style, never a boundary and never security:
LAYER* and SEC* keep their declared severity under it, which is asserted in
tests/core/test-rules-engine.sh. What it stops doing is refusing an edit
because of a class declaration two hundred lines above the change.
That sentence was written here before it was true. SEC* was missing from the
carve-out, so this change would have made a hardcoded secret advisory on every
repository with history, justified by a claim in a document a model reads to
decide. It is true now because the engine was fixed and a test holds it.
The baseline is the other half of the same answer: craftsman-ci baseline
records what the repository already carries, so a recorded violation reports
without blocking while a new one still refuses the write. Step D runs it.
The mark lives in .craftsman-baseline.json at the repository root, and the
question "which mark answers for this file" is settled by the file's own
directory, never by where the shell happens to be: a pipeline running from a
package directory, and a hook fired with whatever working directory the editor
has, read the same mark. A repository nested inside another (a submodule, a
package that took its own mark) answers for its own files.
Taking the mark is also what buys strict back. An existing repository whose
debt has never been measured defaults to moderate, where only a boundary or a
secret blocks; once the mark is taken, the default is strict again, because
the debt strict would refuse is now recorded and reported without blocking.
Naming a rule in this repository's .craft-rules.yml outranks the mark:
PHP001: block blocks a recorded violation too, which is how a project takes
one rule back out of the debt once it has been cleaned up. The same line in the
global ~/.claude/.craft-config.yml does not, because a preference held across
every repository on the machine is not a statement about this one.
The mark is taken once. A second craftsman-ci baseline is refused, and a
deliberate re-mark needs --re-baseline --reason "..." and says out loud which
files written since the first mark it absorbed.
Raising an existing project to strict is a deliberate later step, taken once
the debt is under a baseline, and it is one line in .craft-config.yml.
With guided: true, every quality gate block gains a plain-language paragraph explaining why the rule exists and where to read more. Turn it off later by flipping the key.
Same contract as the rest of this skill: display what was inferred, wait for confirmation, then write. What is displayed and written is the project file of The configuration file (v4), with the stack detected as that section says and the strictness and guided the four questions produced. Then validate it and read it back as that section says.
The baseline is the photograph of the code as it is today. It is what lets the plugin demand better without punishing anyone for debt they inherited.
bash "$(craftsman-path bin/craftsman-ci)" baseline src
Pass the source directories the project actually uses (src, app, lib, packages/*/src), from the repository root. This is the canonical mark, the one the hooks and CI read: it scans with the same validators and severities, records the rule violations each file already carries, and takes the structural photograph in the same .craftsman-baseline.json. ratchet.py init alone is not a substitute: it records the structure and no rule, so every inherited violation still blocks the first edit.
.craftsman-baseline.json exists the command refuses and exits 1; leave it as it is and tell the user. Re-taking it is their decision (--re-baseline --reason "..."), never a setup default.Then tell the user, explicitly:
.craftsman-baseline.json must be committed. It is the shared reference:
without it in git, CI and your teammates measure against a different photograph.
--quick skips the questions--quick bypasses the four questions entirely. It keeps the observed defaults
and still runs Step D, so a quick setup ends with a valid
.craftsman-baseline.json like any other.
Its strictness follows the same rule as the questions, and it does not need to
be re-derived: config_default_strictness in hooks/lib/config.sh is the one
implementation, and config_strictness already falls back to it. The table
above documents what that function returns; it does not compute it.
Every mode writes this one format, the one schemas/craft-config.schema.json
describes and hooks/lib/config.sh reads. The project file is
$PWD/.craft-config.yml: stack, strictness and guidance describe this
repository, not the machine.
# .craft-config.yml, format v4 (schemas/craft-config.schema.json)
v: 4
stack: {stack}
strictness: {strictness}
guided: {guided}
{stack}: symfony when only composer.json exists, react when only
package.json exists, fullstack when both do, other when neither does.
One word on the same line: the resolver reads a scalar.{strictness}: strict, moderate or relaxed, from the Step B mapping.
--quick omits the line, and the plugin then derives it
(config_default_strictness).{guided}: true or false (question 4). --quick writes false.Never write version:, a stack: mapping of versions, a packs: mapping or
a rules: block of booleans: that is the format before v4. No consumer reads
the first three (every shipped pack loads on every stack and judges its own
file types), a stack: mapping leaves the resolver with no stack at all, and
rules: is read as rule-id overrides (PHP001: warn), never as switches.
The machine-wide keys live in ~/.claude/.craft-config.yml and only the
machine owner sets them: preferred_tools (--global), trust_project_tools,
hooks, packs: external. A project file cannot grant them.
Validate, then read it back. A file that parses is not a file the plugin reads as intended. Before saying setup is done, run the validator (schema, resolver's own reader) and show the user the values the plugin will use:
bash -c 'source "$(craftsman-path hooks/lib/config.sh)"; config_validate .craft-config.yml && echo "stack=$(config_stack) strictness=$(config_strictness)"'
Any line it prints is a problem to fix before finishing; the healthcheck reports the same problems as a config error.
Migrating a pre-v4 file. A .craft-config.yml without v: 4 was written
for an older format. Keep what the resolver reads (strictness, rule-id
overrides under rules:, sentry_org, sentry_project, context_budget,
guided, and in the global file the machine-owner keys above, packs: external included), replace a stack: mapping with the detected word, drop
version:, the version numbers and the packs: switches, add v: 4, show
the result, write it after confirmation, and validate it as above.
--quick)When $ARGUMENTS contains --quick, skip ALL interactive questions and auto-generate configuration:
Detect stack using Glob tool:
Glob("composer.json") → PHP detectedGlob("package.json") → Node detected{stack} as The configuration file (v4) says: PHP only → symfony, Node only → react, both → fullstack, neither → otherExtract user name from git, for the summary:
git config user.name via Bash tool"Developer" if not configuredWrite the project file with the Write tool: $PWD/.craft-config.yml, the v4 block of The configuration file (v4), with the detected stack, guided: false, and no strictness line (the plugin derives it with config_default_strictness).
Take the baseline exactly as Step D says.
Validate and read back with the command of The configuration file (v4). Report its values, not the ones you meant to write.
Biases stay all enabled, by id: acceleration, scope_creep, over_optimization, dispersion.
Display summary (no questions asked):
Quick Setup Complete!
Name: {name} (from git config)
Stack: {stack read back by config_stack}
Strictness: {strictness read back by config_strictness}
Biases: all enabled
Baseline: {what Step D recorded, or "already taken"}
Config saved to .craft-config.yml (this project)
Run /craftsman:setup for full customization (situational questions, DISC profile)
If $PWD/.craft-config.yml already exists (the workshop profile in ~/.claude/ is not a project config and does not stop a project setup):
Config already exists at {path}. Quick setup skipped.
Use /craftsman:setup --quick --force to overwrite, or /craftsman:setup for interactive reconfiguration.
Exit without changes unless --force is also present in $ARGUMENTS. A file without v: 4 is a pre-v4 config: say so and offer the migration of The configuration file (v4) instead of skipping silently.
For the long guided flow (welcome, profile questions, bias protection, stack, summary), read references/interactive-walkthrough.md in this skill's directory, and only when the user asks for the full interactive setup or the situational flow above cannot answer. Whatever the flow:
AskUserQuestion for interactive collectionWrite tool to create the config fileconfig_validate, not only its YAML syntax: a pre-v4 file parses and is still read wronglyrules: and every key of the global file the user added manuallyWhat SKILL.md sets; muted values are Claude Code's defaults
sonnetmediumThree short reads, in order
setup-wizard, onboarding, configuration, project-conventions, codemap
23 skills in this plugin
/agent-designDesign AI agents using the 3P pattern (Perceive/Plan/Perform). Use when building autonomous AI agents or workflows./challengeSenior architecture review and code challenge. Use when reviewing code or PRs for quality, auditing architecture decisions, or responding to code review comments./ciCI/CD pipeline integration. Use when setting up or checking CI quality gates, exporting rules to GitHub Actions/GitLab CI/Bitbucket/Jenkins, or verifying pipeline alignment with local rules./debugSystematic debugging using ReAct pattern. Use when encountering bugs, errors, unexpected behavior, test failures, or performance issues. Never guess - investigate methodically./designSenior Domain-Driven Design methodology. Use for creating entities, value objects, aggregates, or designing domain models. Follows a 4-phase process (Understand, Challenge, Recommend, Implement)./factory/craftsman:factory - Issue Queue to Reviewed Pull RequestsIssue-driven software factory. Use to drain a queue of labelled GitHub or Linear issues into reviewed pull requests: intake, spec, test-first build, deterministic gate, routed review, and a review-depth label computed for the human who merges. Never merges.npx claudepluginhub buldee/ai-craftsman-superpowers --plugin craftsmanOther plugins' skills for the same job