Skip to content

Claude Code Integration

One command makes any repository Claude-ready:

sentrik claude-init

After this, start claude in the repo and it knows Sentrik: it can interview you to set up the right standards packs, gets scan feedback after every file edit, and reaches for sentrik gate instead of guessing what would block your commit.

What claude-init generates

Artifact Purpose
.claude/skills/sentrik/SKILL.md A project skill teaching Claude the Sentrik workflow: onboarding interview, pack catalog, fixing findings, suppressions with justification, and custom pack authoring
.mcp.json Registers the Sentrik MCP server (merged — never clobbers other servers you have configured)
CLAUDE.md A short always-in-context section between sentrik:begin/sentrik:end markers, so Claude knows the repo is governed even before loading the skill
.claude/settings.json A PostToolUse hook that scans every file Claude edits and feeds new findings straight back into the conversation (skip with --no-hooks)

Everything is idempotent: re-running claude-init refreshes generated content and leaves your own files and settings untouched. Enabling or disabling packs (via CLI or the MCP manage_pack tool) automatically refreshes the skill and CLAUDE.md section so they never contradict your config.

The onboarding interview

In a repo where Sentrik isn't configured yet, tell Claude:

set up sentrik for this project

Claude interviews you briefly — what the project does, whether it handles sensitive data (health, payment, personal), any regulatory context, where enforcement should happen — skipping anything already obvious from the code. It then enables the right standards packs via the MCP suggest_packs and manage_pack tools, runs a first scan, and explains the results, separating code defects from system-level documentation obligations.

Scan-on-edit feedback

The installed hook runs sentrik claude-hook post-edit after every Edit/Write. It scans just the touched file and, when there are findings, returns them to Claude as additional context:

Sentrik found 2 issue(s) in src/token.py after this edit:
- [high] OWASP-A02-001:3: no-md5-hashing: MD5 is cryptographically broken...
- [high] PY-SEC-009:3: no-weak-hash: MD5 and SHA1 must not be used...

Clean edits stay silent. The hook always exits 0 — a scan hiccup never blocks an edit — and respects your enabled packs and exclusions. This is deterministic, engine-verified feedback at generation time, not the model remembering to be careful.

First-run hint

If Sentrik detects Claude Code (a .claude/ directory or CLAUDE.md in the repo, or Claude installed on the machine) but claude-init hasn't been run, sentrik scan prints a one-time reminder. It appears once per repository.

Options

sentrik claude-init              # all artifacts, including the hook
sentrik claude-init --no-hooks   # skip the scan-on-edit hook
sentrik claude-init --path DIR   # target a different repository root

See also