本文へ移動
cccskills
無料GitHub で公開

codebase-audit

Codebase audit + refactoring workflow. Dead code detection, God Object splitting, duplicate function removal, design flaw identification, frontier comparison verification. Triggered by "audit" ("감사"), "dead code" ("데드코드"), "refactor" ("리팩토링"), "god object", "duplication" ("중복"), "design flaw" ("설계 결함") keywords.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Codebase Audit & Refactoring Workflow

A systematic workflow for auditing and improving the entire codebase.

Workflow

1. Audit
   → Dead code + duplicates + God Object + Parameter Bloat detection
2. Triage
   → Verdict: candidate / refactoring / defer, backed by caller evidence
3. Scope and plan
   → Record keep/change/delete decisions; tracking updates only when requested
4. Workspace Isolation
   → Worktree isolation
5. Implementation + Verification
   → Delete/extract/convert then lint + test
6. Docs-sync + authorized integration
   → CHANGELOG for functional changes; tracking docs follow their main-owned workflow

An audit alone does not authorize implementation, merge, global reinstall, or runtime restart. Use the canonical workflow for the requested scope; deploy or restart only when separately in scope.

Phase 1: Audit

Dead Code Detection

# Check import status per module
for f in $(find core/ -name "*.py" -not -name "__init__.py" -not -path "*__pycache__*"); do
    basename=$(basename $f .py)
    # Check using actual import path (basename match alone causes false positives)
    module_path=$(echo $f | sed 's/\.py$//' | tr '/' '.')
    count=$(grep -rn "from ${module_path}\|import ${module_path}" core/ --include="*.py" | grep -v "$f" | wc -l)
    if [ "$count" -eq 0 ]; then
        echo "CANDIDATE: $f ($(wc -l < $f) lines; no matching textual imports)"
    fi
done

Note: Search by full module path, not basename, to reduce false positives. This core-only text scan misses relative imports, outer-package callers, entrypoints, registries, public exports, and dynamic loading. Apply the deletion gate below before deciding that a module is unused.

Duplicate Function Detection

grep -rn "^def " core/ --include="*.py" | awk -F: '{split($NF,a," "); print a[2]}' | sort | uniq -c | sort -rn | head -10

Repeated names are discovery candidates, not proof of duplication. Trace full call paths and compare behavior; protocol methods and local helpers commonly share names legitimately.

God Object Detection (Kent Beck criteria)

find core/ -name "*.py" -not -path "*__pycache__*" -exec wc -l {} + | sort -rn | head -10
  • Large files are candidates for responsibility tracing, not automatic splits.
  • grep -c "^def " FILE counts top-level function declarations, not responsibilities. Trace callers, state ownership, and reasons to change before proposing a split.

Parameter Bloat Detection

grep -rn "def __init__" core/ --include="*.py" -A20 | grep -B1 "def __init__" | head -20
# Review call-site cohesion; parameter count alone is not a finding.

Phase 2: Triage

ClassificationCriteriaAction
Deletion candidateNo textual imports foundApply the agent anti-pattern deletion gate
RefactoringMultiple proven responsibilities or drift pathsUse the smallest extraction that removes the failure
DeferPlanned for future use, or requires large-scale changesKanban Backlog

Before implementation, use the finding record to connect the violated contract, actual caller, counterexample, smallest correction and surviving oracle. Review entry/registration, persisted readers and failure branches; discovery counts are not findings. For deletion, apply the existing deletion gate. Similar setup does not make distinct provider, route, cancellation or cleanup checks redundant. Keep the behavior oracle after refactoring or test deduplication.

Phase 3: Module Extraction Patterns

Circular Import Prevention

Trace dependency direction before extraction. A deferred back-import can hide the cycle rather than remove it; do not bypass a package boundary that way. Use naming conventions §1 and §6 for ownership and the limited reasons to defer an import.

Thin Wrapper (Delegation Function)

Keep a wrapper only for a named compatibility consumer and one canonical implementation. If only symbol identity must be preserved, prefer the existing explicit re-export pattern instead of introducing another function.

re-export (ruff F401 prevention)

from core.cli.tool_handlers import _build_tool_handlers as _build_tool_handlers

Phase 4: Verification

Preserve a surviving check for every affected behavior or invariant after deletion. Follow the verification reference for scope and evidence reuse; do not run a full suite merely to report an audit. Use scripts/preflight.sh when broad checks are warranted and report all skips.

Anti-patterns

  1. Searching imports by basename → false positives (e.g., "repl" matching the string "REPL")
  2. Treating shared names as duplicate behavior → trace callers before changing either implementation
  3. Not deleting originals after refactoring → the most dangerous pattern; old version called from serve, leading to lengthy debugging
  4. Reinstalling or restarting as an audit side effect → require an in-scope deployment request and verify the installation/process owner first

For dead-code or test-deletion decisions, follow .agents/skills/agent-anti-pattern/references/field-guide.md. Zero textual imports, file size, parameter count, and test-only callers are insufficient on their own; check entrypoints, registries, public exports, persisted state, and compatibility contracts first.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audit agent runtimes and their tests for lifecycle inference, capability overload, context pollution, correlated verification, prompt-only control, false success, dead compatibility paths, test-only seams, and complexity without contribution. Use for whole-repository agent audits, slop or dead-code triage, test contribution reviews, large refactors, tool/context simplification, and cleanup requests that need proof before deleting code or tests.

日本語の概要は準備中です。原文の説明を表示しています。

mangowhoiscloud/geode152026年10月12日 更新

Diagnose agent operational failures through default-policy checks, multi-gap analysis, explicit service ownership, request-context lifetime, and degradation-versus-correctness checks.

日本語の概要は準備中です。原文の説明を表示しています。

mangowhoiscloud/geode152026年10月12日 更新

Align, run, audit, and publish GEODE benchmark comparisons against Agent-World arXiv 2604.18292v1 across MCP-Mark, BFCL V4, and tau2-bench. Use for Agent-World or AgentWorld comparison requests, cross-suite agent benchmark design, Tau2 comparator/profile diagnosis, paired thin-runtime-versus-GEODE experiments, mean-accuracy@8 replication, or benchmark comparability and artifact reviews.

日本語の概要は準備中です。原文の説明を表示しています。

mangowhoiscloud/geode152026年10月12日 更新

Verification checklist to prevent fake success. Detects test deletion/disabling, coverage regression, lint bypass, secret exposure. Triggered by "deception", "fake" ("가짜"), "fake success", "verification" ("검증"), "checklist" ("체크리스트"), "deletion detection" ("삭제 탐지"), "regression" keywords.

日本語の概要は準備中です。原文の説明を表示しています。

mangowhoiscloud/geode152026年10月12日 更新

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.

日本語の概要は準備中です。原文の説明を表示しています。

mangowhoiscloud/geode152026年10月12日 更新

Auto-search and summarize latest AI/agent papers.

日本語の概要は準備中です。原文の説明を表示しています。

mangowhoiscloud/geode152026年10月12日 更新

mangowhoiscloud のスキルをすべて見る

このスキルの問題を報告する