android-lint-and-quality
Skill11 starsChanged 8 months agoMITView on GitHub
Use when setting up static analysis, enforcing coding standards, or configuring Detekt/KtLint for Android.
In this repository40 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- android-accessibilitySkill
- android-adaptive-layoutsSkill
- android-adb-terminalSkill
- android-background-executionSkill
- android-bluetooth-bleSkill
- android-build-verificationSkill
- android-camerax-mlkitSkill
- android-ci-cd-expertSkill
- android-clean-architectureSkill
- android-code-review-expertSkill
- android-coroutines-expertSkill
- android-custom-drawing-canvasSkill
- android-design-system-m3Skill
- android-design-to-codeSkill
- android-detekt-expertSkill
- android-enterprise-securitySkill
- android-gemini-nanoSkill
- android-google-workspace-expertSkill
- android-gradle-expertSkill
- android-hardware-testingSkill
- android-jetpack-composeSkill
- android-kmp-compose-uiSkill
- android-kmp-platform-channelsSkill
- android-kmp-sharedSkill
- android-ktlint-formattingSkill
- android-local-stt-ttsSkill
- android-location-mapsSkill
- android-macrobenchmarkSkill
- android-media3-exoplayerSkill
- android-media-and-image-expertSkill
- android-motion-animationsSkill
- android-navigation-expertSkill
- android-offline-firstSkill
- android-performance-auditSkill
- android-rag-localSkill
- android-screenshot-testingSkill
- android-security-hardenedSkill
- android-unit-testingSkill
- android-wear-os-composeSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Customization: Use lint-rules module to write your own rules specific to your app architecture.
- Distinctive: line 40
Rule: Follow the Official Android Kotlin Style Guide.
- Distinctive: line 69
Pre-commit Hooks: Use Git Hooks to run KtLint locally before pushing.
- Very specific: line 75
Lint Tests: Use LintDetectorTest to verify that your custom rules actually catch what they should.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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-rulesmodule 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 = truein Gradle to ensure bad code never stays in the repo. - Custom Rules: For example: "No
Log.dallowed in production" or "All ViewModels must inherit fromBaseViewModel". - Baseline Files: Use
baseline.xmlto ignore existing issues in older code and only enforce rules on new changes.
🛠️ Configuration Example
// 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 Hooksto 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
LintDetectorTestto 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
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

