- Use ktlint for formatting and detekt for static analysis. Configure detekt in `detekt.yml`.
- Run `ktlint --format` for auto-formatting. Run `detekt` in CI for code smells.
- Run `ktlint --format` to auto-fix style issues — configure with `.editorconfig` and disable rules selectively with `ktlint_disabled_rules`.
- Configure ktlint with `.editorconfig` for formatting preferences (indent, max line length).
- Use detekt's `complexity` rule set to flag long functions, large classes, and deep nesting.
- Use `@Suppress("detekt:RuleName")` for intentional suppressions with comments explaining why.
- Run both tools in CI: `ktlint --check` and `detekt --build-upon-default-config`.