> For the complete documentation index, see [llms.txt](https://triton.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://triton.pharos.ai/instrumentation-skills/setup-standards.md).

# Set Up Standards

The setup-standards skill scaffolds CI checks, a review checklist, and Log\_Level\_\_mdt defaults so Triton instrumentation stays consistent as your org grows.

Instrumenting an org is only half the battle; the other half is keeping it instrumented. The **setup-standards** skill scaffolds the guardrails from [Standards Enforcement](https://triton.pharos.ai/triton-best-practices/standards-enforcement.md) into your repo so regressions get caught by a machine instead of a tired reviewer — the two hard CI rules, the higher-value checks, a short review checklist, and sensible `Log_Level__mdt` defaults.

It writes config, not application code, and it tailors what it generates to the CI system it detects.

{% hint style="info" %}
**Invocation is agent-specific.** In agents that support slash commands (Claude Code, Cursor) you invoke it as `/pharos:setup-standards`; in others you point the agent at this skill. See [Running these in your agent](https://triton.pharos.ai/instrumentation-skills.md#running-these-in-your-agent).
{% endhint %}

## Usage

{% code lineNumbers="true" %}

```bash
/pharos:setup-standards [--ci github|gitlab|bitbucket|generic] [--pmd] [--checklist] [--log-levels]
```

{% endcode %}

| Argument       | Required | Meaning                                                                                         |
| -------------- | :------: | ----------------------------------------------------------------------------------------------- |
| `--ci`         |          | Which pipeline to target. Auto-detected from the repo (e.g. `.github/workflows/`) when omitted. |
| `--pmd`        |          | Also emit PMD rules, not just grep-level checks.                                                |
| `--checklist`  |          | Drop the PR review checklist into the repo (e.g. a pull-request template).                      |
| `--log-levels` |          | Scaffold `Log_Level__mdt` records with per-environment defaults.                                |

## What it generates

### The two hard CI rules

The non-negotiables that are cheap to automate — no `System.debug` in application code, no `Triton.instance` (the removed 1.x singleton). As a grep-level check for the detected pipeline:

{% code lineNumbers="true" %}

```bash
# Fail the build on System.debug in application code (tests excepted)
if grep -rn "System.debug" force-app/main --include=*.cls | grep -v "Test.cls"; then
  echo "❌ System.debug found — use Triton logging instead."
  exit 1
fi

# Fail on any lingering 1.x singleton usage
if grep -rn "Triton\.instance" force-app/main --include=*.cls; then
  echo "❌ Triton.instance is 1.x — migrate to the static API (Triton.log/Triton.t)."
  exit 1
fi
```

{% endcode %}

With `--pmd`, the same two rules are emitted as `RegexRule` entries for your ruleset so they land in the same report as the rest of your static analysis.

### The review checklist

With `--checklist`, it writes the short, actually-usable list from [Standards Enforcement](https://triton.pharos.ai/triton-best-practices/standards-enforcement.md#the-review-checklist) — template set, real taxonomy, honest levels, exceptions logged, flush coverage, context present, transactions correlated — as a PR template so a reviewer just ticks boxes.

### `Log_Level__mdt` defaults

With `--log-levels`, it scaffolds per-environment log-level records so verbosity is tuned by metadata, not code — quiet in production, chatty in a scratch org.

{% hint style="warning" %}
**It won't over-fit your CI.** Following the guidance in [Standards Enforcement](https://triton.pharos.ai/triton-best-practices/standards-enforcement.md#ci-guardrails), the skill only automates checks with crisp true/false answers (`System.debug`, `Triton.instance`). Judgment calls — "is this the right Area?", "should this be `ERROR`?" — stay on the review checklist for humans, not in brittle regexes that cry wolf.
{% endhint %}

## The ratchet

Pair this with [`audit-logging`](https://triton.pharos.ai/instrumentation-skills/audit-logging.md) to turn standards into a one-way ratchet:

1. `audit-logging --fail-on error,debug` runs in CI as a gate.
2. `setup-standards` installs the hard rules so new `System.debug` / `Triton.instance` can't merge.
3. As [`instrument-org`](https://triton.pharos.ai/instrumentation-skills/instrument-org.md) clears each area, the gate holds it clean — gaps can't creep back in.

## Where to go next

* [Standards Enforcement](https://triton.pharos.ai/triton-best-practices/standards-enforcement.md) — the full rationale and the higher-value checks worth building once.
* [Audit Logging Coverage](https://triton.pharos.ai/instrumentation-skills/audit-logging.md) — the read-only report that feeds the CI gate.
* [Taxonomy & Standards](https://triton.pharos.ai/triton-best-practices/taxonomy-and-standards.md) — the vocabulary these checks defend.
* [Legacy Code Logging Rollout](https://triton.pharos.ai/triton-best-practices/legacy-migration.md) — how to enforce on new code first while retrofitting old code gradually.
