codebase-structure-audit

codebase-structure-audit is a skill for Claude Code, Codex from humanerd-drew/opencode-drewgent. It costs 30 tokens per session (2,904 once invoked), scanned A, original, MIT.

A codebase audit and refactoring workflow that maps dependencies, identifies unused code, and applies changes incrementally.

In plain words
What is it for?
Use it before refactoring an unfamiliar project, deleting suspected dead files, consolidating duplicate CSS or data, or planning changes verified by a development server.
Why use it?
It shows what depends on a file before it is moved or deleted, reducing the chance of hidden breakage. It also keeps each change independently checkable.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it before refactoring an unfamiliar project, deleting suspected dead files, consolidating duplicate CSS or data, or planning changes verified by a development server.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/humanerd-drew/opencode-drewgent/codebase-structure-audit
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add humanerd-drew/opencode-drewgent --skill codebase-structure-audit
Clone the repo
git clone --depth 1 https://github.com/humanerd-drew/opencode-drewgent

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codebase-structure-audit

README.md
[![agentmods](https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/codebase-structure-audit.svg)](https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/codebase-structure-audit)
Your own site
<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/codebase-structure-audit"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/codebase-structure-audit.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,904 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.02904
Opus 5 $0.00015 $0.01452
Sonnet 5 $0.00006 $0.00581
Haiku 4.5 $0.00003 $0.00290

Measured 3d ago against content hash df8f2dd21126, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

codebase-structure-audit scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| **Low** | Additive only, no deletion of active code | Adding CSS @import, new route | Dev server + curl |
skills/software-development/codebase-structure-audit/SKILL.md · 263 lines

How it starts

The opening of the file, as written. The whole thing — 263 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codebase Structure Audit & Safe Refactoring

Systematic approach to understanding a project's dependency graph and making safe, incremental changes. Designed for the "안전한 것부터 하나씩" workflow.

When to Use

  • Before refactoring a codebase you're unfamiliar with
  • When asked to "구조 파악" or map file dependencies
  • Before deleting files you suspect are dead code
  • When consolidating duplicate resources (CSS, data files, templates)
  • When planning incremental refactoring with live verification

Do NOT use for: greenfield architecture, performance profiling, or dependency upgrades.

Step 1 — Map the Dependency Graph

File Discovery

find . -type f \( -name '*.ts' -o -name '*.js' -o -name '*.css' -o -name '*.html' \) \
  -not -path './node_modules/*' -not -path './dist/*' -not -path './.wrangler/*' | sort

Import/Reference Tracing

# TypeScript/JS imports
grep -rn "import " --include='*.ts' --include='*.js' \
  --exclude-dir=node_modules --exclude-dir=dist . | sort

# CSS @import chain
grep -rn "@import" --include='*.css' --exclude-dir=node_modules . | sort

# HTML script/style references
grep -rn 'src=\|href=' --include='*.html' --exclude-dir=node_modules . | sort

Component Isolation Check

For each suspected subsystem, verify whether it shares a common CSS/JS entry point or maintains its own:

for html in $(find public -name '*.html' -not -path '*/node_modules/*'); do
  echo "=== $(basename $html) ==="
  grep -o 'href="[^"]*\.css[^"]*"' "$html" | sed 's/href="//;s/"//'
done

Step 2 — Dead Code Detection

File-Level Reference Check

Never delete a file before confirming zero references:

grep -rn "target-filename\|TargetModule" --include='*.{ts,js,html}' \
  --exclude-dir=node_modules . | grep -v "target-file.js"

# For CSS: check HTML href references
grep -rn "target.css" --include='*.html' --exclude-dir=node_modules .

Dead Code Categories

Signal Likelihood Confidence
import from broken path (e.g. ../public/js/ doesn't exist) 100% dead Certain
File exports but zero import from other files across project >95% dead High
Config key defined but zero grep hits for the key name >95% dead High
CSS file not in any @import chain nor directly linked from HTML 100% dead Certain

Read the full file on GitHub · 263 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 263 lines · 30 tokens per session scan A df8f2dd21126

Subscribe to this mod's changes

codebase-structure-audit is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (2 stars, last pushed 1mo ago), licensed MIT. It adds 30 tokens to every session and 2,904 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

code-agent

General-purpose coding agent that reads, writes, and edits code, and searches codebases.

initializ/forge · 21 tokens

dead-code-cleanup

Use when the user asks about cleanup, removing unused code, refactoring, reducing bundle size, or identifying dead code in a Repowise-indexed codebase (.repowise/ directory exists). Also activates when discussing technical debt, code hygiene, or repository maintenance.

repowise-dev/repowise · 59 tokens

ast-grep

Write, debug, and validate ast-grep structural code search rules. Use for syntax-aware code search, AST pattern matching, structural refactor discovery, or searches plain text tools like rg can miss — functions with particular descendants, calls inside specific contexts, decorators, or other Tree-sitter-backed…

bahayonghang/my-ai-cli-toolkit · 64 tokens

tldr-code

Token-efficient code analysis via 5-layer stack (AST, Call Graph, CFG, DFG, PDG). 95% token savings.

parcadei/Continuous-Claude-v3 · 33 tokens

scip-system-compression

Compress systems with scip-query evidence. Use to zoom out, simplify architecture, eliminate layers, consolidate commands, scripts, or helpers, find the deeper role behind unlike-looking code, build a compression atlas before a large cleanup, or execute an ordered simplification without rework.

PlunderStruck/scip-query · 61 tokens

scip-integrity-audit

Audit whether implementations are real with scip-query. Use for suspected faked or half-implemented features, decorative checkers or verifiers that never fail, dead code paths hidden behind graceful fallbacks, metrics that may be lying, or a "does any of this actually work" interrogation of a system.

PlunderStruck/scip-query · 68 tokens