Agent skill

Codebase Analysis

by ArduPilot in ArduPilot/MethodicConfigurator

Analyze the codebase structure and count lines of code by category using cloc.

GPL-3.0Auto-check: notesDevelopment

Install Codebase Analysis

skills CLI
$ npx skills add ArduPilot/MethodicConfigurator --skill codebase-analysis -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArduPilot/MethodicConfigurator codebase-analysis --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArduPilot/MethodicConfigurator.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/codebase-analysis .claude/skills/codebase-analysis && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
codebase-analysis
GitHub stars
163
Token cost
~2.2k tokens
SKILL.md length
573 words
Files
1
Skills in repo
11
Repo updated
First seen
Licence
GPL-3.0

At a glance

Analyze the codebase structure and count lines of code by category using cloc.

  • Works in 9 steps: Test Code → Main Application Code → Documentation Files → …
  • Generating code statistics
  • SKILL.md covers Prerequisites, Code Categories, Complete Analysis Workflow and Expected Output Format, plus 3 more sections
  • Calls python, pip and apt

What it does

Codebase Analysis is an agent skill from ArduPilot/MethodicConfigurator. Analyze the codebase structure and count lines of code by category using cloc. Use when generating code statistics, calculating test-to-application ratios, documentation-to-code ratios, or identifying generated code percentages.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Codebase onboarding and Statistics. The repository describes itself as: A clear ArduPilot configuration sequence. The licence is GPL-3.0.

When your agent uses it

  • Generating code statistics
  • Calculating test-to-application ratios
  • Documentation-to-code ratios
  • Identifying generated code percentages

Example prompts

  • “/codebase-analysis”

Requirements

  • Python 3

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Test Code
  2. Main Application Code
  3. Documentation Files
  4. Configuration Files
  5. Generated Code
  6. Utility Scripts
  7. Identify Generated Files
  8. Count Lines by Category
  9. Calculate Summary Metrics

What it can do on your machine

Read from SKILL.md and the folder at commit 9cd3ca1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python
    • pip
    • apt

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Codebase Analysis loads about 2.2k tokens when it runs. Until then it costs about 62 tokens; SKILL.md has 573 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~62
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteRuns commands with sudoSKILL.md:18
    tall it via your package manager (e.g., `sudo apt install cloc` on Ubuntu).

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ArduPilot/MethodicConfigurator at commit 9cd3ca1, republished under its GPL-3.0 licence (© ArduPilot). 573 words, ~2,242 tokens.

Download SKILL.mdSave it as .claude/skills/codebase-analysis/SKILL.md (or your agent's skills folder).
name
codebase-analysis
description
Analyze the codebase structure and count lines of code by category using cloc. Use when generating code statistics, calculating test-to-application ratios, documentation-to-code ratios, or identifying generated code percentages.

Codebase Analysis Instructions

This document provides step-by-step instructions for analyzing the ArduPilot Methodic Configurator codebase structure and counting lines of code across different categories.

Prerequisites

  • Ensure cloc (Count Lines of Code) tool is installed:

    bash
    which cloc

    If not installed, install it via your package manager (e.g., sudo apt install cloc on Ubuntu).

Code Categories

The codebase is organized into the following categories:

1. Test Code
  • Location: tests/ directory
  • Purpose: Unit tests, integration tests, and test assets
  • Command: cloc tests/
2. Main Application Code
  • Location: ardupilot_methodic_configurator/ directory
  • Purpose: Core application logic, GUI, backends, and business logic
  • Command: cloc ardupilot_methodic_configurator/
3. Documentation Files
  • Location: Root directory and subdirectories

  • Purpose: User manuals, guides, architecture documentation, and README files

  • File Types: Markdown files (*.md)

  • Commands:

    bash
    # Find all markdown files
    find . -name "*.md" -type f
    
    # Count lines in documentation
    find . -name "*.md" -type f | xargs cloc
4. Configuration Files
  • Location: Root directory and subdirectories

  • Purpose: Project configuration, build settings, CI/CD configuration, and metadata

  • File Types: JSON files (*.json)

  • Commands:

    bash
    # Find all JSON files
    find . -name "*.json" -type f
    
    # Count lines in configuration files
    find . -name "*.json" -type f | xargs cloc
5. Generated Code
  • Location: Within ardupilot_methodic_configurator/ directory and scripts/ directory

  • Purpose: Auto-generated files that should not be manually edited

  • Files (as documented in ARCHITECTURE.md):

    • data_model_fc_ids.py (generated by update_flight_controller_ids.py)
    • configuration_steps_strings.py (generated by update_configuration_steps_translation.py)
    • vehicle_components.py (generated by update_vehicle_components_translation.py)
    • scripts/generate_codebase_pie_chart.py (generated by AI assistant for codebase analysis)
  • Command:

    bash
    cloc ardupilot_methodic_configurator/data_model_fc_ids.py \
         ardupilot_methodic_configurator/configuration_steps_strings.py \
         ardupilot_methodic_configurator/vehicle_components.py \
         scripts/generate_codebase_pie_chart.py
6. Utility Scripts
  • Locations:

    • Root directory Python scripts
    • scripts/ directory
  • Purpose: Build scripts, maintenance tools, development utilities

  • Commands:

    bash
    # Find all Python scripts in root directory
    find . -maxdepth 1 -name "*.py" -type f
    
    # Count lines in root directory scripts
    cloc ./unix2dos.py ./create_pot_file.py ./insert_missing_translations.py \
         ./mavproxy_param.py ./copy_magfit_pdef_to_template_dirs.py ./setup.py \
         ./update_flight_controller_ids.py ./test_dpi_scaling.py ./mavproxy_ftp.py \
         ./extract_missing_translations.py ./post_install.py ./param_reorder.py \
         ./param_zip.py ./find_exclusive_parameter_names.py ./get_server_pem_cert.py \
         ./update_vehicle_components_translation.py ./update_vehicle_templates.py \
         ./param_filter.py ./create_mo_files.py ./copy_param_files.py \
         ./update_configuration_steps_translation.py ./merge_pot_file.py \
         ./mavftp.py ./dos2unix.py
    
    # Count lines in scripts directory
    cloc scripts/

Complete Analysis Workflow

Step 1: Identify Generated Files

First, check ARCHITECTURE.md to identify which files are auto-generated:

bash
grep -n "autogenerated" ARCHITECTURE.md
Step 2: Count Lines by Category
  1. Test Code:

    bash
    cloc tests/
  2. Main Application Code:

    bash
    cloc ardupilot_methodic_configurator/
  3. Documentation Files:

    bash
    find . -name "*.md" -type f | xargs cloc
  4. Configuration Files:

    bash
    find . -name "*.json" -type f | xargs cloc
  5. Generated Code (subset of main application and scripts):

    bash
    cloc ardupilot_methodic_configurator/data_model_fc_ids.py \
         ardupilot_methodic_configurator/configuration_steps_strings.py \
         ardupilot_methodic_configurator/vehicle_components.py \
         scripts/generate_codebase_pie_chart.py
  6. Root Directory Scripts:

    bash
    find . -maxdepth 1 -name "*.py" -type f | xargs cloc
  7. Scripts Directory:

    bash
    cloc scripts/
Show full SKILL.md (316 more words)Show less
Step 3: Calculate Summary Metrics

Extract the "code" column from each cloc output to calculate:

  • Total Test Lines: Python code lines from tests/
  • Total Application Lines: Python code lines from ardupilot_methodic_configurator/
  • Total Documentation Lines: Markdown lines from *.md files
  • Total Configuration Lines: JSON lines from *.json files
  • Generated Code Lines: Python code lines from generated files
  • Utility Script Lines: Python code lines from root + scripts/ directories
  • Test-to-Application Ratio: Test lines / Application lines
  • Generated Code Percentage: (Generated lines / Application lines) × 100
  • Documentation-to-Code Ratio: Documentation lines / (Application lines + Test lines)

Expected Output Format

Present results in this structure:

text
### Tests Directory:
- **Total code lines: X** (Python only)
- Additional assets: Y lines of XML, Z lines of HTML, etc.

### Main Application (ardupilot_methodic_configurator/):
- **Total Python code lines: X**
- Additional files: Y lines of XML, Z lines of JSON, etc.

### Documentation Files (*.md):
- **Total documentation lines: X** (across Y files)
- Key files: README.md (X lines), USERMANUAL.md (Y lines), etc.

### Configuration Files (*.json):
- **Total configuration lines: X** (across Y files)
- Key files: pyproject.toml equivalent configs, CI/CD configs, etc.

### Generated Code (within the application):
- **Total generated Python code lines: X**
- **Percentage of application code: Y%**
- Files: list of generated files

### Scripts (root + scripts/ directories):
- **Root directory scripts: X Python code lines** (N files)
- **Scripts directory: Y Python code lines + Z other lines** (N files)
- **Total script lines: X**

### Key Insights:
1. **Tests**: X lines - test coverage assessment
2. **Core Application**: X lines (Python only)
3. **Documentation**: X lines (comprehensive user/developer docs)
4. **Configuration**: X lines (project setup and CI/CD)
5. **Generated Code**: X lines (~Y% of application code)
6. **Utility Scripts**: X lines for build/maintenance tasks
7. **Total Python Code**: ~X lines across all categories
8. **Test-to-Application Ratio**: X:1
9. **Documentation-to-Code Ratio**: X:1

Notes

  • Focus on Python code lines for the main metrics
  • Generated code should not be manually edited and should be counted separately from hand-written code
  • Documentation quality is assessed by documentation-to-code ratio
  • Configuration files include project setup, CI/CD, and metadata files
  • The project structure follows clean architecture principles
  • Test coverage and generated code percentages are key quality indicators
  • XML files in the application directory are likely parameter definitions
  • PO files are translation files for internationalization
  • The generate_codebase_pie_chart.py script is itself a generated file and should be excluded from utility script counts

Maintenance

This analysis should be run:

  • Before major releases
  • After significant code refactoring
  • When evaluating code quality metrics
  • For project health assessments

Update this document if:

  • New generated files are added (check ARCHITECTURE.md)
  • Directory structure changes significantly
  • New categories of code are introduced

Generating Visualization

A Python script is available to automatically generate a pie chart visualization of the codebase structure:

bash
python scripts/generate_codebase_pie_chart.py

This script will:

  • Create a pie chart showing the distribution of code across all categories
  • Save the chart as both PNG (high resolution) and SVG (scalable) formats in the images/ directory
  • Display detailed analysis with key metrics and quality indicators
  • Show the chart interactively (if display is available)

Requirements: matplotlib and numpy packages must be installed:

bash
pip install matplotlib numpy

Output files:

  • images/codebase_structure_pie_chart.png - High-resolution PNG for documentation
  • images/codebase_structure_pie_chart.svg - Scalable SVG for presentations

© ArduPilot, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/codebase-analysis of ArduPilot/MethodicConfigurator.

Open the folder on GitHubat commit 9cd3ca1

Compare with similar skills

Codebase Analysis next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Codebase Analysis compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Codebase Analysis this skillArduPilot/MethodicConfigurator163—~2.2kAutomated safety check: NotesGPL-3.0
Math AuditorCliMA/EnsembleKalmanProcesses.jl127—~2.6kAutomated safety check: PassApache-2.0
Flowfile Architecture ContractEdwardvaneechoud/Flowfile373—~9.9kAutomated safety check: PassMIT
Release Announcementmonarch-initiative/mondo326—~1.6kAutomated safety check: PassCC-BY-4.0
Fact Checkerdaymade/claude-code-skills1.4k2 repos~2.1kAutomated safety check: PassMIT
Codebase Knowledge Graph Q&AEgonex-AI/Understand-Anything86k1 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • Math Auditor

    CliMA/EnsembleKalmanProcesses.jl

    Run an adversarial mathematical-accuracy review of a Julia package's src/ and test/ directories, producing a dated markdown report plus concise, self-contained fix-prompt markdowns suitable for…

    127 GitHub stars~2.6k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Flowfile Architecture Contract

    Edwardvaneechoud/Flowfile

    Maps Flowfile's core, worker, frontend, kernel, scheduler and shared services and the design contracts between them, for onboarding and cross-service debugging.

    373 GitHub stars~9.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Release Announcement

    monarch-initiative/mondo

    Generate a formatted Mondo release announcement with statistics table from release diff reports

    326 GitHub stars~1.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Fact Checker

    daymade/claude-code-skills

    Verifies factual claims in documents using web search and official sources, then proposes corrections with user confirmation.

    1.4k GitHub starsUsed in 2 repos~2.1k tokens
    DevelopmentAuto-check passed
  • Codebase Knowledge Graph Q&A

    Egonex-AI/Understand-Anything

    Answers questions about a codebase by searching a prebuilt knowledge graph of its files, functions, classes and dependencies, not by rereading every source file.

    86k GitHub starsUsed in 1 repo~1.2k tokens
    DevelopmentAuto-check passed
  • Understand Explain

    Egonex-AI/Understand-Anything

    Gives an in-depth explanation of one file, function or module by reading the project's knowledge graph and checking that the graph is still fresh.

    86k GitHub starsUsed in 1 repo~1.3k tokens
    DevelopmentAuto-check passed

More from ArduPilot/MethodicConfigurator

All 11 skills in this repo
  • Update Gui Translations

    ArduPilot/MethodicConfigurator

    Update existing GUI translations using AI assistance. An agent skill from ArduPilot/MethodicConfigurator.

    163 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Add UI Translation

    ArduPilot/MethodicConfigurator

    Add a new translation language to the application. An agent skill from ArduPilot/MethodicConfigurator.

    163 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Architecture Validation

    ArduPilot/MethodicConfigurator

    Validate and update ARCHITECTUREn.md files against actual source code implementation.

    163 GitHub stars~3.8k tokensUpdated today
    Auto-check passed
  • Configuration Steps Reorder

    ArduPilot/MethodicConfigurator

    Add, delete, or re-order configuration steps in configurationsteps.json.

    163 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Pytest Testing

    ArduPilot/MethodicConfigurator

    Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator.

    163 GitHub stars~3.5k tokensUpdated today
    Auto-check passed
  • Sitl Testing

    ArduPilot/MethodicConfigurator

    Set up and run SITL integration tests for backendflightcontroller.py.

    163 GitHub stars~1.7k tokensUpdated today
    Auto-check passed

Questions about Codebase Analysis

What does Codebase Analysis do?

Analyze the codebase structure and count lines of code by category using cloc. Codebase Analysis is an agent skill from ArduPilot/MethodicConfigurator. Analyze the codebase structure and count lines of code by category using cloc.

When should I use Codebase Analysis?

Codebase Analysis fits situations like: generating code statistics; calculating test-to-application ratios; documentation-to-code ratios; identifying generated code percentages.

How do I install Codebase Analysis in Claude Code?

Run `npx skills add ArduPilot/MethodicConfigurator --skill codebase-analysis -a claude-code`. Or copy the skill folder (.github/skills/codebase-analysis in ArduPilot/MethodicConfigurator) into .claude/skills/codebase-analysis in your project. Claude Code loads it when a task matches its description.

How do I install Codebase Analysis in Codex?

Run `npx skills add ArduPilot/MethodicConfigurator --skill codebase-analysis -a codex`. Or copy the skill folder (.github/skills/codebase-analysis in ArduPilot/MethodicConfigurator) into .agents/skills/codebase-analysis in your project. Codex loads it when a task matches its description.

Can I use Codebase Analysis in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArduPilot/MethodicConfigurator --skill codebase-analysis -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/codebase-analysis, .gemini/skills/codebase-analysis, .github/skills/codebase-analysis and .opencode/skills/codebase-analysis in your project.

What does Codebase Analysis need to run?

Going by SKILL.md and its folder, Codebase Analysis needs the command-line tools its instructions call (python, pip and apt). Our summary lists: Python 3.

Does Codebase Analysis access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Codebase Analysis safe to install?

Our automated static check of SKILL.md found notes only (runs commands with sudo), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Codebase Analysis use?

Codebase Analysis is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Codebase Analysis use?

About 2.2k tokens (SKILL.md is roughly 9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Codebase Analysis?

Skills that share tags, products or a category with Codebase Analysis: Math Auditor (CliMA/EnsembleKalmanProcesses.jl, 127 stars), Flowfile Architecture Contract (Edwardvaneechoud/Flowfile, 373 stars), Release Announcement (monarch-initiative/mondo, 326 stars) and Fact Checker (daymade/claude-code-skills, 1.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Codebase Analysis?

ArduPilot (a GitHub organization) maintains it in ArduPilot/MethodicConfigurator, which has 163 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 7, 2026.

Source: ArduPilot/MethodicConfigurator on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.