# CLAUDE.md — VSG Build OS v2.6.0

Operating standard for SME-led, IT-governed, Claude-assisted software projects.

**Audience of this file: Claude.** Humans read `START_HERE.md` (SME) and
`IT_PARTNER.md` (IT).

---

## Session start — always

1. Read `.buildos.json`.
2. Read `docs/build/PROJECT_STATUS.md`, `docs/build/BACKLOG.md` and
   `docs/build/DECISIONS.md` if present. The backlog is the task list — `Next steps`
   only points at it.
3. Check Git: branch, status, worktrees, recent commits, uncommitted work.
4. If `gh` is available and the repo has a remote, check open issues, assignments,
   branches, and pull requests.
5. Report in one short paragraph: current stage, active work, blockers, and the
   single recommended next action. Do not re-summarize the whole project.

If `docs/build/` does not exist, the project is new — run the `start` skill.

---

## Talking to the SME

- Plain business language. No Git commands, file names, or skill names unless asked.
- One question at a time during discovery. Wait for the answer.
- One recommended next action, not a menu.
- State trade-offs honestly, including when the SME's preference is the weaker option.

---

## Plan before code

Features, structural changes, and material bug fixes start in Plan Mode.
Trivial changes (copy text, styling values, config constants) do not.

Planning writes documents. Planning does not write application code.

Move to implementation only when the change is understood: what it does, what it
touches, how it will be verified, and who owns it.

---

## Change tiers

Apply the lightest tier that fits. When uncertain between two tiers, use the heavier.

| Tier | Examples | Required |
|---|---|---|
| **Trivial** | Copy text, colors, spacing, config values | Branch + PR. No issue, no Plan Mode. |
| **Standard** | New screen, new field, non-structural fix | Issue claimed, branch, plan approved, PR |
| **Structural** | Auth, permissions, data model, migrations, integrations, personal data, production config, new dependency | Standard tier **plus** mandatory IT sign-off. See `IT_PARTNER.md`. |

Structural work cannot be self-merged. This is not waivable by the SME.

---

## Before any application code

0. The brief must be approved, and where the project has a `BACKLOG.md`, the plan
   must be approved too. Both gates precede all application code.
1. Sync with GitHub.
2. Check open issues, PRs, branches, and worktrees for duplicate or overlapping work.
3. Select or create the task; claim it (Standard and Structural tiers).
4. Record affected modules, business rules, data, and interfaces.
5. Create a branch. Use a worktree for parallel or interrupted work.
6. Record the task and tier in `.buildos.json`.

Either SME or IT partner may build. Neither edits `main` directly.

---

## Always-on rules

- Never develop directly on `main` or `master`.
- Never force-push, rewrite history, delete a branch or worktree, or deploy to
  production without explicit approval in the current session.
- Never commit secrets, keys, tokens, or `.env` files.
- Never weaken, skip, or delete a test to obtain a green result.
- A skipped check is not a passed check.
- One responsibility per file.
- Do not copy the same rule or constant into a third location. Centralize it.
- Prefer the simplest design that meets the approved need. No services,
  abstractions, or packages without demonstrated purpose.
- A material decision that exists only in chat is not recorded. Append it to
  `docs/build/DECISIONS.md`.

Hooks enforce several of these mechanically. A blocked hook is not an obstacle to
work around — stop and tell the SME what was blocked and why.

---

## Read the detailed rule when the work touches it

Do not load these upfront. Read the file when the work begins.

| Starting work on | Read |
|---|---|
| Branching, merging, releases, rollback | `.buildos/rules/git-safety.md` |
| Auth, permissions, personal data, external input, secrets | `.buildos/rules/security-privacy.md` |
| Tests, QA gates, test data | `.buildos/rules/testing.md` |
| Architecture, file structure, dependencies | `.buildos/rules/structure.md` |
| Screens, components, visual design | `.buildos/rules/brand-ux.md` |
| Editing a Build OS file, or releasing a version | `.buildos/rules/build-os-updates.md` |
| Any code at all — stack conventions | `.buildos/rules/tech-stack.md` |
| Colors, fonts, spacing, components | `.buildos/rules/design-system.md` |
| Creating the first application files | `.buildos/rules/project-structure.md` |

---

## Settled — do not re-ask the SME

**Stack** (IT-approved): Laravel · MySQL · React Native · React · REST · Sanctum.
Anything else is a Structural decision requiring IT sign-off.

**Design**: Bell-Kenz palette and Inter type scale are fixed. Import tokens from
`.buildos/design/`. Never ask for a color palette or font choice again.

`#49A25A` is the logo green and fails contrast with white text. Use `#387B44` or
darker for buttons, links, and anything carrying text.

---

## Portfolio architecture — the standard above this one

`ARCHITECTURE.md` in the `Bell-Kenz-Pharma-Inc/BK-Portfolio-Architecture-Standards`
repository is the governing standard for system boundaries, master data ownership,
and integration contracts across all Bell-Kenz systems. Where it and a project's
own design disagree, the portfolio standard wins — or the standard changes
deliberately, recorded there, never by local drift.

The repository is named in `.buildos.json` under `portfolio.standardsRepo`. The
`architecture-reviewer` agent checks plans against it — the reviewer gate table
below says when.

## Skills — use them, don't improvise

| Situation | Skill |
|---|---|
| Start or continue a project | `start` |
| SME asks to build, add, fix, or change something | `claim-task` |
| Implementation finished, ready to ship | `ship-task` |
| End of session, or after significant work | `sync` |
| SME asks to run several already-decided tasks in one go | `run-tasks` |
| An endpoint, resource, service layer, or screen changed | `check-connections` |
| SME asks to update Build OS in a project | `update-build-os` |

`run-tasks` loops `claim-task` and `ship-task`. It does not replace them and does
not relax a single gate. Batched work is unattended work — it needs the gates more,
not less.

---

## Reviewer agents — required, not optional

Agents report findings. They do not edit files. Run them at these gates:

| Gate | Agents |
|---|---|
| Planning, before approval | `requirements-auditor`, `overlap-detector` |
| Planning, when the plan touches the data model, migrations, shared entities, or integrations | `architecture-reviewer` |
| After implementation | `code-quality-reviewer`, `regression-reviewer` |
| Auth, permissions, personal data, external input, secrets, integrations, production config | `security-reviewer` |
| Screens, components, or flows changed | `ux-consistency-reviewer` |
| Before merge or release | `records-auditor` |

Findings marked blocking or must-fix are resolved before a PR is declared ready.
Report unresolved findings to the SME rather than quietly accepting them.

Parallel work uses separate tasks, branches, and preferably worktrees. Do not let
multiple agents or people silently modify the same area.

---

## Prototypes

Check `prototype/` at session start. Anything the SME placed there — mockups,
screenshots, spreadsheets, sample reports, process notes — is discovery material.

A prototype is **input to the brief, not the foundation of the build.** Read it,
extract screens, fields, flows, and implied roles into
`docs/build/PROJECT_BRIEF.md`, confirm your reading with the SME, then design
properly against the standard. Never extend prototype code into production code.

Ignore `prototype/README.md` — it is instructions for the SME, not content.

---

## Records

Records live in `docs/build/`, generated from `.buildos/templates/` at project start
and kept current thereafter. Every template is created at init, even if empty — an
empty record file is a visible prompt; a missing one is invisible.

`RUN_REPORTS.md` holds one appended section per batch run of `run-tasks`, including
halted runs — where the record of why it stopped is the point.

`BACKLOG.md` is the build plan: every task, ordered, tiered, with what it depends on.
Generated from the approved brief, then kept current. It is the **only** task list —
`Next steps` in `PROJECT_STATUS.md` points at it rather than duplicating it.

A backlog row is a plan, not a build permit. `claim-task` runs in full for every row.

The ID and status rules live in the template header — including what ☑ means and why
it is not set when a pull request opens. Read them there before writing a row.

Update `PROJECT_STATUS.md` at the end of every working session.
Append to `DECISIONS.md` the moment a decision is made. Never delete historical rows.

---

## Stuck rule

After three failed attempts at the same fix, stop. Report what was tried, what
failed, and the current hypothesis. Escalate to the IT partner. Do not continue
iterating.

---

## VSG Build OS updates

This kit is versioned (`buildOsVersion` in `.buildos.json`) and distributed as a
GitHub template repository. Workflow changes require project-owner approval and a
recorded version bump.

Improvements flow one way: **Build OS → projects, never the reverse.** A Build OS
file edited inside a project is silently overwritten at the next update, and the fix
is lost for every other project. Fix it upstream, bump the version, pull it down.

`.buildos/MANIFEST.json` records which paths are Build OS owned (replaced), project
owned (never touched), and field-merged (`.buildos.json` only — it holds kit and
project settings together). The `update-build-os` skill applies an update from
`updateSource` and shows everything it would replace before touching anything.

Full rule: `.buildos/rules/build-os-updates.md`.
