Thorough, file-cited technical debt audit across 9 dimensions using AST-grep (tree-sitter), grep, LSP, and language-native tooling. Produces TECH_DEBT_AUDIT.md
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-tech-debt-audit-57741773023c ,按照其中的说明把「tech-debt-audit」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Model-agnostic technical debt audit for oh-my-openagent (OMO). Uses OMO's built-in tools (grep, glob, bash with sg, read, lsp_diagnostics, task). Produces a grounded, citable TECH_DEBT_AUDIT.md artifact.
Write results to TECH_DEBT_AUDIT.md in the repo root with:
glob("**/*.ts") / glob("**/*.py") / etc — map the language stackglob("**/package.json") + read() — dependencies and build toolingbash("git log --oneline -200") — churn: find highest-change filesglob("**/*") + basic math — find largest files (>300 LOC are candidates)Use OMO tools for each dimension. Run parallel tool calls within each dimension. Every finding MUST cite file:line:col.
bash("sg -p \"import { $$$ } from '$SRC'\" -l ts .") — map module graph, look for circular patternsbash("sg -p \"class $NAME { $$$ }\" -l ts .") — check for god classesgrep("TODO|FIXME|HACK|XXX|WORKAROUND|TEMP") — tagged debt markersgrep("async|await") on sync-looking files — misplaced async boundariesbash("wc -l <file>") on each large file found in Phase 0lsp_find_references)bash("sg -p \"import $CLIENT from '$PKG'\" -l ts .") — multiple HTTP clientsgrep("console.log|console.error|console.warn") — direct console use vs loggerbash("sg -p \"try { $$$ } catch ($$$) { $$$ }\" -l ts .") — error handling patternsgrep("as any|@ts-ignore|@ts-expect-error|as unknown") — type escapesgrep("eslint-disable|prettier-ignore") — lint suppressionsbash("sg -p \"$VALUE as any\" -l ts .") — runtime type escapesgrep("@ts-expect-error") — suppressed errorsgrep("@ts-ignore") — suppressed errors (legacy)bash("sg -p \"$NAME: any\" -l ts .") — typed as anylsp_diagnostics(filePath="<src-dir>") — current type errorsany types on public APIs and exported interfacesglob("**/*.test.ts") — find all test filesbash("bun test 2>&1 | grep -E '(fail|skip|todo)'") — current test healthtest.skip, describe.skip)bash("npm audit --omit=dev 2>&1 | head -40") — known CVEs (if node_modules present)read("package.json") — check dependency count and stale depsgrep(".env|process.env|Bun.env") — env var usagegrep("API_KEY|SECRET|PASSWORD|TOKEN") in non-config files — hardcoded configbash("sg -p \"for ($$$ of $$$) { $$$ await $$$ }\" -l ts .") — async-in-loopgrep("await.*map|await.*filter|await.*forEach") — sequential async iterationgrep("Promise\\.all|Promise\\.allSettled") — existing parallel patterns (good signal)grep("addEventListener|on\\(|subscribe") without removeEventListener|off\\(|unsubscribe nearby — listener hygieneawait inside for/of loops (sequential when parallel possible)bash("sg -p \"catch ($$$) { $$$ }\" -l ts .") — catch blocksgrep("catch.*{}|catch.*{\\s*}") — empty catch blocksgrep("console.error|logger\\.error|log\\.error") — actual error loggingbash("sg -p \"throw new $ERR($$$)\" -l ts .") — error types usedcatch (e) { console.error(e) } without recovery.catch(() => {}))grep("api[Kk]ey|api_secret|password|secret|token|credential") in source files (not config or env)grep("SELECT .* FROM|INSERT INTO|UPDATE.*SET|DELETE FROM") — SQL constructiongrep("innerHTML|dangerouslySetInnerHTML") — XSS vectorsgrep("eval\\(|Function\\(|setTimeout\\(.*string|setInterval\\(.*string") — code injectioninnerHTML / dangerouslySetInnerHTML usageeval() or string-based setTimeout/setIntervalread("README.md") — check if claims match realitygrep("@param|@returns|@throws") — docstring coveragegrep("FIXME|TODO|HACK|XXX|WORKAROUND") — fixme densityFor large codebases (>50k LOC), delegate heavy dimensions to parallel sub-agents. Each sub-agent runs the standard tool passes for its dimensions:
task(category="unspecified-low", run_in_background=true, load_skills=[], prompt="[CONTEXT] Tech debt audit. [GOAL] Audit dimensions 1 (Architecture) and 2 (Consistency). [REQUEST] Run ast_grep and grep searches for dimensions 1-2 from the tech-debt-audit skill. Report every finding with file:line:col. Tag severity: Critical/High/Medium/Low.")
task(category="unspecified-low", run_in_background=true, load_skills=[], prompt="[CONTEXT] Tech debt audit. [GOAL] Audit dimensions 3 (Type debt) and 7 (Error handling). [REQUEST] Run searches for dimensions 3 and 7 from the tech-debt-audit skill. Report every finding with file:line:col. Tag severity.")
Spawn 2-3 sub-agents for the heaviest dimensions, collect results in parallel, then synthesize.
TECH_DEBT_AUDIT.md with all required sectionsCritical = actively causing bugs or security holes
High = will cause problems under normal operation; blocks changes
Medium = reduces maintainability; inconsistent; violates team conventions
Low = cosmetic; would be nice to fix when nearby
file:line:col citation