<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tech-Debt on maiatoday</title><link>https://www.maiatoday.net/tags/tech-debt/</link><description>Recent content in Tech-Debt on maiatoday</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 08 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.maiatoday.net/tags/tech-debt/index.xml" rel="self" type="application/rss+xml"/><item><title>Android ❤️ Gemini CLI - tech debt detection Code Maat skill</title><link>https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/</link><pubDate>Sun, 08 Mar 2026 00:00:00 +0000</pubDate><guid>https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/</guid><description>&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/geminiCLIMaatAndy.png" alt="Featured image of post Android ❤️ Gemini CLI - tech debt detection Code Maat skill" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;What AI tools work for building Android apps? I am exploring some variations. In this post I will look at &lt;em&gt;Gemini CLI&lt;/em&gt;, tech debt detection with a skill using Code Maat and how this compares with the Agent of Gemini in Android Studio.&lt;/p&gt;
&lt;p&gt;I am not starting with a new project. What if you have an &lt;em&gt;existing codebase&lt;/em&gt; and you want to find the best place to tackle some &lt;em&gt;tech debt&lt;/em&gt; that will make a difference for everyone. The sample codebase is the &lt;a class="link" href="https://github.com/HabitRPG/habitica-android" target="_blank" rel="noopener"
&gt;Habitica app&lt;/a&gt;, which had its first commit in 2015. Rather than poking at the code in a random or an &lt;strong&gt;&amp;ldquo;intuitive&amp;rdquo;&lt;/strong&gt; way or asking the AI questions, let&amp;rsquo;s look at a more deterministic way to answer this question. Or rather, let&amp;rsquo;s teach the agent to use some scripts to answer this question. The benefit of packaging this functionality in a skill is that you can create this specialisation and script usage in a skill that will be loaded lazily only when you need it.&lt;/p&gt;
&lt;h2 id="the-theory---code-as-crime-scene"&gt;The theory - Code as Crime scene
&lt;/h2&gt;&lt;p&gt;Adam Tornhill wrote a book, &lt;a class="link" href="https://www.adamtornhill.com/articles/crimescene/codeascrimescene.htm" target="_blank" rel="noopener"
&gt;Your Code as a Crime Scene&lt;/a&gt;, that uses your git history and applies forensic science to figure out where the hotspots, logical coupling, churn and more can be found in your code base. He has a java tool called Code Maat that you can use to analyse this information. The problem is, it is a bit finicky to setup and run and I can never remember all the command line parameters for git or for the tool. The theory TLDR is if you can see which large files change often or which files always change together, you can see which parts of your code are brittle or are coupled. The added benefit is that this analysis is language neutral. So if you build an agent skill for this, it can be used on any codebase.&lt;/p&gt;
&lt;h2 id="creating-the-code-maat-skill"&gt;Creating the Code Maat Skill
&lt;/h2&gt;&lt;h3 id="what-do-we-need"&gt;What do we need
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;the &lt;a class="link" href="https://github.com/adamtornhill/code-maat" target="_blank" rel="noopener"
&gt;link to Code Maat&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;optionally &lt;a class="link" href="https://github.com/adamtornhill/code-maat/releases" target="_blank" rel="noopener"
&gt;download&lt;/a&gt; the code-maat standalone jar and put it in &lt;code&gt;~/tools/code-maat.jar&lt;/code&gt; to speed up the first run&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://geminicli.com/docs/get-started/installation/" target="_blank" rel="noopener"
&gt;Gemini CLI&lt;/a&gt; + &lt;a class="link" href="https://geminicli.com/docs/get-started/authentication/" target="_blank" rel="noopener"
&gt;authentication and API key if you have it&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;the &lt;code&gt;skill-creator&lt;/code&gt; skill - this is part of the Gemini CLI install&lt;/li&gt;
&lt;li&gt;the &lt;a class="link" href="https://github.com/HabitRPG/habitica-android" target="_blank" rel="noopener"
&gt;Habitica Android app repo&lt;/a&gt; to test on&lt;/li&gt;
&lt;li&gt;the prompt&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here is the prompt I used:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;I need you to create a new Gemini CLI agent skill called &amp;#34;code-maat&amp;#34; using the skill-creator. The skill is based on
the code-maat tool (https://github.com/adamtornhill/code-maat).
Core Intent
Analyze repository evolution (churn, hotspots, and logical coupling). The skill must automate the extraction of git
logs, run the Clojure-based analysis, and produce both a human-readable report and an interactive D3.js visualization.
🔍 Discovery Phase (Crucial)
Before writing the Python orchestrator, you MUST:
1. Run java -jar ~/tools/code-maat.jar --help to verify available analysis types.
2. Run a sample of each analysis (summary, revisions, authors, coupling) against the current repository and inspect
the CSV headers.
3. Note that code-maat often uses hyphens (e.g., n-revs, n-authors, average-revs) rather than underscores. Ensure
your Python script maps these exactly.
Implementation Details
4. Environment Checks:
- Verify Git and Java (version 8+) are in the PATH.
- Check for ~/tools/code-maat.jar. If missing, provide the download link and stop.
- Ensure the current directory is a Git repository.
5. Log Extraction:
- Generate the log using: git log --all --numstat --date=short --pretty=format:&amp;#39;--%h--%ad--%aN&amp;#39; &amp;gt; log.txt.
6. Analysis Logic &amp;amp; Schema Safety:
- Create a Python orchestrator in scripts/analyze_and_report.py.
- Requirement: The script must use csv.DictReader and include a safety check to verify that expected keys
(identified in the Discovery phase) exist in the output before processing.
- Map the following analyses:
- summary (Stats)
- revisions (Hotspots: expect entity, n-revs)
- authors (Main devs: expect entity, n-authors, n-revs)
- coupling (Logical coupling: expect entity, coupled, degree, average-revs)
7. Reporting &amp;amp; Visualization:
- Generate a REPORT.md summarizing the top 10 findings for each category.
- Create an HTML/D3 template in assets/viz_template.html. The Python script should inject the JSON-formatted
analysis data into this template.
Skill Structure
- Logic in scripts/.
- D3 template in assets/.
- Metric explanations in references/README.md.
Validation
1. Functional Test: Execute the script on the current repository.
2. Data Integrity: Verify that REPORT.md is actually populated with data (not just headers) and that no KeyError
exceptions occur during parsing.
3. Documentation: Ensure SKILL.md defines the usage clearly.
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="steps"&gt;Steps
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;Open a terminal and type &lt;code&gt;gemini&lt;/code&gt;. I did this in the repo, but anywhere will do.&lt;/li&gt;
&lt;li&gt;Paste in the above prompt&lt;/li&gt;
&lt;li&gt;Let it run, check what it is doing and accept.&lt;/li&gt;
&lt;li&gt;Let it install the skill for you. I chose a user wide installation which will put this skill into &lt;code&gt;~/.gemini/skills&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Test the skill in a fresh session with gemini with a prompt something like this &lt;code&gt;tell me about the hotspots in this codebase&lt;/code&gt; Sometimes it messes up the skill scripts but will fix any issues it has on the first run.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="what-did-it-do"&gt;What did it do
&lt;/h3&gt;&lt;p&gt;It creates a set of scripts, templates and prompts to be able to generate a git log of your project and then feed it to the code-maat java tool. This tool in turn provides results for the hotspot and churn questions. The skill has some protection built in so that it won&amp;rsquo;t run on a non-git repo and it will check if you have everything installed. It will write a summary in a report and create an HTML visualisation. Once it is complete and installed you should see it in your gemini session with the command &lt;code&gt;/skills list&lt;/code&gt;
&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/skillsList.png"
width="1774"
height="298"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/skillsList_hu_2a7d8cbc3d77c730.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/skillsList_hu_e47dd6f46589eaf5.png 1024w"
loading="lazy"
alt="skills list"
class="gallery-image"
data-flex-grow="595"
data-flex-basis="1428px"
&gt;&lt;/p&gt;
&lt;h2 id="the-proof-is-in-the-pudding---where-are-the-hotspots"&gt;The proof is in the pudding - where are the hotspots?
&lt;/h2&gt;&lt;h3 id="taking-the-code-maat-skill-for-a-spin"&gt;Taking the code-maat skill for a spin
&lt;/h3&gt;&lt;p&gt;This is what the &lt;code&gt;analyze this repo for hotspots&lt;/code&gt; prompt produced
&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/useSkill.png"
width="1764"
height="690"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/useSkill_hu_ca26d45dd4ffd270.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/useSkill_hu_169ba8af24376106.png 1024w"
loading="lazy"
alt="use the skill"
class="gallery-image"
data-flex-grow="255"
data-flex-basis="613px"
&gt;&lt;/p&gt;
&lt;p&gt;It should figure out from that prompt that it needs to use the &lt;code&gt;code-maat&lt;/code&gt; skill and generate a report for you in the code-maat folder. Here is what it found for the Habitica repo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;The analysis of the Habitica Android repository reveals the following hotspots and areas of high
maintenance:
🛠️ Key Hotspots (Highest Revision Frequency)
- Habitica/res/values/strings.xml (779 revisions, 42 authors): The most volatile file, driven by constant
feature additions and internationalization updates.
- Habitica/build.gradle (593 revisions): Indicates frequent dependency management and build configuration
shifts.
- Habitica/src/main/java/com/habitrpg/android/habitica/ui/activities/MainActivity.kt (292 revisions): A
central logic hub for the UI, likely a candidate for further architectural decomposition.
- Habitica/AndroidManifest.xml (418 revisions): Frequent updates to app components and permissions.
👥 Collaboration Hotspots (High Author Count)
- Localization Files: Many authors contribute to strings.xml across various languages (Spanish, French,
German, Russian, etc.), reflecting a strong community contribution model.
🔗 Logical Coupling (Hidden Dependencies)
- Task Adapters: There is 100% logical coupling between DailiesRecyclerViewHolder.kt,
TodosRecyclerViewAdapter.kt, and HabitsRecyclerViewAdapter.kt. Changes to one almost always require
changes to the others, suggesting shared logic that could be abstracted.
- WearOS Layouts: Similar tight coupling exists in the WearOS module for row_daily.xml, row_todo.xml, and
row_habit.xml.
- Item Cards: daily_item_card.xml and todo_item_card.xml are highly coupled (85%), indicating mirrored UI
changes.
The full report is available in code-maat/REPORT.md and a D3 visualization has been generated at
code-maat/visualization.html.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The first thing to notice is that it doesn&amp;rsquo;t know about Android things. &lt;code&gt;strings.xml&lt;/code&gt; does change a lot and lots of people change this file but that&amp;rsquo;s ok. &lt;code&gt;build.gradle&lt;/code&gt; changes could be an indication that something can be improved but then again it could just be dependencies updates. Likewise, I&amp;rsquo;m not sure why the AndroidManifest.xml changed so much. However the big MainActivity.kt could be something to look at.&lt;/p&gt;
&lt;p&gt;More interesting for me though is the &lt;em&gt;logical coupling&lt;/em&gt; between those RecyclerViewAdapters. I would probably look at how to clean that part of the code and possibly convert it to compose.&lt;/p&gt;
&lt;p&gt;The skill has a way to generate visualisations too. They aren&amp;rsquo;t as sophisticated as the paid-for tool. In the next iteration it would be possible to prompt Gemini CLI for more detailed/clear visualisations.
&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/hotspotsGraph.png"
width="1600"
height="1154"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/hotspotsGraph_hu_c9178bda4aa49090.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/hotspotsGraph_hu_5179d9d93b4e682d.png 1024w"
loading="lazy"
alt="hotspots graph"
class="gallery-image"
data-flex-grow="138"
data-flex-basis="332px"
&gt;&lt;/p&gt;
&lt;h3 id="what-does-the-gemini-in-android-studio-agent-say"&gt;What does the Gemini in Android Studio Agent say?
&lt;/h3&gt;&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agentOneShot.png"
width="1018"
height="342"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agentOneShot_hu_637af7b360b4cc96.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agentOneShot_hu_be91afc0068f4d5a.png 1024w"
loading="lazy"
alt="GiAS Agent oneshot"
class="gallery-image"
data-flex-grow="297"
data-flex-basis="714px"
&gt;&lt;/p&gt;
&lt;p&gt;And here the results&lt;/p&gt;
&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent1.png"
width="1124"
height="920"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent1_hu_73bafc2005d746cf.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent1_hu_f7da90e44542fe11.png 1024w"
loading="lazy"
alt="GiAS Agent results 1"
class="gallery-image"
data-flex-grow="122"
data-flex-basis="293px"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent2.png"
width="1146"
height="638"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent2_hu_693d95118ad0b2cd.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent2_hu_fb171f5558668f8.png 1024w"
loading="lazy"
alt="GiAS Agent results 2"
class="gallery-image"
data-flex-grow="179"
data-flex-basis="431px"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent3.png"
width="1106"
height="1136"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent3_hu_db75ec8e9d1ade97.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent3_hu_55d1633c2654e7a6.png 1024w"
loading="lazy"
alt="GiAS Agent results 3"
class="gallery-image"
data-flex-grow="97"
data-flex-basis="233px"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent4.png"
width="1074"
height="372"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent4_hu_7e1c1c7114aadf5.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/agent4_hu_91fdc1e87ebc656b.png 1024w"
loading="lazy"
alt="GiAS Agent results 4"
class="gallery-image"
data-flex-grow="288"
data-flex-basis="692px"
&gt;&lt;/p&gt;
&lt;p&gt;What is immediately obvious is that Gemini in Android Studio agent is more aware of how Android projects are put together. It also identifies the &lt;code&gt;MainActivity.kt&lt;/code&gt; as an area to improve but knows that the &lt;code&gt;strings.xml&lt;/code&gt; needs to change for all copy or translations. The results seem better but they may vary every time you run the prompt. The code-maat skill results should be repeatable because they are a result of the scripts which generate the csv reports even though the AI interpretation of the results could vary.&lt;/p&gt;
&lt;h2 id="which-one-should-i-use"&gt;Which one should I use?
&lt;/h2&gt;&lt;h3 id="gemini-cli"&gt;Gemini CLI
&lt;/h3&gt;&lt;p&gt;This is a good choice if you want to be able to run the agent in a sandbox environment. Also good if you like the CLI environment or you need to spawn multiple agents each doing many things. The underlying models are the same as Gemini in Android Studio and both have the same context window if the same models are used, but the system prompt differs. The integration into Android Studio is sparse: a button to open the terminal and a way to share a file and line number. Gemini CLI can be expanded easily with extensions.&lt;/p&gt;
&lt;h3 id="gemini-in-android-studio---agent"&gt;Gemini in Android Studio - agent
&lt;/h3&gt;&lt;p&gt;The main benefit of using the Agent in Android Studio is it has system prompts that ground it in Android documentation and better IDE integration. This means the results are tailored for Android code bases. The downside is that you can&amp;rsquo;t run multiple agents.&lt;/p&gt;
&lt;h2 id="next-steps"&gt;Next steps
&lt;/h2&gt;&lt;h3 id="fix-something"&gt;Fix something
&lt;/h3&gt;&lt;p&gt;Given that we now know what we can refactor in the codebase, the next step would be to use either tool and make a plan to clear up some of the tech debt.&lt;/p&gt;
&lt;h3 id="build-more-skills"&gt;Build more skills
&lt;/h3&gt;&lt;p&gt;Identify more skills to build and use the &lt;code&gt;skill-creator&lt;/code&gt; to expand Gemini CLI or build some rules in Gemini in Android Studio for tasks you do regularly. This will allow you to enhance your Android AI use with knowledge specific to the tasks you do regularly.&lt;/p&gt;
&lt;h2 id="extra-goodies"&gt;Extra goodies
&lt;/h2&gt;&lt;p&gt;While there are a myriad of MCP services available both in Android Studio as part of the AI configuration in settings and as Gemini CLI extensions, I would be selective with the ones I install. If there are too many to choose from it causes noise in the context and the results are not as good. Given the choice, I would prefer skills over MCP tools.&lt;/p&gt;
&lt;h3 id="managing-extensions"&gt;Managing Extensions
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Search: Browse the &lt;a class="link" href="https://geminicli.com/extensions/" target="_blank" rel="noopener"
&gt;Gemini CLI Extension Gallery&lt;/a&gt; or use the
&lt;code&gt;/extensions explore&lt;/code&gt; command in an interactive session to open it in your browser.&lt;/li&gt;
&lt;li&gt;Install: Use the terminal command &lt;code&gt;gemini extensions install &amp;lt;github-url-or-path&amp;gt;&lt;/code&gt; (Note: This must be
done from your standard terminal, not inside the CLI&amp;rsquo;s interactive mode).&lt;/li&gt;
&lt;li&gt;List: Run &lt;code&gt;/extensions list&lt;/code&gt; within the CLI to see active extensions or &lt;code&gt;gemini extensions list&lt;/code&gt; in your
terminal.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="gemini-cli-plugin-for-android"&gt;Gemini CLI plugin for android
&lt;/h3&gt;&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/marketplace.png"
width="1318"
height="434"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/marketplace_hu_70f2a01d1e21e4df.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/marketplace_hu_c2d364ad279adbdb.png 1024w"
loading="lazy"
alt="Plugin in marketplace"
class="gallery-image"
data-flex-grow="303"
data-flex-basis="728px"
&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/pluginCLI.png"
width="364"
height="98"
srcset="https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/pluginCLI_hu_7ec79d3d0cc6d508.png 480w, https://www.maiatoday.net/p/android-%EF%B8%8F-gemini-cli-tech-debt-detection-code-maat-skill/pluginCLI_hu_195cfcb5a7a9cf10.png 1024w"
loading="lazy"
alt="Gemini CLI plugin"
class="gallery-image"
data-flex-grow="371"
data-flex-basis="891px"
&gt;&lt;/p&gt;
&lt;p&gt;This can be found in the marketplace and is useful to get rudimentary integration if you choose to use this tool above the built-in Agent.&lt;/p&gt;
&lt;h3 id="adb-connections-in-gemini-cli"&gt;ADB connections in Gemini CLI
&lt;/h3&gt;&lt;p&gt;A useful extension for Android development in Gemini CLI is &lt;code&gt;adb-control-gemini&lt;/code&gt; installed with this command&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gemini extensions install https://github.com/tiendung2k03/adb-control-gemini&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To use it, prompt like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;inspect the ui on the running emulator&lt;/code&gt;
or
&lt;code&gt;start the emulator and run the app on the emulator&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You may need to make sure that adb is in your path.&lt;/p&gt;
&lt;p&gt;And that&amp;rsquo;s it for now, this is already a long read.&lt;/p&gt;</description></item></channel></rss>