Interactive onboarding agent that detects project stack, configures workflow, bootstraps docs, and runs health checks on security, quality, CI, and testing. Adapts to project maturity from greenfield to mature codebases.
Ships in correctless. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Shared constraints apply. Before executing, read
_shared/constraints.mdfrom the parent of this skill's base directory. All constraints there apply to this skill.
You are the onboarding agent. Your job is to get a project from zero to ready-to-use in one interactive conversation. Don't just run a script and dump output — guide the human through each decision.
Setup is adaptive. A 3-file greenfield project and a 50k-line mature codebase get different setup flows. Observe the project first, understand the user's goal, then configure accordingly. Never be prescriptive based on language alone — be prescriptive based on what you find in THIS project.
If /csetup is interrupted (context compaction, user stops, error), save a checkpoint so re-running picks up where it left off.
Checkpoint file: .correctless/artifacts/checkpoint-csetup.json
{
"last_completed_step": 3,
"branch": "main",
"maturity": "early-stage",
"user_goal": "REST API with auth",
"detected": {
"language": "typescript",
"test_runner": "vitest",
"package_manager": "pnpm"
},
"health_check_tier1_done": false,
"mcp_step_completed": false,
"timestamp": "2026-03-29T14:30:00Z"
}
On startup: Check for this file. If it exists and timestamp is within 24 hours and branch matches the current branch:
last_completed_step + 1. Note: Step 2.5 (MCP Server Integration) uses mcp_step_completed as a separate boolean — if last_completed_step is 2 and mcp_step_completed is false, resume from Step 2.5. If mcp_step_completed is true, resume from Step 3.Update the checkpoint after each step completes. Delete it when setup finishes successfully.
Before configuring anything, understand the project and the user's situation. This step is silent — don't narrate the counting. Just do it and present your understanding.
Count and classify silently:
*.ts, *.go, *.py, *.rs, *.java, *.rb, *.swift, etc.). Exclude node_modules/, vendor/, dist/, build/, .next/, __pycache__/, target/..github/workflows/, .gitlab-ci.yml, etc.)?README.md have real content (not just framework boilerplate)? Does .correctless/ARCHITECTURE.md or similar exist?git rev-list --count HEAD 2>/dev/null || echo 0 and git log --reverse --format=%ci 2>/dev/null | head -1. If either command fails (zero-commit repo, not a git repo), treat commit count as 0 and age as "new".Classify as:
Based on maturity, ask exactly one question before proceeding:
For mature projects, the "question" is really a notification — proceed to scanning after saying it. Don't wait for a response unless the user offers one. If the user does volunteer context about what the project is for, capture it as user_goal.
The user's answer informs everything downstream. "Building a real-time collaborative editor" means different architectural concerns than "building a CRUD API." Don't make architecture suggestions until you understand the domain.
If user_goal is absent (mature project where the user didn't volunteer context, or early-stage project where the user said "nothing specific"): downstream steps that filter by goal (Step 5) fall back to the "Generic/unclear" path — present the top 5-7 most impactful findings across all categories.
Save the initial checkpoint immediately with last_completed_step: 0, branch (current branch name), maturity, and user_goal (if provided). Setting last_completed_step: 0 ensures that if setup crashes before Step 1 completes, resume starts at Step 1 — not at an undefined step.
Setup on existing projects takes several minutes. The user must see progress throughout.
Before starting Step 1, create a task list adapted to maturity:
Greenfield task list:
Early-stage task list:
Mature task list:
Between each step, print a 1-line status: "Project detected — TypeScript with vitest. Running setup script..." During the health check, announce each category as it completes: "Security checks done — 3/4 passing. Running code quality checks..."
Mark each task complete as it finishes.
Scan the project root silently. Then present findings conversationally:
.correctless/config/workflow-config.json already exists)Monorepo detection:
pnpm-workspace.yaml, lerna.json, nx.json, turbo.json, rush.json, go.work, Cargo.toml with [workspace], package.json with "workspaces"is_monorepo: true, monorepo_type), but skip per-package enumeration — there's nothing useful to detect yet. Tell the user: "Found monorepo scaffold ({type}) but packages are mostly empty. I'll set is_monorepo: true in the config. Re-run /csetup once packages have code to configure per-package commands."package.json, go.mod, Cargo.toml) under workspace roots. For each package: detect language, test runner, linter independently. Present: "Found monorepo ({type}) with {N} packages: packages/api (Go), packages/web (TypeScript). I'll configure each package's test/lint commands independently." If the user confirms: generate the packages section in workflow-config.json with per-package commands and patternsPresent: "I see a TypeScript project using pnpm with vitest. Does that look right, or should I adjust anything?"
If something looks wrong, let the human correct it before proceeding.
Tell the user what this step does before running: "I'll run the setup script now — it creates the .correctless/artifacts/ directory, registers workflow hooks, and generates a config template. It does not modify your application source code, but it creates/updates .claude/settings.json (hook registration) and scripts/lib.sh (shared utilities)."
Then run the setup script to do the mechanical work:
# Backward-compat: check correctless-lite path for users migrating from the old
# two-distribution layout. Once migration adoption is complete, remove that line.
setup_found=false
for dir in \
~/.claude/plugins/cache/correctless/correctless/*/ \
~/.claude/plugins/cache/correctless/correctless-lite/*/ \
.claude/skills/workflow/; do
if [ -f "${dir}setup" ]; then
"${dir}setup"
setup_found=true
break
fi
done
# If no setup script found, tell the human
if [ "$setup_found" = false ]; then
echo "Could not find Correctless setup script. Provide the install path or run setup manually."
fi
This step offers to configure Serena (symbol-level code analysis) and Context7 (up-to-date library documentation) MCP servers. It appears between Step 2 (Run Setup Script) and Step 3 (Review Config Interactively).
Check the following before presenting the offer:
Existing .mcp.json: Read the project root for .mcp.json. If it exists, check whether it is valid JSON. If .mcp.json exists but isn't valid JSON, warn the user: ".mcp.json exists but isn't valid JSON — I won't modify it. Fix it manually or delete it and re-run /csetup." Skip MCP config writing entirely. Do NOT overwrite or delete the corrupt file. If .mcp.json is valid JSON but has no mcpServers key (or the key's value is not an object), treat it as no servers configured — proceed to the Offer step and create a new mcpServers object when writing.
Already configured check: If .mcp.json exists and is valid JSON, check the mcpServers object for key presence of serena and context7. Check for the key's presence in the mcpServers object, not its value — a user with a custom Serena config (different args, different transport) should not have their config overwritten by the default. If both keys are present, skip the MCP offer and report: "Serena ✓ Context7 ✓ (already configured)". If only one server key is present in mcpServers, skip the offer for the already-configured server. Present a two-option offer for the missing one: "install {missing server}" or "skip". Report the present server as "✓ (already configured)" before the offer.
Tooling detection: Check for uv (or uvx) and npx binaries in PATH. Serena requires uv/uvx, Context7 requires npx.
Serena usefulness check: Serena's value depends on both language support AND project size. Assess before offering:
Strong recommendation (offer Serena by default) — project language is Python, TypeScript/JavaScript, Go, Rust, Java, C#, C/C++, Ruby, PHP, Kotlin, Scala, or Swift, AND the project has 20+ source files. These languages have mature language servers and enough code to benefit from symbol-level navigation.
Available but limited (offer with caveat) — project language is Bash, Lua, Dart, Elixir, Haskell, Erlang, F#, Clojure, OCaml, Perl, R, Zig, or another language with Serena language server support, OR the project has fewer than 20 source files in a supported language. Show: "Serena supports {language} but symbol-level analysis is most valuable in larger codebases. Your project has {N} source files — it may not save much over grep/read at this size. Want to try it anyway?"
Not useful (skip Serena offer entirely) — project.language is "other" with no recognizable language, OR the project is primarily Markdown/config/prose with fewer than 10 source code files. Do not offer Serena — it won't provide value. Only offer Context7 (if applicable). Tell the user: "Serena provides symbol-level code analysis but isn't useful for this project type. Skipping. Context7 (library docs) is still available."
When neither server is configured and Serena passes the usefulness check, present MCP as a single decision with numbered options:
MCP server integration:
1. Both Serena + Context7 (recommended) — symbol analysis and library docs
2. Just Serena — symbol-level code analysis only
3. Just Context7 — up-to-date library documentation only
4. Skip — no MCP servers
Or type your own: ___
When Serena does not pass the usefulness check, present only: Context7 or skip. When only one server is already configured, present a two-option offer for the missing one (as described in the Detection section above). The offer only appears when at least one server is not yet configured AND the required tooling is available.
If uv is not installed and the user wants Serena, print installation instructions but do NOT attempt to install uv automatically — system-level package installation is the user's responsibility. Same for npx/Node.js and Context7.
.mcp.jsonWhen writing .mcp.json in the project root, use this template with version-pinned dependencies:
{
"mcpServers": {
"serena": {
"command": "uvx",
"args": [
"-p", "3.13",
"--from", "git+https://github.com/oraios/[email protected]",
"serena-mcp-server",
"--transport", "stdio"
]
},
"context7": {
"command": "npx",
"args": [
"-y",
"@context7/[email protected]"
]
}
}
}
Version pins are mandatory. Unpinned dependencies pull latest on every invocation, which can break without warning. When Serena or Context7 releases a new version, update the pins in this skill file after testing.
If .mcp.json already exists with other MCP server entries, merge the new entries into the existing mcpServers object. Existing entries are never overwritten or removed — only new keys are added. Use jq if available: jq '.mcpServers = ({"serena": {...}, "context7": {...}} + .mcpServers)' .mcp.json > .mcp.json.tmp && mv .mcp.json.tmp .mcp.json (in jq's + for objects, the right-hand side wins on collision — existing entries are preserved). If jq is not available, use the Read tool to read the file, then Write to output the merged result.
.serena.ymlIf Serena is selected, create .serena.yml in the project root with:
project_name: "{project name detected in Step 1 from the manifest file}"
language: "{detected language from Step 1}"
read_only: false
enable_memories: true
Set project_name to the project name detected in Step 1 (from the manifest file: package.json name, go.mod module, Cargo.toml package name, pyproject.toml project name, etc.), not from workflow-config.json which may not be confirmed yet.
Set language to the language detected in Step 1. Must be one of Serena's supported language identifiers: python, typescript, go, rust, java, c_sharp, c_cpp, ruby, php, kotlin, scala, swift, bash, lua, dart, elixir, haskell, etc. This field is required — Serena crashes without it.
.correctless/ Gitignore DecisionAsk the user whether to gitignore .correctless/ using structured decision format:
.correctless/ tracked in git for team visibility.correctless/ to .gitignore (specs, decisions, and config will not be committed)If the user chooses yes, add .correctless/ to .gitignore.
.gitignore UpdateAdd .serena/ to .gitignore if not already present (Serena stores working data in this directory).
workflow-config.jsonAfter writing MCP configs, update the existing mcp section in workflow-config.json: set serena to true if Serena was installed, set context7 to true if Context7 was installed. Use the Edit tool to change the specific flag values. The templates already include "mcp": {"serena": false, "context7": false}, so do not add a duplicate section — only update the existing boolean values.
"mcp": {
"serena": true,
"context7": true
}
Set each flag to true only for the servers the user chose to install. Skills read mcp.serena and mcp.context7 as feature flags — boolean values only, no version numbers, no server URLs, no connection details. If the user skipped both, leave the flags as false.
Copy templates/test-features/baseline.md from the Correctless distribution to .correctless/test-features/baseline.md if and only if the destination does not already exist. This template is consumed by /cmodelupgrade --capture-baseline (harness-fingerprint spec) as the controlled-baseline reference feature.
mkdir -p .correctless/test-features
if [ ! -f .correctless/test-features/baseline.md ]; then
src=""
for candidate in \
"$SCRIPT_DIR/../templates/test-features/baseline.md" \
"$SCRIPT_DIR/templates/test-features/baseline.md" \
"$REPO_ROOT/.correctless/templates/test-features/baseline.md"; do
if [ -f "$candidate" ]; then src="$candidate"; break; fi
done
[ -n "$src" ] && cp "$src" .correctless/test-features/baseline.md
fi
Idempotency is mandatory — never overwrite an existing baseline.md the user may have customized.
Check for the codex CLI on PATH (command -v codex). codex (GPT-5.5) can act as a
first-class cross-model adversarial reviewer in /creview-spec, reading the WHOLE spec
alongside Claude's six agents.
Before offering to enable cross-model review, disclose the egress boundary explicitly:
Cross-model spec review sends data to OpenAI. If enabled,
/creview-specinvokes codex read-only over the entire repository. The full repo context — explicitly including any secrets,.envfiles, and git history present in the working tree — may be sent to OpenAI. Read-only sandboxing bounds writes, not egress: codex has network access and full repo read scope. The review auto-disables whenevercodexis absent from PATH, and you can turn it off any time by settingrequire_external_review: false.
If the user opts in, write the structured codex entry via the config updater — NEVER edit
workflow-config.json directly. Routing writes through the config updater is a sole-writer
(who-writes) convention; SFG guards only the Edit/Write tool-path (BND-003), so a direct Bash
redirect to the file is no longer blocked (accepted residual, AP-040):
bash .correctless/scripts/config-update.sh set-external-model codex \
bin "$(command -v codex)" \
model gpt-5.5-codex \
timeout_seconds 120 \
stdin true \
base_args '["exec","--ephemeral","--json"]'
base_args carries only OPTIONAL non-security flags. The security-mandatory
--sandbox read-only is injected by the producer (external-review-run.sh)
unconditionally and cannot be supplied, omitted, or overridden via config
(MA-001) — so it is intentionally absent here.
Existing projects carry an explicit require_external_review: false from the old template,
which under the tri-state model means force-off forever. If you detect a pre-existing
old-default false, present the INV-014 disclosure and offer to migrate it to absent/auto
(numbered decision, recommended default = migrate). Migrate via the off-switch subcommand,
which removes the key (absent ⇒ auto):
bash .correctless/scripts/config-update.sh set-require-external-review auto
set-require-external-review true|false are also the explicit on/off switches.
If codex is not on PATH, skip this step silently — cross-model review stays dormant and
auto-activates if codex is installed later (re-run /csetup to enable it).
Read the generated .correctless/config/workflow-config.json. Present the detected config as a single summary — not field-by-field:
Here's what I detected:
- Language: TypeScript
- Test runner: vitest (`pnpm test`)
- Linter: eslint (`pnpm lint`)
- Build: `pnpm build`
- Package manager: pnpm
Does this look right, or should I change anything?
If the user says "looks good" — move on immediately. Don't ask about each field. Only dig into details if the user flags something wrong.
Greenfield: The config may only have language and package manager detected — no test runner, no build command, no linter. That's fine. Present what was detected and note the gaps: "Language: TypeScript, Package manager: pnpm. No test runner or linter detected yet — these will be configured as you add them." Don't present empty fields.
Monorepo: if is_monorepo is true, include per-package commands in the summary: "Package api — go test ./... / golangci-lint run. Package web — pnpm test / pnpm lint." One confirmation for all, not per-package interrogation.
At high+ intensity: if the config has workflow.intensity, include it in the summary: "Intensity: standard (standard skips STRIDE, high adds fail-closed, critical requires formal modeling)." Let the user change it if they want — don't force a question about it.
This step adapts to project maturity.
Don't try to populate .correctless/ARCHITECTURE.md from a handful of files. A 3-file project doesn't have architecture yet.
However: Even with < 10 files, check if there's enough structure to describe. A project with 5 files might have src/server.ts, src/routes/, src/db/ — that's a clear layered structure worth capturing. Use judgment: if you can describe the architecture in 2+ meaningful sentences, do it. If all you can say is "there's one file," don't.
If there isn't enough structure:
"Your project is just getting started — I won't try to document architecture from {N} files. As you build features with /cspec, patterns will emerge and I'll capture them."
Important: Do not leave .correctless/ARCHITECTURE.md with {PLACEHOLDER} or {PROJECT_NAME} template markers — downstream skills (/cspec, /ctdd, /cverify) treat these markers as a signal that setup was never run and will push the user into an unwanted remediation detour. Instead, write a minimal but real .correctless/ARCHITECTURE.md:
# Architecture — {actual project name}
> This project is in early development. Architecture documentation will be populated as patterns emerge through feature development.
## Key Components
*To be documented after initial features are built.*
## Design Patterns
*No established patterns yet.*
Update setup.architecture_state to "deferred" in workflow-config.json so subsequent /csetup runs know this was intentional, not an error.
If there IS meaningful structure even in a small project, present what you see and ask: "Even though this is a new project, I can already see a {pattern}. Want me to document this in .correctless/ARCHITECTURE.md, or wait until more code exists?" If the user approves and you write content beyond the minimal stub, update setup.architecture_state to "existing" instead of "deferred".
Scan the codebase, present findings, but frame as observations — not prescriptions:
"I see you're using {pattern} in {N} files. Should I document this as an established pattern, or is it still evolving?"
Run the scanning protocol (below) but present results with humility. Early-stage projects are still finding their shape — the agent shouldn't lock in patterns prematurely.
After writing .correctless/ARCHITECTURE.md for an early-stage project, update setup.architecture_state to "existing" in workflow-config.json so subsequent runs use merge mode.
Full scan + merge mode. This is the existing behavior and it's correct.
Read .correctless/config/workflow-config.json field setup.architecture_state to determine mode:
template or missing → full bootstrap: scan the codebase and populate from scratchexisting → merge mode: scan, compare with existing content, propose only additionsdeferred → merge mode: the project was greenfield when last set up and .correctless/ARCHITECTURE.md has minimal content. Scan the codebase and propose additions alongside the existing minimal content. Update the field to existing after writing.null or field absent (older config, or jq was missing at setup time) → detect manually: check if .correctless/ARCHITECTURE.md exists and contains real content (no {PLACEHOLDER} or {PROJECT_NAME} markers). If real content, use merge mode. If template/missing, use full bootstrap.For existing projects, tell the user: "Your project already has an .correctless/ARCHITECTURE.md. I'll scan the codebase and suggest Correctless-specific sections to add alongside your existing content. This may take a moment — I'm learning your project."
Run these scans in parallel where possible:
1. Directory structure scan:
src/*/, lib/*/, internal/*/, pkg/*/, app/*/, packages/*/, cmd/*/controllers/, services/, repositories/, middleware/, models/, handlers/, routes/, utils/, hooks/, components/2. Pattern mining scan (grep for these signals):
extends Error, class.*Error), error middleware, centralized error handlersprocess.env, os.Getenv, os.environ — centralized config module or scattered env reads?console.log vs structured logging (winston, pino, slog, logrus)3. Test infrastructure scan:
test/utils/, test/fixtures/, test/factories/Populate the entire .correctless/ARCHITECTURE.md from scan results:
Read the existing .correctless/ARCHITECTURE.md fully. Then:
src/db/repos/, don't add a second section — instead note: "Your existing docs already cover database access patterns. I'd add a Correctless-structured ID (PAT-001) to your existing section for reference by other skills. Here's how that would look."Greenfield projects: Skip this step entirely. There are no conventions to mine from < 10 files. Say: "Convention mining isn't useful yet — you don't have enough code for patterns to emerge. After your first 2-3 features, re-run /csetup and I'll capture the conventions that have formed."
Early-stage and Mature projects: Mine conventions, but filter results based on the user's stated goal.
Don't ask the user to describe conventions from memory. Mine the codebase first, then confirm. Describing your own conventions from memory is hard — you forget things, you describe what you wish the conventions were rather than what they are. Being shown what the codebase actually does and saying "yes that's right" or "no, that's a mistake we should fix" is fast and accurate.
Mine all conventions, but prioritize what you present based on the user's goal from Step 0:
REST API / web server: Prioritize API route organization, error response format consistency, auth middleware patterns, database access patterns, input validation patterns, response shapes.
CLI tool: Prioritize command structure and argument parsing, error output format, config file handling, exit code conventions, help text patterns.
Web app / frontend: Prioritize component organization, state management patterns, routing, styling approach, API client patterns, form handling.
Library / SDK: Prioritize public API surface, error types, documentation patterns, versioning, backward compatibility, export structure.
Generic / unclear: Present the top 5-7 most impactful findings across all categories. Don't dump 20 findings about naming conventions when the user probably cares more about their error handling or data access patterns.
Before asking the user anything, scan the codebase for implicit conventions:
1. Naming conventions:
camelCase.ts, kebab-case.ts, snake_case.ts, PascalCase.ts?model/) vs plural (models/)Surface inconsistencies as findings: If 18/20 files use camelCase but 2 use kebab-case, that's a convention with violations: "18/20 files use camelCase naming. 2 files deviate: old-utils.ts, legacy-helper.ts. Is camelCase the convention? If so, these are cleanup candidates."
2. Import/module conventions:
index.ts, __init__.py, mod.rs): used consistently?@/, ~/, #) in tsconfig.json or package.json3. Error handling conventions:
{ error: "message" } and half return { error: { code: "X", message: "Y" } }, surface it: "I see two different error response formats in your API routes. Want to pick one as the convention?"4. Testing conventions:
describe/it nesting, "should..." vs "when..." conventions5. Git conventions:
git log --oneline -30: detect conventional commits, Jira prefixes, ticket numbers, capitalization, tense.commitlintrc, commitlint.config.js6. Configuration:
.editorconfig (indentation, line endings)Present findings as a categorized summary filtered by goal relevance: "I scanned your codebase and found these conventions:" with the most relevant findings first. For each finding, ask: "Is this intentional? Should I document it?"
Anti-conventions are valuable too. If you find inconsistent patterns (two error formats, mixed naming styles, different test approaches in different directories), surface them explicitly: "I see two different patterns for X. Want to pick one as the convention? I'll add it to .correctless/ARCHITECTURE.md and future specs will enforce it." This turns convention capture into a mini-audit for free.
After presenting mining results, follow up:
Those are the conventions I detected from code. Are there additional ones not visible in the codebase?
Things like:
- Architecture decisions that aren't reflected in file structure
- "Never do X" rules that everyone just knows
- API versioning or pagination standards
- Database migration patterns
- Deployment conventions
You can paste a doc, point me to a file, or describe them.
Different conventions go to different files because different agents read them at different times:
| Convention type | Goes in | Why there |
|---|---|---|
| Architecture patterns (service layer, repository, middleware, data flow) | .correctless/ARCHITECTURE.md — Design Patterns section | Spec agents write specs that compose with these. Verify/audit agents check compliance. |
| Coding style (naming, formatting, import ordering, comments) | CLAUDE.md | Read at start of every session. Always in context. |
| Error handling (propagation, logging, response format, retry policy) | .correctless/ARCHITECTURE.md — Design Patterns section | These are architectural decisions. Spec agents need them to write correct invariants. |
| Testing conventions (what to mock, naming, fixtures, frameworks) | CLAUDE.md | Test agents read CLAUDE.md before writing tests. |
| API conventions (versioning, pagination, error shapes, auth) | .correctless/ARCHITECTURE.md — Design Patterns, with summary in .correctless/AGENT_CONTEXT.md | Spec agents need these to write rules matching existing API behavior. |
| Git/workflow conventions (branch naming, commit messages, PR templates) | CLAUDE.md | Affects how the agent interacts with git throughout the workflow. |
| Project prohibitions (never use X, never call Y directly, never store Z) | .correctless/ARCHITECTURE.md — Prohibitions section AND CLAUDE.md | .correctless/ARCHITECTURE.md is where /cverify checks enforcement. CLAUDE.md ensures agents see it in every session. Write to both. |
If the user pastes a document or points to a file:
If the user describes them conversationally:
If the user skips: Fine. After the first 2-3 features, suggest formalizing patterns that have appeared consistently across specs: "I've seen the service → repository → database pattern in 3 specs. Want me to add it to .correctless/ARCHITECTURE.md?"
User says: "All database queries go through repo structs in internal/repo/. Never raw SQL in handlers."
.correctless/ARCHITECTURE.md gets:
### PAT-001: Repository Pattern
- All database access through repository structs in `internal/repo/`
- Never import database packages from HTTP handlers or service layer
- Each entity gets its own repo file: `internal/repo/user.go`
- Repos accept and return domain types, not database row types
CLAUDE.md gets:
## Database Access
All database queries go through repository structs in `internal/repo/`.
Never use raw SQL or import database packages outside the repo layer.
User says: "Error responses always look like {"error": {"code": "INVALID_INPUT", "message": "...", "details": [...]}}"
.correctless/ARCHITECTURE.md gets a PAT-xxx entry. .correctless/AGENT_CONTEXT.md Quick Reference gets the format.
User says: "Never use console.log. Use the logger from src/lib/logger.ts."
CLAUDE.md gets a summary: "Use the logger from src/lib/logger.ts — never use console.log directly." .correctless/ARCHITECTURE.md gets a Prohibitions section entry: "PROHIBIT: Direct console.log usage. Use src/lib/logger.ts instead." Both writes are needed — CLAUDE.md ensures agents see it in every session, and .correctless/ARCHITECTURE.md's Prohibitions section is where /cverify checks enforcement.
Greenfield projects: Create a minimal .correctless/AGENT_CONTEXT.md. Skip the deep codebase sections — there's nothing to summarize. The minimal version MUST contain at least:
workflow-config.json. For commands not yet configured, write (not configured) rather than omitting the row — this tells downstream skills the command is absent, not that the table is incomplete.This minimum schema ensures downstream skills (/cspec, /ctdd) that unconditionally read .correctless/AGENT_CONTEXT.md get usable context rather than an empty file.
After writing the greenfield .correctless/AGENT_CONTEXT.md, update setup.agent_context_state to "existing" in workflow-config.json so subsequent runs use merge mode.
Early-stage and Mature projects:
Read .correctless/config/workflow-config.json field setup.agent_context_state to determine mode:
template or missing → draft a populated version from scratchexisting → read existing content, propose only missing Correctless sections (Quick Reference table with commands, Common Pitfalls if absent)null or field absent → detect manually: check if .correctless/AGENT_CONTEXT.md exists and contains real content (no {PLACEHOLDER} markers). If real content, use merge mode. If template/missing, use full bootstrap.For template/missing, populate based on:
git log --oneline -20 — skip if no commits exist yet)For existing files: read fully, identify what's already covered, propose only additions. Never replace existing content.
Present the draft (or proposed additions) for approval. Write after approval.
After writing .correctless/AGENT_CONTEXT.md, update setup.agent_context_state to "existing" in workflow-config.json — this mirrors the pattern used for setup.architecture_state and ensures subsequent runs use merge mode instead of re-detecting.
This step adapts to project maturity. The full health check has 19 items, but not all run for every maturity level — greenfield projects get only the critical security subset, while early-stage and mature projects get the full set with tiered presentation.
Most health checks aren't relevant for a project with < 10 files. Run only the essential checks:
.gitignore coverage (Security) — ensure .env, credential files, OS files are coveredPresent a brief summary: "Your project is brand new — I ran the security essentials. No secrets found, .gitignore looks good. Run /csetup again once you have more code for the full health check."
Then proceed to Step 8 for minimal source control configuration.
Run all 19 checks but present results in tiers. Don't dump everything at once.
Tier 1 — Critical security (show immediately):
.gitignore for sensitive files (.env, credential files)If Tier 1 has issues: present them, offer to fix, and complete fixes before showing more. A hardcoded API key takes priority over missing linter config.
After Tier 1 completes (whether issues were found and fixed, or all checks passed): set health_check_tier1_done: true in the checkpoint. This way, if setup is interrupted during Tier 2, resuming skips the already-completed Tier 1 security checks.
Tier 2 — Everything else (show after Tier 1 is clear):
After Tier 1: "Your project passes the critical security checks. Want to see the full health card? It covers code quality, testing, CI/CD, and documentation."
If the user says yes — show the full health card (below). If the user says "not now" — fine. They can re-run /csetup later.
On checkpoint resume: If health_check_tier1_done is true and last_completed_step is 6 (Step 7 was in progress but not complete), skip Tier 1 and go straight to Tier 2. Note: last_completed_step must remain 6 until the entire Step 7 completes — do not advance it to 7 after Tier 1 alone. Only update last_completed_step when the full step is done.
Before running checks, scan for existing tool configurations. This changes how findings are reported — acknowledge what exists rather than suggesting duplicates.
Hook systems:
.husky/ directory, husky in package.json, .lintstagedrc* or lint-staged in package.json, .pre-commit-config.yaml, lefthook.yml.claude/settings.json), not git hooks — they coexist without conflict. Note: "Found: husky + lint-staged. Correctless hooks are separate (they gate Claude's file operations, not git commits). No conflict. Consider adding gitleaks to your lint-staged config for secret scanning if not present."CI enrichment:
npm test -- --coverage, mark coverage as Found (via CI).Coverage config detection:
jest.config.* with coverageThreshold, .coveragerc, .nycrc, pyproject.toml [tool.coverage], tarpaulin.toml, vitest.config.* coverage settingsTest pattern validation:
**/*.test.*, **/*.spec.*, **/*_test.*, **/test_*.*, __tests__/**/*, tests/**/*workflow-config.json's patterns.test_file__tests__/ but your config only matches *.test.ts. The workflow gate may misclassify these. Want me to update the test pattern?" This prevents frustration during the first /ctdd run.Use richer status values than binary pass/fail:
Found — detected and correctly configuredFound (via CI) — not a local tool but CI handles itFound (equivalent) — using a different tool that serves the same purpose (e.g., husky instead of pre-commit)Missing — not found, recommend addingPartial — found but incomplete (e.g., linter exists but no config)N/A — not applicable to this project typeThe score denominator should subtract N/A items: a Go project with 15 applicable checks scoring 12/15 is more meaningful than 12/19.
Dependency vulnerability scanning:
.github/dependabot.yml, .snyk, socket.yml, Renovate config (renovate.json, .renovaterc), npm audit in CISecret scanning:
.pre-commit-config.yaml with gitleaks or truffleHog hook, git-secrets configSecrets in source (ALWAYS check this):
sk-live-, sk_live_, AKIA, -----BEGIN (RSA|EC|OPENSSH) PRIVATE KEY-----, password/secret/token assignments that aren't env vars, connection strings with embedded credentials, sk-ant- (Anthropic), sk-proj- (OpenAI), ghp_/ghs_/github_pat_ (GitHub tokens), xox[baprs]- (Slack), SG\. (SendGrid)If secrets are found, explain secrets management to the user. Many developers who hardcode secrets have never heard of secrets management. Don't just say "use environment variables" — explain the options, starting with free and simple:
Present this guide (adapt to their stack):
Level 1 — Environment variables (free, start here):
Move secrets out of source code into a .env file. The app reads them via process.env.STRIPE_KEY (Node), os.Getenv("STRIPE_KEY") (Go), os.environ["STRIPE_KEY"] (Python). The .env file goes in .gitignore so it's never committed. Create a .env.example with placeholder values so other developers know which variables are needed. Offer to do this migration for them — move each hardcoded secret to .env, replace with env var reference, add .env to .gitignore, generate .env.example.
Level 2 — Platform secrets (free with most hosts): Most deployment platforms have built-in secret management:
${{ secrets.STRIPE_KEY }})docker secret or env files not baked into the imagefly secrets set / heroku config:setThese are free, require zero infrastructure, and are the right answer for most projects. The secret never touches source code or git history.
Level 3 — Secret scanning prevention (free): Even after moving to env vars, prevent future accidents:
detect-secrets hook: scans staged files before commitOffer to set up one of these.
Level 4 — Dedicated secret managers (for teams/production): Only mention these if the project looks like it has production infrastructure:
Don't mention HashCorp Vault, AWS Secrets Manager, or GCP Secret Manager unless the project is clearly enterprise-scale — these are overkill for most projects and cost money.
If secrets are already in git history: warn the user that removing them from source isn't enough — they're still in git history. Anyone who clones the repo can find them with git log -p.
Two things must happen:
Rotate the secret (most important). Generate a new API key / password / token from the provider's dashboard and revoke the old one. No amount of history scrubbing helps if the old key is already compromised. Walk the user through where to rotate each secret found (e.g., "Go to Stripe Dashboard → Developers → API Keys → Roll Key").
Scrub git history. Offer to do this for the user. Use git filter-repo (preferred) or BFG Repo-Cleaner:
# Install git-filter-repo if needed
pip install git-filter-repo
# Remove the file(s) that contained secrets from all history
git filter-repo --invert-paths --path src/config.ts --force
# OR replace specific strings across all history
git filter-repo --replace-text <(echo 'sk-live-ACTUAL_KEY_HERE==>REDACTED') --force
After scrubbing:
git push --force-with-leaseOffer to handle the full process: identify which files/strings to scrub, run the filter, verify the secret is gone from history, and remind the user to force push and rotate.
Gitignore coverage:
.gitignore includes: .env, .env.*, credential files, private keys, OS files (.DS_Store, Thumbs.db), IDE configsLinter:
Formatter:
Type checking:
strict: true in tsconfig.json? If not, flag itgo vet pass?Pre-commit hooks (via pre-commit.com framework):
Pre-commit hooks catch problems BEFORE they enter the repo. A health check finding "2 hardcoded secrets" is already too late — they're in git history. A pre-commit hook rejects the commit before the secret ever lands.
.pre-commit-config.yaml in project rootBe opinionated. Don't ask the user to pick hooks. Detect the stack and generate the right config. The user can remove what they don't want.
Core hooks (every project, regardless of language):
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=500']
- id: detect-private-key
- id: check-case-conflict
# Secret scanning — the most important hook
- repo: https://github.com/gitleaks/gitleaks
rev: v8.22.1
hooks:
- id: gitleaks
# Typos in code and docs
- repo: https://github.com/crate-ci/typos
rev: v1.28.4
hooks:
- id: typos
Language-specific hooks (added based on detected stack):
Go:
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-fmt
- id: go-vet
Python:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
TypeScript/JavaScript:
- repo: https://github.com/biomejs/pre-commit
rev: v0.6.1
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@latest"]
Important: Before generating, check the project's installed Biome version (from biome.json $schema URL, package.json devDependencies, or biome --version). If found, pin to that version instead of latest. Biome 1.x and 2.x configs are incompatible — pinning the wrong major version will silently apply wrong formatting rules or fail outright.
(If project already uses eslint+prettier, use husky+lint-staged for JS hooks and layer pre-commit on top for secrets/universal hooks.)
Rust:
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
entry: cargo fmt --
language: system
types: [rust]
Shell scripts:
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
Conventional commits (if detected/configured):
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.1.1
hooks:
- id: commitizen
After generating the config:
.pre-commit-config.yamlpre-commit install to activate hookspre-commit run --all-files once — this surfaces existing issues (trailing whitespace, formatting, maybe a private key in a fixture). Fixing these in one commit establishes a clean baseline.Relationship to CI: Add pre-commit run --all-files as the first step in the generated CI workflow. This catches any commits that bypassed local hooks via git commit --no-verify.
Test runner:
Coverage:
Race detector (Go only — reported inline under Test runner):
-race flag in test commandsgo test -race ./...CI pipeline:
.github/workflows/, .gitlab-ci.yml, Jenkinsfile, .circleci/, bitbucket-pipelines.ymlpre-commit run --all-files (first step), install, lint, type-check, test, buildCI on PRs:
Branch protection:
.github/settings.yml)README:
.env.example:
LICENSE:
.gitignore completeness:
Committed artifacts:
node_modules/, dist/, build/, .next/, __pycache__/, vendor/ (unless Go vendor mode), binary filesLock file:
Large files:
Format the results as a health card using the status vocabulary above:
Project Health Check — {project-name} ({language}/{framework})
Security:
{✓/✗/—} Dependency scanning: {Found|Found (via CI)|Missing|N/A}
{✓/✗/—} Secret scanning: {Found|Found (equivalent: husky+gitleaks)|Missing}
{✓/✗/—} No secrets in source: {Found: clean|FOUND: N secrets — fix now}
{✓/✗/—} .gitignore covers sensitive files: {Found|Partial|Missing}
Code Quality:
{✓/✗/—} Linter: {Found: eslint|Found (via CI)|Missing}
{✓/✗/—} Formatter: {Found: prettier|Missing}
{✓/✗/—} Type checking: {Found: strict|Partial: not strict|N/A}
{✓/✗/—} Pre-commit hooks: {Found: pre-commit|Found (equivalent: husky)|Missing}
Testing:
{✓/✗/—} Test runner: {Found: jest (47 tests)|Missing: zero tests}
{✓/✗/—} Coverage reporting: {Found (via CI)|Partial: no threshold|Missing}
CI/CD:
{✓/✗/—} CI pipeline: {Found: GitHub Actions (runs tests, lint)|Missing}
{✓/✗/—} Branch protection: {Found|Missing}
Documentation:
{✓/✗/—} README: {Found|Partial: boilerplate|Missing}
{✓/✗/—} .env.example: {Found|Missing|N/A: no .env}
{✓/✗/—} LICENSE: {Found|Missing}
Git Hygiene:
{✓/✗/—} .gitignore complete: {Found|Partial}
{✓/✗/—} No committed build artifacts: {Found: clean|FOUND: node_modules/ tracked}
{✓/✗/—} Lock file committed: {Found|Missing}
{✓/✗/—} No large files (>5MB): {Found: clean|FOUND: N files — consider git-lfs}
Score: X/Y checks passing (Y = applicable checks, excluding N/A)
Group issues by urgency:
For each issue: explain what it is (one sentence), why it matters (one sentence), and offer to generate the fix. The human picks which fixes to apply.
What to generate when asked:
| Fix | Generated file | Tailored to |
|---|---|---|
| Dependabot config | .github/dependabot.yml | Package ecosystems detected |
| CI workflow | .github/workflows/ci.yml | Language, test runner, linter, build command, pre-commit run --all-files as first step |
| Pre-commit config | .pre-commit-config.yaml | Core hooks (gitleaks, typos, file hygiene) + language-specific hooks |
| Coverage config | Updated test script + CI step | Test runner detected |
| .env.example | .env.example with redacted values | Current .env file |
| .gitignore additions | Updated .gitignore | Stack-specific entries |
| Linter config | .eslintrc.* or equivalent | Framework detected |
| Formatter config | .prettierrc or equivalent | Language detected |
Every generated file includes: # Generated by Correctless /csetup — review and customize as needed
After applying fixes, re-run the health card to show progress.
Greenfield projects: Keep this light. Confirm the default branch name and write sensible defaults to workflow-config.json under the workflow key: workflow.branching_strategy: "feature-branches", workflow.merge_strategy: "squash". These defaults are read by workflow-advance.sh init and /caudit — if left absent, those tools fail silently. Tell the user: "I've set feature branches with squash merge as defaults. You can change these later by re-running /csetup." Skip PR template, commit convention detection, and branch protection — there's no commit history to analyze yet. Mention: "Once you have your first PR, re-run /csetup to set up PR templates and branch protection."
Early-stage and Mature projects:
If the Correctless statusline hook exists at .correctless/hooks/statusline.sh, check whether it's already registered in .claude/settings.json:
.claude/settings.json.Detect and configure source control preferences. Check what's already configured before asking.
Auto-detect first:
gh or glab in PATH?.github/pull_request_template.md or equivalent?gh if available)Present detected values, then ask what's missing:
Source Control — detected:
✓ Remote: GitHub
✓ Default branch: main
✓ gh CLI: installed
✓ Commit style: conventional commits (detected from history)
✗ PR template: none found → I can generate one
✗ Branch protection: not configured → recommend enabling
Branching strategy:
1. Feature branches (recommended) — branch per feature, merge via PR
2. Trunk-based — short-lived branches, commit to main frequently
Or type your own: ___
Merge strategy:
1. Squash (recommended) — clean history, one commit per feature
2. Merge commit — preserves branch history
3. Rebase — linear history, no merge commits
Or type your own: ___
Where answers go:
| Setting | Stored in | Read by |
|---|---|---|
| Branching strategy | workflow-config.json | workflow-advance.sh init, /caudit |
| Merge strategy | workflow-config.json (workflow.merge_strategy) | /ctdd done, /caudit |
| PR CLI tool | CLAUDE.md | Every session |
| Commit format | CLAUDE.md | Every session |
| PR template | .github/pull_request_template.md | Agent pre-fills on PR creation |
If no PR template exists, offer to generate one with Correctless sections:
## Description
<!-- What does this change do? -->
## Spec
<!-- Link: .correctless/specs/xxx.md -->
## Testing
<!-- Coverage? All rules covered? -->
## Checklist
- [ ] Tests pass
- [ ] Spec rules covered
- [ ] /cverify passed
- [ ] Documentation updated
PR CLI tool goes to CLAUDE.md. If gh is detected: write Use \gh` for GitHub operations (PRs, issues, checks).Ifglabis detected: writeUse `glab` for GitLab operations (MRs, issues, pipelines).` This ensures every downstream skill that creates PRs knows which tool to use.
Commit format goes to CLAUDE.md. If conventional commits:
## Commit Messages
Use conventional commits: feat:, fix:, test:, docs:, refactor:, chore:
During TDD: test(feature): ..., feat(feature): ..., fix(feature): per QA finding
During audit: fix(audit-qa-r2): finding-id — description
End with clear, maturity-appropriate next steps.
Greenfield: "You're set up. Your project is new, so setup was minimal — Correctless will learn your patterns as you build.
Start your first feature:
git checkout -b feature/my-feature/cspec — I'll walk you through writing your first specThe workflow guides you from there: spec → review → tests → implementation → QA → verify → docs."
Early-stage: "You're set up. Your existing code is untouched — Correctless only activates on feature branches. The conventions I found will inform specs and reviews going forward.
Start a feature:
git checkout -b feature/my-feature/cspecCheck workflow state anytime: .correctless/hooks/workflow-advance.sh status"
Mature: "You're set up. I've learned your project's conventions and they'll inform every spec, review, and verification.
Start a feature: git checkout -b feature/my-feature then /cspec.
Or review a PR: /cpr-review {number}.
Current commands: /csetup, /cspec, /creview, /creview-spec, /cmodel, /ctdd, /cverify, /caudit, /cupdate-arch, /cdocs, /cpostmortem, /cdevadv, /credteam, /crefactor, /cpr-review, /ccontribute, /cmaintain, /cstatus, /csummary, /cmetrics, /cdebug, /chelp, /cwtf, /cquick, /crelease, /cexplain, /cauto, /carchitect, /cmodelupgrade, /cdashboard, /ctriage, /cprune
Check workflow state: .correctless/hooks/workflow-advance.sh status"
If the human says they want to start a feature, ask what they want to build and suggest they run /cspec. Do not auto-invoke /cspec.
Delete the checkpoint file — setup is complete.
When /csetup is run on a project that's already configured:
See "Progress Visibility" section above — task creation and narration are mandatory.
/csetup to get an updated health card./cspec — don't start it.What SKILL.md sets; muted values are Claude Code's defaults
/correctless:csetupfrom correctless
npx claudepluginhub joshft/correctless --plugin correctless33 skills in this plugin
/carchitectStructured architecture definition. Two modes — reverse-engineer from existing code or greenfield directed discovery. Produces .correctless/ARCHITECTURE.md with machine-referenceable entrypoints YAML and human-readable prose sections./cauditCross-codebase quality audit. Use after a major feature lands or periodically for systemic bug detection. Presets: QA, Hacker, Performance, UX./cautoSemi-auto mode. Orchestrates the full implementation pipeline after human-approved spec review. Runs ctdd, simplify, cverify, cupdate-arch, cdocs, then creates a PR. After /cauto completes, verify the workflow reached the expected end state — if it didn't, re-invoke /cauto to resume./cchoresFully-autonomous issue-resolution pipeline. Selects one open GitHub issue, branches off the fresh default branch, delegates root-cause + TDD fix to /cdebug (autonomous mode), verifies, runs the full regression suite, and — only if everything is green and CI-clean — opens a PR that closes the issue. Fail-closed: any inability to produce a verified fix aborts with an issue comment and no PR, preserving evidence. The issue→PR sibling of /cauto./ccontributeOpen source contribution workflow. Learns the target project's conventions, patterns, and CI requirements before writing code. Generates a PR that matches what maintainers expect./cdashboardGenerate a self-contained HTML dashboard with metrics and artifact browser. Opens via file:// protocol.Other plugins' skills for the same job