원클릭으로
codebase-survey
Survey a codebase to produce an inventory of structure, dependencies, and patterns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Survey a codebase to produce an inventory of structure, dependencies, and patterns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Discover team members, delegate tasks, and track progress to completion
Prepare structured meeting agendas and pre-reads from task board, artifacts, and team context
Classify, prioritize, and route incoming incidents based on severity, category, and affected components
Classify incoming requests and route to the appropriate specialist agent
How to communicate with other agents on the system. Use when you need to ask questions, share information, or coordinate.
Compare options against weighted criteria with scored matrix, sensitivity analysis, and quantified recommendation
| name | codebase-survey |
| description | Survey a codebase to produce an inventory of structure, dependencies, and patterns |
Use this skill when you need to understand an unfamiliar codebase, onboard to a project, or produce an architectural inventory for the team.
# Codebase Survey: [Project Name]
**Date:** [YYYY-MM-DD]
**Surveyed Path:** [path]
## Overview
[2-3 sentence summary: what this project is, what it does, primary language]
## Directory Structure
[tree output, annotated]
## Language Breakdown
| Language | Files | Lines |
|----------|-------|-------|
| ... | ... | ... |
## Entry Points
| Entry Point | Type | Command |
|-------------|------|---------|
| ... | ... | ... |
## Dependencies
| Package | Version | Purpose |
|---------|---------|---------|
| ... | ... | ... |
## Key Patterns
- [Pattern 1: e.g., "All API handlers follow request/response/error pattern"]
- [Pattern 2: e.g., "Configuration loaded from environment variables"]
## Observations
- [Notable finding 1]
- [Notable finding 2]
- [Potential concern or risk]
TARGET="${1:-~/workspace}"
cd "$TARGET"
echo "=== Directory Structure ==="
tree -L 3 --dirsfirst -I 'node_modules|.git|__pycache__|.venv|dist|build' 2>/dev/null \
|| find . -maxdepth 3 -type f | grep -v 'node_modules\|\.git/' | head -60
echo ""
echo "=== Total Files ==="
find . -type f | grep -v 'node_modules\|\.git/' | wc -l
echo "=== Language Breakdown ==="
find . -type f \
-not -path '*/node_modules/*' \
-not -path '*/.git/*' \
-not -path '*/__pycache__/*' \
-not -path '*/.venv/*' \
| sed 's/.*\.//' \
| sort \
| uniq -c \
| sort -rn \
| head -15
echo ""
echo "=== Line Counts by Language ==="
for ext in js ts py sh json md yaml yml; do
COUNT=$(find . -name "*.$ext" \
-not -path '*/node_modules/*' \
-not -path '*/.git/*' \
-exec cat {} + 2>/dev/null | wc -l)
[ "$COUNT" -gt 0 ] && printf "%-8s %6d lines\n" "$ext" "$COUNT"
done
echo "=== Entry Points ==="
# package.json scripts
if [ -f package.json ]; then
echo "--- package.json scripts ---"
jq -r '.scripts // {} | to_entries[] | " \(.key): \(.value)"' package.json
echo "--- main/bin ---"
jq -r '.main // "not set"' package.json
jq -r '.bin // {} | to_entries[] | " \(.key): \(.value)"' package.json 2>/dev/null
fi
# Python entry points
if [ -f setup.py ] || [ -f pyproject.toml ]; then
echo "--- Python entry points ---"
grep -E 'console_scripts|entry_points|def main' setup.py pyproject.toml 2>/dev/null
find . -name '__main__.py' -not -path '*/node_modules/*' 2>/dev/null
fi
# Makefiles
if [ -f Makefile ]; then
echo "--- Makefile targets ---"
grep -E '^[a-zA-Z_-]+:' Makefile | sed 's/:.*//' | head -20
fi
# Executable scripts
echo "--- Executable scripts ---"
find . -type f -executable -not -path '*/node_modules/*' -not -path '*/.git/*' 2>/dev/null | head -20
# Docker
[ -f Dockerfile ] && echo "--- Dockerfile found ---"
[ -f docker-compose.yml ] && echo "--- docker-compose.yml found ---"
echo "=== Dependencies ==="
# Node.js
if [ -f package.json ]; then
echo "--- npm dependencies ---"
jq -r '.dependencies // {} | to_entries[] | "\(.key)@\(.value)"' package.json
echo "--- npm devDependencies ---"
jq -r '.devDependencies // {} | to_entries[] | "\(.key)@\(.value)"' package.json
fi
# Python
if [ -f requirements.txt ]; then
echo "--- pip requirements ---"
cat requirements.txt
fi
if [ -f pyproject.toml ]; then
echo "--- pyproject.toml dependencies ---"
sed -n '/^\[project\]/,/^\[/p' pyproject.toml | grep -E '^\s+"' 2>/dev/null
fi
# System dependencies
echo "--- System tools used ---"
rg -oh '\b(curl|wget|jq|sed|awk|grep|find|sort|uniq|cut|tr|xargs|tee|wc)\b' \
--type sh --no-filename 2>/dev/null | sort -u
echo "=== Patterns ==="
# Error handling pattern
echo "--- Error handling ---"
rg 'catch|except|\.catch|try\s*\{' --type-add 'code:*.{js,py,ts,sh}' --type code -c 2>/dev/null | head -10
# Logging pattern
echo "--- Logging ---"
rg 'console\.(log|error|warn)|logging\.(info|error|warn|debug)|logger\.' \
--type-add 'code:*.{js,py,ts}' --type code -c 2>/dev/null | head -10
# Configuration pattern
echo "--- Config loading ---"
rg 'process\.env|os\.environ|getenv|\.env|config\.' \
--type-add 'code:*.{js,py,ts}' --type code -l 2>/dev/null | head -10
# Test pattern
echo "--- Test files ---"
find . -name '*test*' -o -name '*spec*' | grep -v node_modules | head -10
SURVEY_FILE="/home/shared/survey-$(date +%Y%m%d)-$(basename $TARGET).md"
# Write the report using the template above, populated with collected data
# Register as artifact
bash /home/shared/scripts/artifact.sh register \
--name "survey-$(basename $TARGET)" \
--type "survey" \
--path "$SURVEY_FILE" \
--description "Codebase survey of $(basename $TARGET)"
echo "Survey written to: $SURVEY_FILE"