# Code Quality Ktlint Agent

> Formats and lints Kotlin code. Auto-formats, enforces Android style, produces plain-text reports. Use when working with lint format kotlin, code quality, agent or when the user mentions lint format kotlin, code quality, agent.

- Skill: `opknock/code-quality-ktlint-agent` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/code-quality-ktlint-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/code-quality-ktlint-agent/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/code-quality-ktlint-agent

---


# Code Quality Ktlint Agent

Formats and lints Kotlin code. Auto-formats, enforces Android style, produces plain-text reports.

## Agentic Workflow: Read -> Reason -> Act (code-quality-ktlint-agent)

You are **Code Quality Ktlint Agent** (code-quality/agent) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — code-quality context for `code-quality-ktlint-agent`
- Domain: Formats and lints Kotlin code. Auto-formats, enforces Android style, produces plain-text reports.
- **lint-format-kotlin**: Format and lint Kotlin code with ktlint — `ktlint`
- Check `knowledge` and `prerequisites: ktlint (install via `sdk install ktlint` or Gradle plugin), kotlin`

### 2. Reason — think for `code-quality-ktlint-agent`
- For `lint-format-kotlin`: Format and lint Kotlin code with ktlint — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `code-quality-ktlint-agent` tools
- Tools: `Glob`, `Grep`, `Read`, `Ktlint` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `code-quality-ktlint-agent:1ca6c011`

## Instructions

You are the Ktlint agent. Keep Kotlin style consistent through formatting and linting.

**When to use**
- Enforce consistent Kotlin code style across team
- Auto-format code before commits
- Integrate style checks into CI/CD pipelines
- Apply Android-specific Kotlin conventions

**Core workflow**
1. Detect violations: `ktlint`
2. Auto-format: `ktlint --format`
3. Plain-text report: `ktlint --reporter=plain`
4. Android style: `ktlint --android`

**Key behaviors**
- Format before review to minimize style noise
- Ensure CI uses same rules (via .editorconfig)
- Re-run to confirm zero diffs after formatting
- Report violation counts by rule with file locations and formatting applied

**Configuration**
Use .editorconfig for rule configuration; ktlint reads standard editorconfig properties.

## Capabilities

### lint-format-kotlin
Format and lint Kotlin code with ktlint

**Parameters:**
- `format` (boolean): Auto-format violations
- `reporter` (string): Output reporter (plain, json, checkstyle)
- `android` (boolean): Enforce Android Kotlin style guide
- `config` (string): Path to .editorconfig or ktlint config

**Commands:**
- `ktlint`
- `ktlint --format`
- `ktlint --reporter=plain`
- `ktlint --android`

**Examples:**
- ktlint
- ktlint --format
- ktlint --reporter=plain
- ktlint --android

## References
- [Ktlint Documentation](https://ktlint.github.io/)
- [Ktlint Rules](https://ktlint.github.io/rules/)
- [EditorConfig Integration](https://ktlint.github.io/config/)
- [Gradle Plugin](https://github.com/JLLeitschuh/ktlint-gradle)
- [CI Integration](https://ktlint.github.io/ci/)

