跳到正文
cccskills
免费在 GitHub 公开

tw-codebase-archaeology

Systematically explore an unfamiliar codebase and build a reusable architecture summary. Use for repo onboarding, understanding legacy or inherited code, mapping architecture before a migration or refactor, tracing a bug or feature path, or answering "what does this project do?". Documentation-first, then data flow — ends in a concise technical architecture summary with file:line evidence, not a raw file dump.

中文简介正在准备中。当前显示原文说明。

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md6.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Codebase Archaeology

Purpose

Build a practical mental model of an unfamiliar codebase without reading files randomly. Start with project guidance and documentation, then trace from entry points through domain logic, storage, integrations, configuration, and tests.

Core rule: documentation first, then data flow

Before reading source, inspect the project-level context:

cat AGENTS.md CLAUDE.md README.md 2>/dev/null | head -200
find . -maxdepth 2 \( -name 'AGENTS.md' -o -name 'CLAUDE.md' -o -name 'README*' -o -name 'CONTRIBUTING*' -o -name 'ARCHITECTURE*' -o -name 'docs' \) -print

Do not skip this. Guidance files and docs often hold architecture notes, setup assumptions, local conventions, and non-obvious constraints that are expensive to rediscover from code alone.

Inputs

InputDefaultNotes
scopewhole repoMay be a package, service, directory, feature, route, command, or file set.
depthstandardquick for a fast map, standard for a normal summary, deep for parallel exploration.
focusarchitecture + data flowMay be entry points, one feature, storage, config, test strategy, or legacy risk.
outputarchitecture summaryAdapt for a map, migration notes, bug trace, or onboarding guide.

Workflow

1. Read project guidance and docs

Capture purpose, runtimes, package managers, local commands, conventions, and named services/apps/packages.

2. Classify repository shape

find . -maxdepth 2 -type f \( -name 'package.json' -o -name 'Cargo.toml' -o -name 'pyproject.toml' -o -name 'go.mod' -o -name 'pom.xml' -o -name 'build.gradle*' -o -name 'composer.json' \) -print
find . -maxdepth 2 -type d | sed 's#^./##' | sort | head -120

Classify as CLI/tooling, web frontend, backend service, full-stack app, library/package, monorepo, data pipeline, or infrastructure/config.

3. Identify entry points

rg -n "fn main|def main|if __name__ == ['\"]__main__['\"]|func main|public static void main|export default|createRoot|FastAPI\(|Flask\(|express\(|Router\(|app\.(get|post|put|delete)|clap|argparse|click|typer|cobra|commander|yargs" .

Record CLI commands, HTTP routes, bootstrap modules, workers/schedulers/consumers, and public library APIs.

4. Find the core domain model

rg -n "(export )?(pub )?(struct|enum|class|interface|type) [A-Z][A-Za-z0-9_]+|@dataclass|BaseModel|z\.object|createTable" .

Do not list every type. Identify the central 3–5 types and explain their relationships, ownership, and lifecycle.

5. Trace data flow

entry point -> parser/router/controller -> service/use case -> domain logic -> storage/integration -> response/output

For each important flow: what input arrives, where validation happens, which module orchestrates, which domain objects change, where persistence/external I/O happens, what output is returned.

6. Map integrations and configuration

rg -n "process\.env|std::env|os\.environ|os\.getenv|dotenv|BaseSettings|viper|serde::Deserialize" .
rg -n "fetch\(|axios|reqwest|requests\.|httpx|grpc|GraphQL|sqlx|diesel|prisma|sequelize|typeorm|sqlalchemy|redis|kafka|sqs|s3|File::|fs\." .

Capture databases, external APIs/SDKs, file I/O, queues/event buses, cron/jobs, env vars, config files, defaults, CLI flags, and credential-loading points — without exposing secret values.

7. Read tests for intended behavior

find . -maxdepth 3 -type d \( -name test -o -name tests -o -name __tests__ -o -name spec \) -print
rg -n "describe\(|it\(|test\(|pytest|#\[test\]|func Test|@Test" .

Capture the framework, the test command, key fixtures, important tested behavior, and gaps where critical flows lack tests.

8. Synthesize — do not dump raw notes

Return a concise architecture model with file:line citations. Do not paste large source snippets. Label inferences and open questions as such.

Parallel exploration (deep mode)

Only when the user asks for parallel/subagent exploration. Fan out read-only workers — one per topic: docs, entry points, domain model, data flow, integrations, tests. Use whatever your harness provides (Claude Code: the Task tool with the Explore agent; Codex: named read-only custom agents or the built-in explorer). Give every worker the same scope and constraints, forbid edits, require file:line evidence, then synthesize one architecture summary yourself. If parallel agents are unavailable, do the same passes inline and say so.

Output template

# [Project] — Technical Architecture Summary

## Executive Summary
[Project] is a [type] that [purpose]. Its main shape is [pattern], with [components].

## Repository Shape
- Languages/runtimes / package-build system / top-level modules / main commands

## Entry Points
| Entry | Location (path:line) | Purpose |

## Architecture Map
[input] -> [router/parser] -> [service] -> [domain] -> [storage/integration] -> [output]

## Key Types
| Type | Location | Purpose | Related modules |

## Data Flow — [flow name]
1. path:line — entry
2. path:line — validation/transform
3. path:line — domain logic
4. path:line — persistence/integration/output

## Integrations and Configuration
| Boundary | Location | Notes |

## Tests and Intended Behavior
- Framework / commands / notable coverage / gaps

## Mental Model
[One or two paragraphs on how to reason about the system when changing it.]

## Open Questions
## Suggested Next Dives

Anti-patterns

Do notDo instead
Start by reading random large filesRead docs, manifests, and entry points first
Dump raw source into the answerSynthesize a mental model with citations
List every class/typeIdentify the few core abstractions
Ignore testsUse tests to infer intended behavior
Treat inferred architecture as factLabel inferences and open questions
Let exploration workers edit filesKeep archaeology read-only

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

catchup

免费

Rebuilds session context after a clear by reading git history, plans, and beads state. Triggers on 'catch up'.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

changelog

免费

Generate a bullet-point summary of branch changes for a PR description. Triggers on "changelog", "pr summary", "summarize branch", or "/changelog".

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

commit

免费

Commit the current changes with quality checks, status review, staged diff inspection, appropriate tests, and a clear commit message. Use when the user says "commit", "c", asks to make a commit, or wants changes saved in git.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

declutter

免费

Refactor code to remove dead code, useless comments, unused variables, and unused imports. Use when asked to declutter a class, clean up noisy code, remove cruft, or run `/refactor:declutter`.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

dry

免费

Refactor duplicated code by extracting helpers, shared abstractions, or clearer reusable structure. Use when asked to apply DRY, remove duplication, consolidate repeated logic, or run `/refactor:dry`.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

查看 SDiamante13 的全部技能

报告此技能的问题