Code quality setup
Formatter automation model
The repository formatter runs across three layers (obligation:
engineering-standards):
- Editor/agent edit flows format in write mode immediately after
creating or modifying formatter-managed files.
- Pre-commit hooks format changed files in write mode and stage
the result.
- CI runs formatter checks in check-only mode and fails on drift,
without writing, committing, or otherwise mutating the repo.
GitHub Actions runtime currency
Keeping JavaScript actions on GitHub's current GA Node major
(obligation: engineering-standards) uses this migration
procedure:
- During a window where the runner default is an older major, set
GitHub's documented workflow-scope opt-in variable. For the
Node 20 to Node 24 migration, set
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" under top-level
workflow env.
- Once the newer major becomes the runner default, remove the
opt-in variable in the same change set that updates the workflow.
Per-language toolchain
Use the standard toolchain for each language in the repository.
JavaScript / TypeScript (incl. React/Next)
- Format and lint: ESLint + Prettier.
- When configuring Prettier, the agent MUST add and maintain
.prettierignore so generated/build outputs and composed files
are not formatted/linted as source (e.g., dist/, build
artifacts, and AGENTS.md when generated by compose-agentsmd).
- Typecheck:
tsc with strict settings for TS projects.
- Dependency scan:
osv-scanner. If unsupported, use the package
manager's audit tooling.
Python
- Format and lint: Ruff.
- Typecheck: Pyright.
- Dependency scan: pip-audit.
Go
- Format: gofmt.
- Lint and static analysis: golangci-lint (includes staticcheck).
- Dependency scan: govulncheck.
Rust
- Format: cargo fmt.
- Lint and static analysis: cargo clippy with warnings as errors.
- Dependency scan: cargo audit.
Java
- Format: Spotless + google-java-format.
- Lint and static analysis: Checkstyle + SpotBugs.
- Dependency scan: OWASP Dependency-Check.
Kotlin
- Format: Spotless + ktlint.
- Lint and static analysis: detekt.
- Compiler: enable warnings-as-errors in CI. If impractical, the
agent MUST get explicit user approval before relaxing.
C#
- Format: dotnet format (verify-no-changes in CI).
- Lint and static analysis: enable .NET analyzers; treat warnings
as errors; enable nullable reference types.
- Dependency scan:
dotnet list package --vulnerable.
C++
- Format: clang-format.
- Lint and static analysis: clang-tidy.
- Build: enable strong warnings and treat as errors. Run
sanitizers (ASan/UBSan) in CI where supported.
PowerShell
- Format and lint: PSScriptAnalyzer (Invoke-Formatter +
Invoke-ScriptAnalyzer).
- Runtime:
Set-StrictMode -Version Latest. Fail fast on errors.
- Tests: Pester when tests exist.
- The agent MUST enforce PSScriptAnalyzer via the repo's standard
verify command or script when PowerShell is used. Findings
MUST be treated as errors.
Shell (sh/bash)
- Format: shfmt.
- Lint: shellcheck.
Dockerfile
Terraform
- Format: terraform fmt -check.
- Validate: terraform validate.
- Lint: tflint.
- Security scan: trivy config.
YAML
Markdown
Design and visual accessibility automation
Apply this section to projects with web UI components only.
- The agent MUST enforce automated visual accessibility checks as
part of the repo-standard
verify command and CI.
- The agent MUST use route discovery (sitemap, generated route
lists, or framework route manifests) so newly added pages are
automatically included.
- The agent MUST validate both light and dark themes when theme
switching is supported.
- The agent MUST validate at least default, hover, and focus
states for interactive elements.
- The agent MUST enforce non-text boundary contrast checks across
all visible UI elements that present boundaries (including
interactive controls and container-like elements), not only
predefined component classes.
- The agent MUST use broad DOM discovery with only minimal
technical exclusions (hidden, zero-size, or non-rendered nodes).
- CI MUST fail on violations. The agent MUST NOT silently ignore
design regressions.
- If temporary exclusions are unavoidable, the agent MUST keep
them narrowly scoped, MUST document the rationale, and MUST
remove them promptly.
Security baseline
- The agent MUST require dependency vulnerability scanning
appropriate to the ecosystem (SCA) for merges. If unavailable,
the agent MUST report the limitation and get explicit user
approval.
- The agent MUST enable GitHub secret scanning and remediate
findings. The agent MUST NOT commit secrets. If GitHub secret
scanning is unavailable, the agent MUST add a repo-local secret
scanner.
- The agent MUST enable CodeQL code scanning for supported
languages. If unavailable, the agent MUST use the best
alternative for that ecosystem.
1---2name: code-quality-setup3description: Use when setting up or configuring code quality tools (formatters, linters, type checkers, dependency scanners) for a repository. Also use when adding visual accessibility automation or security baseline scanning. Do not use for general coding or when tools are already configured.4---56# Code quality setup78## Formatter automation model910The repository formatter runs across three layers (obligation:11`engineering-standards`):12131. Editor/agent edit flows format in write mode immediately after14 creating or modifying formatter-managed files.152. Pre-commit hooks format changed files in write mode and stage16 the result.173. CI runs formatter checks in check-only mode and fails on drift,18 without writing, committing, or otherwise mutating the repo.1920## GitHub Actions runtime currency2122Keeping JavaScript actions on GitHub's current GA Node major23(obligation: `engineering-standards`) uses this migration24procedure:2526- During a window where the runner default is an older major, set27 GitHub's documented workflow-scope opt-in variable. For the28 Node 20 to Node 24 migration, set29 `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"` under top-level30 workflow `env`.31- Once the newer major becomes the runner default, remove the32 opt-in variable in the same change set that updates the workflow.3334## Per-language toolchain3536Use the standard toolchain for each language in the repository.3738### JavaScript / TypeScript (incl. React/Next)3940- Format and lint: ESLint + Prettier.41- When configuring Prettier, the agent MUST add and maintain42 `.prettierignore` so generated/build outputs and composed files43 are not formatted/linted as source (e.g., `dist/`, build44 artifacts, and `AGENTS.md` when generated by `compose-agentsmd`).45- Typecheck: `tsc` with strict settings for TS projects.46- Dependency scan: `osv-scanner`. If unsupported, use the package47 manager's audit tooling.4849### Python5051- Format and lint: Ruff.52- Typecheck: Pyright.53- Dependency scan: pip-audit.5455### Go5657- Format: gofmt.58- Lint and static analysis: golangci-lint (includes staticcheck).59- Dependency scan: govulncheck.6061### Rust6263- Format: cargo fmt.64- Lint and static analysis: cargo clippy with warnings as errors.65- Dependency scan: cargo audit.6667### Java6869- Format: Spotless + google-java-format.70- Lint and static analysis: Checkstyle + SpotBugs.71- Dependency scan: OWASP Dependency-Check.7273### Kotlin7475- Format: Spotless + ktlint.76- Lint and static analysis: detekt.77- Compiler: enable warnings-as-errors in CI. If impractical, the78 agent MUST get explicit user approval before relaxing.7980### C\#8182- Format: dotnet format (verify-no-changes in CI).83- Lint and static analysis: enable .NET analyzers; treat warnings84 as errors; enable nullable reference types.85- Dependency scan: `dotnet list package --vulnerable`.8687### C++8889- Format: clang-format.90- Lint and static analysis: clang-tidy.91- Build: enable strong warnings and treat as errors. Run92 sanitizers (ASan/UBSan) in CI where supported.9394### PowerShell9596- Format and lint: PSScriptAnalyzer (Invoke-Formatter +97 Invoke-ScriptAnalyzer).98- Runtime: `Set-StrictMode -Version Latest`. Fail fast on errors.99- Tests: Pester when tests exist.100- The agent MUST enforce PSScriptAnalyzer via the repo's standard101 `verify` command or script when PowerShell is used. Findings102 MUST be treated as errors.103104### Shell (sh/bash)105106- Format: shfmt.107- Lint: shellcheck.108109### Dockerfile110111- Lint: hadolint.112113### Terraform114115- Format: terraform fmt -check.116- Validate: terraform validate.117- Lint: tflint.118- Security scan: trivy config.119120### YAML121122- Lint: yamllint.123124### Markdown125126- Lint: markdownlint.127128## Design and visual accessibility automation129130Apply this section to projects with web UI components only.131132- The agent MUST enforce automated visual accessibility checks as133 part of the repo-standard `verify` command and CI.134- The agent MUST use route discovery (sitemap, generated route135 lists, or framework route manifests) so newly added pages are136 automatically included.137- The agent MUST validate both light and dark themes when theme138 switching is supported.139- The agent MUST validate at least default, hover, and focus140 states for interactive elements.141- The agent MUST enforce non-text boundary contrast checks across142 all visible UI elements that present boundaries (including143 interactive controls and container-like elements), not only144 predefined component classes.145- The agent MUST use broad DOM discovery with only minimal146 technical exclusions (hidden, zero-size, or non-rendered nodes).147- CI MUST fail on violations. The agent MUST NOT silently ignore148 design regressions.149- If temporary exclusions are unavoidable, the agent MUST keep150 them narrowly scoped, MUST document the rationale, and MUST151 remove them promptly.152153## Security baseline154155- The agent MUST require dependency vulnerability scanning156 appropriate to the ecosystem (SCA) for merges. If unavailable,157 the agent MUST report the limitation and get explicit user158 approval.159- The agent MUST enable GitHub secret scanning and remediate160 findings. The agent MUST NOT commit secrets. If GitHub secret161 scanning is unavailable, the agent MUST add a repo-local secret162 scanner.163- The agent MUST enable CodeQL code scanning for supported164 languages. If unavailable, the agent MUST use the best165 alternative for that ecosystem.