# Android Lint And Quality

> Use when setting up static analysis, enforcing coding standards, or configuring Detekt/KtLint for Android.

- **Type:** Skill
- **Install:** `agentstack add skill-prasad-vennam-awesome-android-ai-agent-skills-android-lint-and-quality`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [prasad-vennam](https://agentstack.voostack.com/s/prasad-vennam)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [prasad-vennam](https://github.com/prasad-vennam)
- **Source:** https://github.com/prasad-vennam/Awesome-Android-AI-Agent-Skills/tree/main/skills/android-lint-and-quality

## Install

```sh
agentstack add skill-prasad-vennam-awesome-android-ai-agent-skills-android-lint-and-quality
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Android Code Quality & Linting 🧹🛡️

Professional strategies for enforcing team standards and preventing technical debt through automated static analysis.

## ⚡ When to Use
- **Code Review Readiness**: Automatically checking Pull Requests for common errors.
- **Enforcing Style**: Ensuring all developers follow the same Kotlin formatting.
- **Complex Bug Prevention**: Using custom Lint rules to catch project-specific issues.
- **CI/CD Automation**: Failing builds on logic or style violations.
- **Gradual Refactoring**: Deprecating legacy methods and encouraging migration.

## 🏗️ The 3 Layers of Analysis

### 1. Android Lint (Built-in)
- **Rules**: Catch memory leaks, missing accessibility labels, and incorrect resource usages.
- **Customization**: Use `lint-rules` module to write your own rules specific to your app architecture.

### 2. Detekt (Core Logic Static Analysis)
- **Benefit**: Checks for code smells (Long methods, deep nested loops, cognitive complexity).
- **Gradle Task**: `./gradlew detekt`

### 3. KtLint (Formatting)
- **Benefit**: Focuses purely on coding style (Indentation, line length, spacing).
- **Rule**: Follow the **Official Android Kotlin Style Guide**.
- **Gradle Task**: `./gradlew ktlintCheck` / `./gradlew ktlintFormat`

## 🚀 Quality Enforcement Checklist

- [ ] **Fail Fast**: Set `abortOnError = true` in Gradle to ensure bad code never stays in the repo.
- [ ] **Custom Rules**: For example: "No `Log.d` allowed in production" or "All ViewModels must inherit from `BaseViewModel`".
- [ ] **Baseline Files**: Use `baseline.xml` to ignore existing issues in older code and only enforce rules on new changes.

## 🛠️ Configuration Example

```kotlin
// build.gradle.kts
lint {
    isWarningsAsErrors = true
    isAbortOnError = true
    xmlReport = true
    htmlReport = true
}

detekt {
    buildUponDefaultConfig = true
    allRules = false
    config = files("$projectDir/config/detekt.yml")
}
```

## 📐 Team Policy Best Practices

- **Pre-commit Hooks**: Use `Git Hooks` to run KtLint locally before pushing.
- **CI Report Annotation**: Configure CI (e.g., GitHub Actions) to comment directly on PR lines with Lint/Detekt findings.
- **Quality Gates**: Maintain a score using tools like **SonarQube** or **Codecov**.

## 🧪 Testing Your Quality Setup

- **Lint Tests**: Use `LintDetectorTest` to verify that your custom rules actually catch what they should.
- **Baseline Evolution**: Regularly review and clean up baseline files to pay down technical debt.

## 🔗 Related Resources
- [Android Lint Official Guide](https://developer.android.com/studio/write/lint)
- [Detekt Documentation](https://detekt.dev)
- [KtLint Documentation](https://pinterest.github.io/ktlint)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [prasad-vennam](https://github.com/prasad-vennam)
- **Source:** [prasad-vennam/Awesome-Android-AI-Agent-Skills](https://github.com/prasad-vennam/Awesome-Android-AI-Agent-Skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-prasad-vennam-awesome-android-ai-agent-skills-android-lint-and-quality
- Seller: https://agentstack.voostack.com/s/prasad-vennam
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
