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

android-detekt-expert

Skill11 starsChanged 8 months agoMITView on GitHub

Use when performing logic-based static analysis, detecting code smells, or configuring Detekt for Android.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    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. Very specific:

    OptionalUnit: Don't return Unit explicitly.

    line 36
  2. Distinctive:

    UnusedPrivateMember: Delete unused variables and functions.

    line 37
  3. Distinctive:

    RedundantVisibilityModifier: Keep it clean if defaults are sufficient.

    line 38
  4. Distinctive:

    EqualsWithHashCode: Always override both together.

    line 41
  5. Distinctive:

    UnreachableCode: Remove code that can't be executed.

    line 42
  6. Very specific:

    UnsafeCallOnNullableType: Avoid using !! operator.

    line 43
  7. Distinctive:

    Use a custom configuration file to override default thresholds:

    line 63

≈ “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 Detekt Logic Analysis 🧐🔍

Advanced strategies for detecting hidden logic errors, structural flaws, and code debt in Kotlin Android applications.

⚡ When to Use

  • Code Smell Hunting: Identifying long functions, deeply nested loops, or excessive cognitive complexity.
  • Architectural Guardrails: Enforcing rules like "No viewModelScope.launch outside of ViewModels".
  • Naming Enforcement: Ensuring all interfaces end with Interface (if that's the team policy).
  • Refactoring Strategy: Identifying the most "complex" files that need simplification first.
  • CI/CD Quality Gate: Failing a build based on logic violations.

🏗️ Core Categories

1. Complexity

  • TooManyFunctions: Aim for < 11 functions per class.
  • LongMethod: Aim for < 20 lines per function.
  • NestedBlockDepth: Aim for < 4 levels of nesting.

2. Formatting (Logic-Based)

  • OptionalUnit: Don't return Unit explicitly.
  • UnusedPrivateMember: Delete unused variables and functions.
  • RedundantVisibilityModifier: Keep it clean if defaults are sufficient.

3. Potential Bugs

  • EqualsWithHashCode: Always override both together.
  • UnreachableCode: Remove code that can't be executed.
  • UnsafeCallOnNullableType: Avoid using !! operator.

4. Style & Naming

  • ForbiddenMethodCall: Block usage of certain libraries (e.g., java.util.Date in favor of java.time or kotlinx-datetime).
  • ForbiddenImport: Prevent importing internal or deprecated classes.

🛠️ Essential Commands

Check Logic Errors

./gradlew detekt

Auto-Correct (Basic)

./gradlew detekt --auto-correct

📜 Configuration (detekt.yml)

Use a custom configuration file to override default thresholds:

complexity:
  TooManyFunctions:
    active: true
    thresholdInFiles: 11
    thresholdInClasses: 11
    thresholdInInterfaces: 11
    thresholdInObjects: 11
  LongMethod:
    active: true
    threshold: 20

🚀 Performance & Tips

  • Custom Rules: Implement Rule subclass to enforce project-specific requirements.
  • Baseline Files: Use detekt-baseline.xml for large existing projects to prioritize fixing new issues.
  • IDE Integration: Install the "Detekt" plugin in Android Studio/IntelliJ.

🧪 Verification Checklist

  • No Complex Functions: Logic is broken down into small, testable units.
  • No Dead Code: All private members are used or deleted.
  • Stable APIs: All public APIs follow consistent naming and documentation rules.
  • No Deprecated Usage: Modern APIs are used exclusively.

🔗 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.