code-audit

GitHub

针对Android项目执行代码审计,检测超大文件、缺失MVI契约及重复代码等问题,并生成可执行的增量重构计划,确保代码符合架构规范。

.agents/skills/code-audit/SKILL.md pass-with-high-score/blockads-android

Trigger Scenarios

audit code check code issues find files to refactor refactor screen

Install

npx skills add pass-with-high-score/blockads-android --skill code-audit -g -y
More Options

Non-standard path

npx skills add https://github.com/pass-with-high-score/blockads-android/tree/main/.agents/skills/code-audit -g -y

Use without installing

npx skills use pass-with-high-score/blockads-android@code-audit

指定 Agent (Claude Code)

npx skills add pass-with-high-score/blockads-android --skill code-audit -a claude-code -g -y

安装 repo 全部 skill

npx skills add pass-with-high-score/blockads-android --all -g -y

预览 repo 内 skill

npx skills add pass-with-high-score/blockads-android --list

SKILL.md

Frontmatter
{
    "name": "code-audit",
    "description": "Scan the codebase for architectural issues, files exceeding 500 lines, missing MVI contracts, duplicate code, and gomobile interop risks, and generate actionable refactoring plans. Use when the user asks to \"audit code\", \"check code issues\", \"find files to refactor\", or \"refactor screen\"."
}

Code Audit & Refactoring Skill

This skill diagnoses code smells, architectural violations, and rule non-compliance across the blockads-android project, then guides safe, incremental refactoring according to project standards (GEMINI.md and .agent/rules/).

Capabilities

  1. Automated Codebase Audit:

    • Detect files exceeding the 500-line limit (both Kotlin and Go).
    • Identify UI screen modules missing dedicated *Contract.kt files (MVI compliance).
    • Identify god-classes and monoliths needing decomposition.
    • Verify gomobile interop constraints in tunnel/.
  2. Targeted Refactoring Workflows:

    • Splitting large composables (>500 lines) into focused sub-composables in dedicated files.
    • Converting legacy screens to standard MVI (Contract + Screen + ViewModel).
    • Breaking down monolithic services (e.g., AdBlockVpnService.kt, AppPreferences.kt) into delegates.

How to Run an Audit

Execute the built-in audit script from the terminal:

python3 .agent/skills/code-audit/scripts/audit_codebase.py

This generates an instant Markdown report covering:

  • File line count violations categorized by severity (🔴 Critical > 750 lines, 🟡 Warning > 500 lines).
  • UI modules lacking dedicated MVI Contracts.
  • Gomobile compatibility issues.
  • Prioritized refactoring roadmap.

4-Phase Refactoring Process

When tasked with refactoring any module or screen identified by the audit:

Phase 1: Diagnosis & Scope Definition

  • Run the audit script or inspect the target file.
  • Identify the exact responsibilities of the file.
  • Define what parts will be extracted (e.g., UI dialogs, card items, state models, helper functions).

Phase 2: Refactoring Plan

Draft a concise plan detailing:

  1. Target File: File to be decomposed.
  2. New Extracted Files:
    • *Contract.kt: Immutable UiState, UiIntent, UiEffect.
    • components/*Item.kt or components/*Dialog.kt: Extracted stateless composables.
    • *Delegate.kt or *Helper.kt: Extracted business logic or DataStore operations.
  3. Target line count for each file (all strictly < 500 lines).

Phase 3: Execution (Incremental & Atomic)

  • Extract independent contracts/models first.
  • Extract reusable UI components into ui/components/ or screen-specific subpackages.
  • Keep the main Screen or Service as an orchestrator with a flat hierarchy.
  • Ensure all dependencies are injected via Koin constructor injection.

Phase 4: Taste Test & Verification

  • Compile the project:
    ./gradlew assembleDebug
    
  • Run unit tests:
    ./gradlew test
    
  • If modifying Go tunnel:
    ./gradlew buildGoTunnel
    
  • Verify zero regression in functionality and confirm all new files are under 500 lines.

Version History

  • 4938bb2 Current 2026-09-22 03:58

Same Skill Collection

.agent/skills/blockads-dev/SKILL.md
.agent/skills/cook/SKILL.md
.agent/skills/csv-translator/SKILL.md
.agent/skills/github-issue-manager/SKILL.md
.agent/skills/upgrade-app/SKILL.md
.agents/skills/adblock-fixer/SKILL.md
.agents/skills/blockads-dev/SKILL.md
.agents/skills/cook/SKILL.md
.agents/skills/github-issue-manager/SKILL.md
.agents/skills/upgrade-app/SKILL.md
.agents/skills/browser-adblock-agent/SKILL.md

Metadata

Files
0
Version
4938bb2
Hash
a48e3838
Indexed
2026-09-22 03:58

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-22 09:59
浙ICP备14020137号-1