Skip to content
Agentmart
Submit a tool

code-deconstruct

读取所有源代码,解构为设计图、设计文档、数据库设计; 没有执行文件,请按流程执行

Skill by hellyguo

IndexedApache-2.0★ 8
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hellyguo-code-deconstruct

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

读取所有源代码,解构为设计图、设计文档、数据库设计; 没有执行文件,请按流程执行

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/code-deconstruct

What's inside

Skill name
code-deconstruct
Description
读取所有源代码,解构为设计图、设计文档、数据库设计; 没有执行文件,请按流程执行
License
Apache-2.0
Instructions
233 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • files: referenced but missing: templates/recipes.md

Files (6)

  • SKILL.md
  • algorithm.md · templates/
  • arch_design_summary.md · templates/
  • memory_usage.md · templates/
  • middleware_tracing.md · templates/
  • network_usage.md · templates/

SKILL.md (first lines)

# 源代码解构(设计)

<HARD-GATE>
完整全面,不遗漏细节。
</HARD-GATE>

> 本文件中的 `templates/...` 均指本技能目录下的 `templates/` 子目录。

## 代码解构流程

1. 读取所有源代码,感知项目目的/意图/结构,以及代码之间关系
2. 定位若干核心类,生成主干类图 `docs/deconstruct/classes_graph.puml`
3. 定位核心数据流,生成数据流图 `docs/deconstruct/core_data_flow.puml(md)`
4. 将代码结构分模块编写设计细节文档 `docs/deconstruct/design_{package}/design.md`
5. 分析内存使用代价、探测是否存在内存泄漏 `docs/deconstruct/memory_usage.md`
6. 对核心算法、数据结构,生成算法文档 `docs/deconstruct/algorithm_{package}/algorithm.md`
7. 对重要的架构设计,总结归纳 `docs/deconstruct/arch_design_summary.md`
8. 汇总所有模块的设计细节后,写出全项目设计细节文档 `docs/deconstruct/global_design.md`

### 模块定义

- Java: `package`,如有 maven module,需识别为 `{module}-{package}`
- Python: `package`/`module`
- Ansi C/C++: Makefile target/CMakeLists.txt target
- JS: `module`
- Rust: `mod`,如有 cargo workspace,需识别为 `{member}-{mod}`

## 数据库解构流程

1. 扫描 SQL 文件、MyBatis/iBATIS 映射文件、代码内嵌 SQL
2. 生成数据库清单 `docs/deconstruct/database/database_inventory.md`
3. 构建 ER 图 `docs/deconstruct/database/er_diagram.puml(md)`
4. 生成数据库设计思路摘要 `docs/deconstruct/database/database_design.md`

### SQL 提取规则

- MyBatis: 从 `<sql>` `<select>` `<insert>` `<update>` `<delete>` 标签提取
- Java注解: 从 `@Query` `@NamedQuery` 注解提取
- 字符串: 正则匹配 `(SELECT|INSERT|UPDATE|DELETE)\s+` 开头的字符串

### SQL 提取(ast-grep-mcp 联动)

当 ast-grep-mcp 可用时,优先使用 `find_code_by_rule` 精准提取内嵌 SQL,替代正则匹配。

**Java 内嵌 SQL**:
```
find_code_by_rule(
  project_folder: "<project_root>",
  yaml: '''
    id: sql-string-java
    language: java
    rule:
      pattern: '"$SQL"'
    constraints:
      SQL:
        regex: '(?i)\\b(select|insert|update|delete)\\b.*\\b(from|into|set)\\b'
  '''
)
```

**C++ 内嵌 SQL**:同上,改 `language: cpp`。

**SQL 拼接点识别**:参见 `sql-extract` 技能的 `templates/recipes.md`。

> **注意**:XML(MyBatis mapper)ast-grep 不支持,需用 rg 兜底。详见 `sql-extract` 技能。

## 内存使用分析

识别内存热点:大对象创建、集合操作、字符串处理、字节数组、流处理、缓存对象

探测内存泄漏:静态集合增长、ThreadLocal未清理、监听器未注销、连接未关闭、缓存无过期

模板: `templates/memory_usage.md`

### 内存泄漏 AST 探测(ast-grep-mcp 联动)

**静态集合增长**:
```
find_code_by_rule(
  project_folder: "<project_root>",
  yaml: '''
    id: static-map-leak
    language: java
    rule:
      pattern: 'private static final $MAP_TYPE $VAR = new $CTOR$$$ARGS();'
    constraints:
      MAP_TYPE:
        regex: '(?i).*(Map|HashMap|ConcurrentMap|ConcurrentHashMap|Cache|LinkedHashMap)'
  '''
)
```

**ThreadLocal 未清理**:
```
find_code(
  pattern: 'ThreadLocal $VAR = $$$INIT',
  language: java,
  project_folder: "<dir>"
)
```
> 命中后需人工检查是否有对应的 `.remove()` 调用。

**JDBC 资源未关闭**:
```
find_code_by_rule(
  project_folder: "<project_root>",
  yaml: '''
    id: jdbc-resource-leak
    language: java
    rule:
      any:
        - pattern: '$TYPE $VAR = $CONN.createStatement()'
        - pattern: '$TYPE $VAR = $CONN.prepareStatement($$$ARGS)'
  '''
)
```
> 命中后需人工检查是否在 finally/try-with-resources 中关闭。

## 中间件消息追踪

From hellyguo/self-ai-spec, Apache-2.0.

More from hellyguo/self-ai-spec

Signals

Stars
8
Forks
0
Open issues
0
Last commit (this folder)
Oct 15, 2026 (14 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hellyguo

Cite this page

code-deconstruct skill. Agent Mart. https://agentmart.dev/skills/hellyguo-code-deconstruct (last updated 2026-10-24)