agentleFS
prasad-vennamprasad-vennam/Awesome-Android-AI-Agent-Skills/skills/android-ktlint-formatting/SKILL.md

android-ktlint-formatting

Skill11 starsChanged 8 months agoMITView on GitHub

Use when formatting Kotlin code, enforcing the Android style guide, or configuring KtLint for Android.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    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
  1. Distinctive:

    Use 4 spaces for indentation.

    line 30
  2. Distinctive:

    No TAB characters allowed.

    line 31
  3. Distinctive:

    Follow "Continuation Indents" for long method calls (8 spaces).

    line 32
  4. Very specific:

    Rule: Avoid wildcard imports (import com.example.*).

    line 35
  5. Distinctive:

    NO trailing whitespace at the end of lines.

    line 41
  6. Distinctive:

    NO multiple blank lines.

    line 42
  7. Distinctive:

    Rule: ALWAYS run this before committing if formatting changes are extensive.

    line 58
  8. Very specific:

    Ensure your project has a .editorconfig that KtLint reads:

    line 65

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Android KtLint Formatting Excellence 🧹💎

Standardized formatting rules for Android developers based on the official Kotlin and Android Style Guides.

⚡ When to Use

  • Code Cleanup: Automatically reformatting messy files.
  • Pre-commit Audit: Ensuring the code is perfectly formatted before pushing.
  • CI/CD Configuration: Setting up a gatekeeper for code style.
  • New Project Setup: Initializing a project with the correct .editorconfig.

🏗️ Core Rules (Android Style)

1. Indentation

  • Use 4 spaces for indentation.
  • No TAB characters allowed.
  • Follow "Continuation Indents" for long method calls (8 spaces).

2. Imports

  • Rule: Avoid wildcard imports (import com.example.*).
  • Order alphabetically.
  • Group by java.*, kotlin.*, then external libraries.

3. Blank Lines

  • Single blank line between classes, properties, and methods.
  • NO trailing whitespace at the end of lines.
  • NO multiple blank lines.

4. Naming

  • Classes/Interfaces: PascalCase.
  • Properties/Variables: camelCase.
  • Functions: camelCase.
  • Constants: SCREAMING_SNAKE_CASE.

🛠️ Essential Commands

Check Formatting

./gradlew ktlintCheck

Auto-Fix Formatting

  • Rule: ALWAYS run this before committing if formatting changes are extensive.
./gradlew ktlintFormat

📜 Configuration (.editorconfig)

Ensure your project has a .editorconfig that KtLint reads:

[*.{kt,kts}]
indent_size=4
insert_final_newline=true
max_line_length=120
ij_kotlin_allow_trailing_comma=true

🚀 Performance & Tips

  • IDE Integration: Install the "KtLint" or "Kotlin" plugin and enable "On Save" actions.
  • Trailing Comma: Use trailing commas for all multi-line collections and arguments for better diffs.
  • Imports Cleanup: Periodically run Alt+Enter → "Optimize Imports".

🧪 Verification Checklist

  • No Wildcards: All imports are explicit.
  • No Tabs: Only spaces.
  • EndOfLine: File ends with exactly one newline.
  • No Redundant Semicolons: Clean up all unnecessary ;.

🔗 Related Resources

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.