architectural-analysis
Deep architectural audit focused on finding dead code, duplicated functionality, architectural anti-patterns, type confusion, and code smells. Use when user asks for architectural analysis, find dead code, identify duplication, or assess codebase health.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o architectural-analysis.zip https://jpskill.com/download/18218.zip && unzip -o architectural-analysis.zip && rm architectural-analysis.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18218.zip -OutFile "$d\architectural-analysis.zip"; Expand-Archive "$d\architectural-analysis.zip" -DestinationPath $d -Force; ri "$d\architectural-analysis.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
architectural-analysis.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
architectural-analysisフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
アーキテクチャ分析
指示
構造的な問題、デッドコード、重複、およびシステム的な問題に焦点を当てた、包括的なアーキテクチャ監査を実行します。
フェーズ 1: 発見と計画
ステップ 1: コードベース構造のマッピング
# ディレクトリ構造を取得
find . -type d -not -path "*/node_modules/*" -not -path "*/.git/*"
# ファイルの種類ごとに数を数える
find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" | wc -l
ステップ 2: エントリーポイントの特定
- メインアプリケーションのエントリー (
index.ts,main.ts,app.ts) - API ルート/コントローラー
- パブリックエクスポート (
index.tsファイル) - CLI エントリーポイント
- テストファイル
ステップ 3: 包括的なファイルリストの作成
Glob を使用して、すべてのソースファイルを見つけます。 分析するファイルごとに 1 つの項目を含む ToDo リストを作成します。
フェーズ 2: デッドコードの検出
ToDo リストの各ファイルについて:
ステップ 1: エクスポートの特定
- このファイルは何をエクスポートしますか?
- エクスポートは関数、クラス、型、定数ですか?
- 何かエクスポートされていますか?
ステップ 2: 使用箇所の検索
各エクスポートについて、どこかでインポート/使用されているかどうかを検索します。
# このエクスポートのインポートを検索
grep -r "import.*ExportName" . --include="*.ts" --include="*.tsx"
grep -r "from.*filename" . --include="*.ts" --include="*.tsx"
# 直接的な使用箇所を検索
grep -r "ExportName" . --include="*.ts" --include="*.tsx"
ステップ 3: コードの分類
デッドコード (削除対象としてマーク):
- エクスポートされているが、インポートされていない
- 定義されているが、呼び出されていない関数
- インスタンス化されていないクラス
- 定義されているが、使用されていない型
- 定義されているが、参照されていない定数
- 他のファイルからのインポートがないファイル全体
おそらくデッド (検証が必要):
- コメントアウトされたコードでのみ使用されている
- デッドコードでのみ使用されている
- 他の未使用のエクスポートでのみ使用されている
- 非推奨の機能のテストでのみ使用されている
内部デッドコード:
- ファイル内で定義されているが、呼び出されていない関数 (エクスポートされていない)
- 代入されているが、読み取られていない変数
- 受け入れられているが、使用されていないパラメーター
ステップ 4: 誤検出の確認
以下の場合、デッドコードではありません:
- テストで使用されている (パブリック API の可能性がある)
- 動的にインポート/require されている
- リフレクション/文字列参照を介して使用されている
- パブリック API の一部である (内部で使用されていなくても)
- フレームワークのフック (ライフサイクルメソッド、コールバック)
windowまたはグローバルスコープを介してアクセスされる
ステップ 5: 調査結果の記録
File: path/to/file.ts
Status: [DEAD|POSSIBLY_DEAD|USED]
Exports: [list]
Dead Exports:
- ExportName - インポートが見つかりません
- AnotherExport - 非推奨の機能のテストでのみ使用されています
Confidence: [HIGH|MEDIUM|LOW]
ステップ 6: 完了としてマーク
ToDo リストを更新します。
フェーズ 3: 重複検出
ステップ 1: 重複したロジックパターンの特定
重複を示唆する一般的なパターンを検索します:
- ファイル間で類似した関数名
- 繰り返されるコードブロック
- 同じ概念の複数の実装
手動パターン認識:
- 同じディレクトリ内のファイルを読みます
- 不審なほど類似したコードを探します
- モジュール間でユーティリティ/ヘルパーを比較します
- コピーペーストされたブロックを確認します
Grep ベースの検出:
# 類似した関数シグネチャを検索
grep -r "function validateEmail" . --include="*.ts"
grep -r "async.*fetch.*api" . --include="*.ts"
grep -r "export.*UserForm" . --include="*.tsx"
ステップ 2: 重複した機能の分析
重複の可能性ごとに:
- 両方/すべての実装を読みます
- それらは実際に同じロジックですか?
- 同じケースを処理しますか?
- 一方が他方を置き換えることができますか?
- 違いは意図的ですか、それとも偶然ですか?
ステップ 3: 重複の分類
完全な重複 (CRITICAL):
- 複数の場所に同一またはほぼ同一のコードがある
- コピーペーストされた関数
- 重複したユーティリティ関数
- 影響: バグ修正には複数の更新が必要、メンテナンスの負担
類似したロジック (HIGH):
- 同じアルゴリズム、異なる実装
- わずかに異なるパラメーター処理
- 異なる名前、同じ目的
- 影響: 不整合のリスク、メンテナンスが困難
概念的な重複 (MEDIUM):
- 同じことを行う複数の方法
- 競合する実装
- 重複するユーティリティ
- 影響: 混乱、決定麻痺
型の重複 (HIGH):
- 同じインターフェース/型が複数回定義されている
- 統一されるべき類似した型
- 重複した定数/列挙型
- 影響: 型の不整合、リファクタリングの困難さ
ステップ 4: 重複の記録
Duplication Group: Email Validation
Type: Exact Duplication
Instances:
- src/utils/validators.ts:42 - validateEmail()
- src/lib/email.ts:15 - isValidEmail()
- src/components/forms/validation.ts:67 - checkEmailFormat()
Analysis: 3 つすべてが同じ正規表現チェックを実装しています
Recommendation: utils/validators.ts バージョンを保持し、その他を削除します
Impact: ロジックが変更された場合に更新する場所が 3 つあります
フェーズ 4: アーキテクチャのアンチパターン
ステップ 1: ゴッドオブジェクト/クラスの特定
多くのことを行っているファイルを検索します:
- 500 行を超えるファイル
- 10 個以上のメソッドを持つクラス
- 多くの責任を持つファイル
- あらゆる場所からインポートするモジュール
# 大きなファイルを見つける
find . -name "*.ts" -exec wc -l {} + | sort -rn | head -20
大きなファイルを分析します:
- このファイルは何をしますか?
- 単一責任の原則に従っていますか?
- 分割する必要がありますか?
ステップ 2: 循環依存関係の検出
以下を探します:
- ファイル A が B からインポートし、B が A からインポートする
- 循環チェーン: A → B → C → A
- モジュール結合サイクル
grep を使用してインポートチェーンをトレースします:
# ファイルが何をインポートするかを確認
grep "^import.*from" src/services/auth.ts
# このファイルをインポートするものを確認
grep -r "from.*auth" src/ --include="*.ts"
ステップ 3: 密結合の発見
以下を特定します:
- 低レベルモジュールに依存する高レベルモジュール
- インフラストラクチャに依存するビジネスロジック
- フレームワークの特定に依存するコアロジック
- 多くの他のモジュールからインポートするモジュール
ステップ 4: レイヤー違反の発見
アーキテクチャレイヤーを確認します:
- コンポーネントはデータベースレイヤーから直接インポートしますか?
- モデルはビューからインポートしますか?
- ユーティリティはビジネスロジックからインポートしますか?
- 関心の分離は適切に行われていますか?
ステップ 5: その他のアンチパターンの特定
Singleton の乱用:
- グローバルな状態 eve
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Architectural Analysis
Instructions
Perform comprehensive architectural audit focused on structural issues, dead code, duplication, and systemic problems.
Phase 1: Discovery & Planning
Step 1: Map Codebase Structure
# Get directory structure
find . -type d -not -path "*/node_modules/*" -not -path "*/.git/*"
# Count files by type
find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" | wc -l
Step 2: Identify Entry Points
- Main application entry (
index.ts,main.ts,app.ts) - API routes/controllers
- Public exports (
index.tsfiles) - CLI entry points
- Test files
Step 3: Create Comprehensive File List
Use Glob to find all source files. Create todo list with one item per file to analyze.
Phase 2: Dead Code Detection
For EACH file in the todo list:
Step 1: Identify Exports
- What does this file export?
- Are exports functions, classes, types, constants?
- Is anything exported at all?
Step 2: Search for Usage
For each export, search if it's imported/used anywhere:
# Search for imports of this export
grep -r "import.*ExportName" . --include="*.ts" --include="*.tsx"
grep -r "from.*filename" . --include="*.ts" --include="*.tsx"
# Search for direct usage
grep -r "ExportName" . --include="*.ts" --include="*.tsx"
Step 3: Categorize Code
Dead Code (mark for removal):
- Exported but never imported
- Functions defined but never called
- Classes instantiated nowhere
- Types defined but never used
- Constants defined but never referenced
- Entire files with no imports from other files
Possibly Dead (needs verification):
- Only used in commented-out code
- Only used in dead code
- Only used in other unused exports
- Used only in tests for deprecated features
Internal Dead Code:
- Functions defined in file but never called (not exported)
- Variables assigned but never read
- Parameters accepted but never used
Step 4: Check for False Positives
Not dead if:
- Used in tests (may be public API)
- Dynamically imported/required
- Used via reflection/string references
- Part of public API (even if not used internally)
- Framework hooks (lifecycle methods, callbacks)
- Accessed via
windowor global scope
Step 5: Record Findings
File: path/to/file.ts
Status: [DEAD|POSSIBLY_DEAD|USED]
Exports: [list]
Dead Exports:
- ExportName - No imports found
- AnotherExport - Only used in test for deprecated feature
Confidence: [HIGH|MEDIUM|LOW]
Step 6: Mark Complete
Update todo list.
Phase 3: Duplication Detection
Step 1: Identify Duplicated Logic Patterns
Search for common patterns that suggest duplication:
- Similar function names across files
- Repeated code blocks
- Multiple implementations of same concept
Manual Pattern Recognition:
- Read files in same directory
- Look for suspiciously similar code
- Compare utilities/helpers across modules
- Check for copy-pasted blocks
Grep-Based Detection:
# Find similar function signatures
grep -r "function validateEmail" . --include="*.ts"
grep -r "async.*fetch.*api" . --include="*.ts"
grep -r "export.*UserForm" . --include="*.tsx"
Step 2: Analyze Duplicated Functionality
For each potential duplication:
- Read both/all implementations
- Are they actually the same logic?
- Do they handle same cases?
- Could one replace the other?
- Are differences intentional or accidental?
Step 3: Categorize Duplication
Exact Duplication (CRITICAL):
- Identical or near-identical code in multiple places
- Copy-pasted functions
- Duplicated utility functions
- Impact: Bug fixes need multiple updates, maintenance burden
Similar Logic (HIGH):
- Same algorithm, different implementation
- Slightly different parameter handling
- Different names, same purpose
- Impact: Inconsistency risk, harder to maintain
Conceptual Duplication (MEDIUM):
- Multiple ways to do the same thing
- Competing implementations
- Overlapping utilities
- Impact: Confusion, decision paralysis
Type Duplication (HIGH):
- Same interface/type defined multiple times
- Similar types that should be unified
- Duplicate constants/enums
- Impact: Type inconsistency, refactoring difficulty
Step 4: Record Duplication
Duplication Group: Email Validation
Type: Exact Duplication
Instances:
- src/utils/validators.ts:42 - validateEmail()
- src/lib/email.ts:15 - isValidEmail()
- src/components/forms/validation.ts:67 - checkEmailFormat()
Analysis: All three implement same regex check
Recommendation: Keep utils/validators.ts version, remove others
Impact: 3 places to update when logic changes
Phase 4: Architectural Anti-Patterns
Step 1: Identify God Objects/Classes
Search for files that do too much:
- Files over 500 lines
- Classes with 10+ methods
- Files with many responsibilities
- Modules that import from everywhere
# Find large files
find . -name "*.ts" -exec wc -l {} + | sort -rn | head -20
Analyze large files:
- What does this file do?
- Does it have single responsibility?
- Should it be split?
Step 2: Detect Circular Dependencies
Look for:
- File A imports from B, B imports from A
- Circular chains: A → B → C → A
- Module coupling cycles
Use grep to trace import chains:
# Check what file imports
grep "^import.*from" src/services/auth.ts
# Check what imports this file
grep -r "from.*auth" src/ --include="*.ts"
Step 3: Find Tight Coupling
Identify:
- High-level modules depending on low-level modules
- Business logic depending on infrastructure
- Core logic depending on framework specifics
- Modules that import from many other modules
Step 4: Spot Layer Violations
Check architecture layers:
- Do components import directly from database layer?
- Do models import from views?
- Do utilities import from business logic?
- Is there proper separation of concerns?
Step 5: Identify Other Anti-Patterns
Singleton Abuse:
- Global state everywhere
- Module-level mutable state
- Static class methods accessing shared state
Anemic Domain Models:
- Data classes with no behavior
- All logic in services, models just have getters/setters
Shotgun Surgery:
- Single feature change requires touching many files
- Indicates poor cohesion
Feature Envy:
- Methods that use more data from other classes than their own
Phase 5: Type Issues Analysis
Step 1: Find Type Abuse
Search for problematic type usage:
# Find 'any' usage
grep -r ": any" . --include="*.ts" --include="*.tsx" -n
# Find 'unknown' usage
grep -r ": unknown" . --include="*.ts" -n
# Find type assertions
grep -r "as any" . --include="*.ts" -n
grep -r "as unknown" . --include="*.ts" -n
# Find @ts-ignore
grep -r "@ts-ignore" . --include="*.ts" -n
grep -r "@ts-expect-error" . --include="*.ts" -n
Step 2: Analyze Type Confusion
For each file with type issues:
- Why is
anyused? - Could proper type be defined?
- Is type assertion hiding a real type error?
- Are @ts-ignore comments masking actual problems?
Step 3: Find Type Duplication
Look for:
- Same interface defined in multiple files
- Similar types that could be unified
- Types that could extend from common base
- Constants/enums duplicated across files
Step 4: Identify Missing Types
Check for:
- Implicit
anyfrom missing type annotations - Functions without return type
- Callbacks without proper typing
- Generic types that should be specific
Phase 6: Code Smells Detection
Step 1: Long Methods/Functions
# Find functions with many lines
# (manual inspection of large files)
Flag functions over 50 lines - likely doing too much.
Step 2: Long Parameter Lists
Search for functions with 4+ parameters:
- Could use object parameter instead?
- Are parameters related (should be grouped)?
Step 3: Complex Conditionals
Look for:
- Deeply nested if statements (3+ levels)
- Long boolean expressions
- Switch statements with 10+ cases
- Complex ternary operators
Step 4: Magic Numbers/Strings
Search for:
- Hardcoded numbers with unclear meaning
- String literals used repeatedly
- Unexplained constants
Should be named constants.
Step 5: Commented-Out Code
# Find commented code blocks
grep -r "^[[:space:]]*//.*function\|class\|const" . --include="*.ts"
Commented code should be deleted (use git history).
Step 6: Poor Naming
Look for:
- Single letter variables (outside loops)
- Abbreviations without context (
usr,msg,tmp) - Misleading names
- Names that don't reflect purpose
Phase 7: Generate Report
Create report at .audits/architectural-analysis-[timestamp].md:
# Architectural Analysis Report
**Date**: [timestamp]
**Files Analyzed**: X
**Dead Code Files**: Y
**Duplication Groups**: Z
---
## Executive Summary
- **Dead Code**: X files, Y exports completely unused
- **Duplicated Functionality**: Z duplication groups
- **Architectural Anti-Patterns**: W issues
- **Type Issues**: V problematic usages
- **Code Smells**: U instances
**Estimated Cleanup**: Remove ~X lines of dead code, consolidate Y duplications
---
## Dead Code
### Completely Dead Files (DELETE)
| File | Reason | Confidence |
|------|--------|------------|
| `src/old/legacy-processor.ts` | No imports found | HIGH |
| `src/utils/unused-helper.ts` | Exported but never used | HIGH |
| `src/temp/temp-service.ts` | Temporary file left behind | HIGH |
**Total Lines**: X,XXX lines can be deleted
### Dead Exports (REMOVE)
| File | Export | Reason |
|------|--------|--------|
| `src/utils/format.ts` | `formatOldDate()` | Replaced by `formatDate()`, no usage |
| `src/services/auth.ts` | `oldLogin()` | Deprecated, no usage found |
### Possibly Dead (VERIFY)
| File | Export | Reason | Verification Needed |
|------|--------|--------|---------------------|
| `src/lib/api.ts` | `fetchOldApi()` | Only used in commented code | Check if truly deprecated |
### Internal Dead Code
- `src/services/user.ts:125` - Private method `_validateLegacy()` never called
- `src/components/form.tsx:89` - Variable `tempData` assigned but never read
---
## Duplicated Functionality
### CRITICAL: Exact Duplicates
#### Duplication Group 1: Email Validation
**Instances**: 3
**Files**:
- `src/utils/validators.ts:42` - `validateEmail(email: string)`
- `src/lib/email.ts:15` - `isValidEmail(email: string)`
- `src/components/forms/validation.ts:67` - `checkEmailFormat(email: string)`
**Analysis**: All three use identical regex pattern `/^[^\s@]+@[^\s@]+\.[^\s@]+$/`
**Lines Duplicated**: ~15 lines × 3 = 45 lines
**Recommendation**:
- Keep: `src/utils/validators.ts:validateEmail()`
- Remove: Other two implementations
- Update: All imports to use validators version
#### Duplication Group 2: API Error Handling
**Instances**: 4
**Files**: [list]
**Analysis**: [similar]
### HIGH: Similar Logic
#### Duplication Group: Date Formatting
**Instances**: 2
**Files**:
- `src/utils/date.ts:30` - `formatDate()` - Uses date-fns
- `src/lib/format.ts:45` - `formatDateTime()` - Uses native Date
**Analysis**: Both format dates but use different libraries
**Recommendation**: Standardize on date-fns, remove native version
### Type Duplication
#### Type Group: User Interface
**Instances**: 3
**Files**:
- `src/types/user.ts` - `User` interface
- `src/models/user.ts` - `UserModel` interface (identical fields)
- `src/api/types.ts` - `UserData` interface (identical fields)
**Recommendation**: Use single `User` type from `src/types/user.ts`
---
## Architectural Anti-Patterns
### God Objects
#### `src/services/application-manager.ts` (850 lines)
**Responsibilities**: Database, auth, config, logging, caching, validation
**Issue**: Violates SRP, does everything
**Recommendation**: Split into:
- `database.service.ts`
- `auth.service.ts`
- `config.service.ts`
- `logging.service.ts`
### Circular Dependencies
#### Cycle 1: `auth.ts` ↔ `user.ts`
- `auth.ts` imports `getUserById` from `user.ts`
- `user.ts` imports `validateToken` from `auth.ts`
**Issue**: Creates tight coupling, makes testing hard
**Recommendation**: Extract shared types to separate file
### Tight Coupling
#### `components/UserForm.tsx` → `services/database.ts`
**Issue**: UI component directly importing database layer
**Recommendation**: Use service layer abstraction
### Layer Violations
#### `models/User.ts` imports from `components/`
**Issue**: Model layer should not know about view layer
**Recommendation**: Remove dependency, pass data via props
---
## Type Issues
### `any` Usage (X instances)
| File | Line | Context | Severity |
|------|------|---------|----------|
| `src/api/client.ts` | 45 | `response: any` | HIGH |
| `src/utils/parse.ts` | 23 | `data: any` | HIGH |
**Total `any` usages**: X
**Recommendation**: Define proper types for all cases
### Type Assertions (Y instances)
| File | Line | Assertion | Issue |
|------|------|-----------|-------|
| `src/lib/api.ts` | 67 | `as User` | Unsafe cast, no validation |
| `src/utils/parse.ts` | 89 | `as unknown as T` | Double cast to bypass types |
**Issue**: Type safety bypassed, runtime errors possible
### @ts-ignore Comments (Z instances)
| File | Line | Reason | Should Fix |
|------|------|--------|------------|
| `src/legacy/old.ts` | 34 | "Type error in legacy code" | Refactor or remove file |
---
## Code Smells
### Long Functions (>50 lines)
| File | Function | Lines | Issue |
|------|----------|-------|-------|
| `src/services/processor.ts` | `processData()` | 127 | Does too much, hard to test |
**Recommendation**: Extract smaller functions
### Complex Conditionals
| File | Line | Issue |
|------|------|-------|
| `src/utils/validator.ts` | 45 | Nested 4 levels deep |
| `src/lib/parser.ts` | 89 | Boolean expression spans 3 lines |
### Magic Numbers
| File | Line | Magic Value | Should Be |
|------|------|-------------|-----------|
| `src/config/limits.ts` | 12 | `86400` | `SECONDS_PER_DAY` |
| `src/utils/format.ts` | 34 | `1000` | `MS_PER_SECOND` |
### Commented-Out Code
**Files with commented code**: X
- `src/old/legacy.ts` - 45 lines of commented code
- `src/services/auth.ts` - Old implementation commented out
**Recommendation**: Delete all commented code (use git history)
---
## Statistics
**Dead Code**:
- Files: X
- Exports: Y
- Lines: Z (estimated)
**Duplication**:
- Groups: X
- Files affected: Y
- Duplicated lines: ~Z
**Architectural Issues**:
- God objects: X
- Circular dependencies: Y
- Layer violations: Z
**Type Issues**:
- `any` usage: X
- Type assertions: Y
- @ts-ignore: Z
**Code Smells**:
- Long functions: X
- Complex conditionals: Y
- Magic numbers: Z
---
## Impact Assessment
### Code Cleanup Potential
- **Dead code removal**: ~X,XXX lines
- **Duplication consolidation**: ~Y,YYY lines
- **Total reduction**: ~Z,ZZZ lines (AA% of codebase)
### Maintainability Improvement
- Fewer places to update when fixing bugs
- Clearer code responsibilities
- Better type safety
- Reduced cognitive load
### Risk Areas
- High coupling in `services/` directory
- Type safety compromised in `api/` layer
- Architectural violations in `components/`
Phase 8: Summary for User
Provide concise summary:
# Architectural Analysis Complete
## Dead Code Found
- **X completely dead files** - Can be deleted immediately
- **Y unused exports** - Can be removed
- **~Z,ZZZ lines** of dead code identified
## Top Dead Files
1. `src/old/legacy-processor.ts` - No imports
2. `src/temp/temp-service.ts` - Temporary file
3. `src/utils/unused-helper.ts` - Exported but never used
## Duplication Found
- **X duplication groups** identified
- **Most duplicated**: Email validation (3 copies)
- **~Y,YYY lines** of duplicated code
## Architectural Issues
- **Z god objects** doing too much
- **W circular dependencies** found
- **V layer violations** detected
## Type Issues
- **X `any` usages** - Should have proper types
- **Y type assertions** - Bypassing type safety
- **Z @ts-ignore comments** - Masking errors
## Code Smells
- **X long functions** (>50 lines)
- **Y complex conditionals** (3+ nesting)
- **Z magic numbers** - Should be constants
## Cleanup Potential
Removing dead code and consolidating duplication could eliminate **~X,XXX lines** (Y% of codebase)
**Full Report**: `.audits/architectural-analysis-[timestamp].md`
Critical Principles
- NEVER EDIT FILES - This is analysis only, not cleanup
- NEVER SKIP FILES - Analyze entire codebase systematically
- BE THOROUGH - Dead code detection requires checking all imports
- VERIFY DUPLICATES - Don't just match names, check if logic is same
- UNDERSTAND ARCHITECTURE - See the big picture, not just individual files
- QUANTIFY IMPACT - Count lines, estimate cleanup potential
- BE CONFIDENT - Mark confidence level (HIGH/MEDIUM/LOW) for findings
- TRACK PROGRESS - Use todo list for file-by-file analysis
Success Criteria
A complete architectural analysis includes:
- All files analyzed for dead code
- All exports checked for usage
- Duplication groups identified and cataloged
- Architectural anti-patterns found and explained
- Type issues located and categorized
- Code smells flagged
- Impact assessment quantified
- Structured report generated