360 Secure SkillHub
360 安全技能中心

file-analysis

在架构评审、重构规划或迁移范围估算前使用:确认分析根目录,用目录枚举命令映射顶层结构,按扩展名统计文件分布并识别主导语言,采样文件规模并列出大文件、深层嵌套等潜在热点,最后记录文件计数、目录布局与热点,供下游工作流参考。

athola
athola
热度 61.64
最近更新 2026-08-26 21:43:57
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / 工作流 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add nm-sanctum-file-analysis
Metadata
name
file-analysis
description
Maps file structure and module organization of a codebase. Use before architecture reviews, refactoring planning, or migration scope estimation
version
1.9.8
triggers
["files","structure","analysis","codebase","exploration"]
metadata
{"openclaw":{"homepage":"https://github.com/athola/claude-night-market/tree/master/plugins/sanctum","emoji":"🦞","requires":{"config":["night-market.sanctum:shared","night-market.imbue:proof-of-work"]}}}
source
claude-night-market
source_plugin
sanctum

Night Market Skill — ported from claude-night-market/sanctum. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

File Analysis

When To Use

  • Before architecture reviews to understand module boundaries and file organization.
  • When exploring unfamiliar codebases to map structure before making changes.
  • As input to scope estimation for refactoring or migration work.

When NOT To Use

  • General code exploration - use the Explore agent
  • Searching for specific patterns - use Grep directly

Required TodoWrite Items

  1. file-analysis:root-identified
  2. file-analysis:structure-mapped
  3. file-analysis:patterns-detected
  4. file-analysis:hotspots-noted

Mark each item as complete as you finish the corresponding step.

Step 1: Identify Root (file-analysis:root-identified)

  • Confirm the analysis root directory with pwd.
  • Note any monorepo boundaries, workspace roots, or subproject paths.
  • Capture the project type (language, framework) from manifest files (package.json, Cargo.toml, pyproject.toml, etc.).

Step 2: Map Structure (file-analysis:structure-mapped)

  • Run tree -L 2 -d or find . -type d -maxdepth 2 to capture the top-level directory layout.
  • Identify standard directories: src/, lib/, tests/, docs/, scripts/, configs/.
  • Note any non-standard organization patterns that may affect downstream analysis.

Step 3: Detect Patterns (file-analysis:patterns-detected)

  • Use find . -name "*.ext" -not -path "*/.venv/*" -not -path "*/__pycache__/*" -not -path "*/node_modules/*" -not -path "*/.git/*" | wc -l to count files by extension.
  • Identify dominant languages and their file distributions.
  • Note configuration files, generated files, and vendored dependencies.
  • Run wc -l $(find . -not -path "*/.venv/*" -not -path "*/__pycache__/*" -not -path "*/node_modules/*" -not -path "*/.git/*" -name "*.py" -o -name "*.rs" | head -20) to sample file sizes.

Step 4: Note Hotspots (file-analysis:hotspots-noted)

  • Identify large files (potential "god objects"): find . -type f -exec wc -l {} + | sort -rn | head -10.
  • Flag deeply nested directories that may indicate complexity.
  • Note files with unusual naming conventions or placement.

Exit Criteria

  • TodoWrite items are completed with concrete observations.
  • Downstream workflows (architecture review, refactoring) have structural context.
  • File counts, directory layout, and hotspots are documented for reference.