Skip to content

CLI Commands

Generate architecture context for AI coding agents. Reads your verikt.yaml and outputs rules, dependency constraints, and anti-patterns that AI agents consume before writing code.

Terminal window
verikt guide [flags]
FlagDescriptionDefault
--targetAI tool target (all, claude, cursor, copilot, windsurf)all
--pathPath to project.
--outputOutput format (terminal, file)terminal
Terminal window
# Generate context for any AI agent
verikt guide
# Target Claude Code specifically
verikt guide --target claude
# Target Cursor
verikt guide --target cursor

Scaffold a new project.

Terminal window
verikt new [name] [flags]
FlagDescriptionDefault
--nameProject/service namepositional arg
--archArchitecture pattern (hexagonal, flat)hexagonal
--capCapabilities (comma-separated)none
--moduleGo module pathexample.com/<name>
--output-dirOutput directory.
--no-wizardDisable interactive wizardfalse
--setTemplate variable (key=value), repeatablenone
--languageProject languagego

By default, verikt runs go env GOVERSION to detect the installed Go version. The detected version is used to resolve feature flags from the provider’s feature matrix — enabling modern stdlib APIs and language features in the generated code.

You can override the detected version with --set GoVersion=X.XX. This is useful in CI environments or when targeting a specific Go version different from the one installed locally.

Terminal window
# Use detected Go version (default)
verikt new my-service --language go --no-wizard
# Target a specific Go version
verikt new my-service --language go --set GoVersion=1.24 --no-wizard

See the Feature Matrix for the full list of version-gated features.

Terminal window
# Interactive wizard — guides you through every choice
verikt new my-service --language go
# Non-interactive with all options
verikt new my-service \
--language go \
--arch hexagonal \
--cap platform,bootstrap,http-api,mysql,docker \
--module github.com/myorg/my-service \
--no-wizard
# Target Go 1.24 features explicitly
verikt new my-service --language go --set GoVersion=1.24 --no-wizard

Validate a project against its verikt.yaml rules.

Terminal window
verikt check [flags]
FlagDescriptionDefault
--pathPath to project.
--outputOutput format (terminal, json)terminal

Test files (_test.go) are excluded from every check, including dependency rules. A test reaches across layers to assemble a fixture, so counting its imports reports violations for code that is not part of the architecture. The consequence is worth knowing before you design around it: an import that only exists in a test will not be flagged.

Generated files are excluded. A file carrying Go’s // Code generated ... DO NOT EDIT. marker before its package clause is skipped — regenerating it would restore any finding, so the finding is not actionable.

Nested modules are excluded. A directory with its own go.mod is a different project; its packages belong to that module’s import path. Point --path at it to analyse it on its own.

verikt runs 14 AST-based detectors:

  • Dependency violations — imports that cross component boundaries
  • Required directories — components with missing directories
  • Forbidden directories — directories that shouldn’t exist
  • Function complexity — functions exceeding line/param/return limits
  • Component coverage — percentage of components with source files
  • Anti-patterns — common architectural violations
CodeMeaning
0No error-severity violations. Warnings may be present.
1An error-severity violation was found, or a proxy rule could not run

Warnings never affect the exit code, so a finding you have chosen to live with cannot block a pipeline. The exit code is the same in every output format — --output json reports the same verdict it prints.

A proxy rule whose scope matches no files is reported as stale and fails the check: a rule that did not run has not passed. A rule that ran and found nothing is passing, not stale.

Any finding can be waived with severity_overrides, anti-patterns included. A waiver requires a reason, so the justification lands in the diff where a reviewer sees it:

severity_overrides:
god_package:
- severity: ignore
reason: "the shared domain vocabulary; 27 types + 15 constants, nothing to trim"
paths: ["internal/core/**"]

Waived findings are still reported, in a WAIVED section and in the waived[] array of the JSON output, and they do not affect the exit code. A finding that disappeared entirely would be indistinguishable from one the detector never found.

--output json emits a schema_version field. Check it before parsing — key names are stable within a version, not across them.

violations[], anti_patterns[] and waived[] are always present and always arrays, so they are safe to iterate on a passing project.

{
"schema_version": 2,
"result": "fail",
"violations": [
{ "severity": "error", "file": "domain/order.go", "rule": "dependency", "message": "..." }
],
"anti_patterns": [
{ "severity": "error", "name": "sql_concatenation", "file": "repo/db.go", "message": "..." }
],
"waived": [
{ "category": "anti_pattern", "rule": "god_package", "file": "internal/core", "reason": "..." }
]
}

To gate a pipeline, read result:

Terminal window
verikt check --output json > verikt.json
jq -e '.result == "pass"' verikt.json

result is the same verdict the exit code carries, so gating on either is equivalent — and it accounts for every category. Selecting on severity across violations[] and anti_patterns[] does not: those two arrays hold the built-in detector findings only. An error-severity proxy-rule violation lives in proxy_rules.violations[], a rule that could not run appears only in proxy_rules.statuses[], and decision-gate failures are in decision_violations[]. A gate built from the two top-level arrays passes on all three.

To count findings by severity — for a debt report rather than a gate — include every source:

Terminal window
jq '[(.violations // [])[], (.anti_patterns // [])[], (.proxy_rules.violations // [])[]]
| group_by(.severity) | map({severity: .[0].severity, count: length})' verikt.json
verikt check
Architecture: hexagonal
Components: 4 defined
Dependency Violations: 0
Structure Issues: 0
Function Issues: 0
Component Coverage: 100% (4/4)
Compliance: 100%
✓ All checks passed

Analyze an existing project’s architecture.

Terminal window
verikt analyze [flags]
FlagDescriptionDefault
--pathPath to project.
--outputOutput format (terminal, json)terminal

Add one or more capabilities to an existing project.

Terminal window
verikt add <capability> [capability...] [flags]

Capabilities are validated against the provider’s templates, conflicts are checked, and transitive dependencies are auto-resolved. Existing files are never overwritten — only new files are created.

FlagDescriptionDefault
--dry-runShow what would be added without writing any filesfalse

--dry-run reports the files it would create and which capabilities it would resolve, and leaves verikt.yaml and the generated guides untouched.

  1. Finds verikt.yaml in the current directory
  2. Validates that each capability exists and doesn’t conflict
  3. Auto-resolves transitive dependencies (e.g., bff pulls in http-api)
  4. Renders only new capability files, skipping any that already exist on disk
  5. Updates verikt.yaml with the new capabilities
  6. Regenerates verikt guide output
Terminal window
# Add a single capability
verikt add redis
# Add multiple capabilities at once
verikt add kafka-consumer observability
# Add a capability with transitive deps
verikt add bff # auto-adds http-api if not present
Adding capabilities:
+ http-api (auto-dependency)
+ bff
Created: adapter/httphandler/handler.go
Created: adapter/httphandler/router.go
Skipped (exists): config/config.go
Done: 5 files created, 1 files skipped, 2 capabilities added
Auto-resolved dependencies: http-api

Show structural drift between verikt.yaml and files on disk. Like terraform plan for code architecture.

Terminal window
verikt diff [flags]
FlagDescriptionDefault
--pathProject path to diff.
-o, --outputOutput format (terminal, json, markdown)terminal

For each capability declared in verikt.yaml, diff checks whether the expected files exist:

StatusMeaning
okAll expected files are present
partialSome files present, some missing
missingAll expected files are missing

The drift score (0.00 = perfect, 1.00 = completely drifted) tells you how far reality has diverged from the declared architecture.

Terminal window
# Check drift in current project
verikt diff
# Check a specific project
verikt diff --path ./my-service
# Get JSON output for CI
verikt diff -o json
verikt Diff — hexagonal + 4 capabilities
═══════════════════════════════════════════════════════
✓ architecture all files present
✓ http-api all files present
✗ redis 2 missing files
- adapter/redisrepo/connection.go
- adapter/redisrepo/repository.go
✓ docker all files present
═══════════════════════════════════════════════════════
Summary: 3/4 capabilities fully present | drift score: 0.12

Initialize an verikt.yaml for an existing project.

Terminal window
verikt init [flags]
FlagDescriptionDefault
--pathPath to project.
--no-wizardSkip interactive wizardfalse
--forceOverwrite existing verikt.yamlfalse

Print version, commit hash, and build date.

Terminal window
verikt version
verikt version 1.0.0
commit: 6d22600
built: 2026-03-11T12:00:00Z

These flags are available on all commands:

FlagDescriptionDefault
--no-colorDisable colored outputfalse
-o, --outputOutput format (terminal, json, markdown)terminal