code-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Analysis — AST, Dependency Graphs & Knowledge Graphs

代码分析——AST、依赖图与知识图谱

Parse, analyze, and visualize code structure through AST analysis, dependency graphing, and knowledge extraction. Supports Python (via
ast
module) and JavaScript/TypeScript (via
grep
-based import parsing and optional
@babel/parser
/
ts-morph
).
通过AST分析、依赖图构建和知识提取来解析、分析和可视化代码结构。支持Python(通过
ast
模块)以及JavaScript/TypeScript(通过基于
grep
的导入解析,可选使用
@babel/parser
/
ts-morph
)。

When to use

适用场景

Use this skill when:
  • Building or updating a dependency graph of the codebase
  • Analyzing imports to detect circular dependencies or layer violations
  • Parsing Python AST to extract class hierarchies, function signatures, or call graphs
  • Parsing JavaScript/TypeScript source to extract React component trees, ESM imports, and hook usage
  • Generating a knowledge graph of code entities and their relationships
  • Measuring code complexity (cyclomatic, cognitive, LOC) per module
  • Identifying dead code, unused imports, or orphan modules
  • Mapping how data flows through the SDK layers or SPA component hierarchy
  • Understanding coupling between modules before a refactor
  • Analyzing a SPA's source code structure (component graph, barrel exports, route tree)
在以下场景中使用本技能:
  • 构建或更新代码库的依赖图
  • 分析导入以检测循环依赖或层级违规
  • 解析Python AST以提取类层次结构、函数签名或调用图
  • 解析JavaScript/TypeScript源码以提取React组件树、ESM导入和Hook使用情况
  • 生成代码实体及其关联关系的知识图谱
  • 按模块测量代码复杂度(圈复杂度、认知复杂度、代码行数)
  • 识别死代码、未使用的导入或孤立模块
  • 映射数据流在SDK层级或SPA组件层次中的流动路径
  • 在重构前理解模块间的耦合度
  • 分析SPA的源码结构(组件图、桶导出、路由树)

Instructions

操作步骤

Step 1: AST Parsing

步骤1:AST解析

Parse Python source files to extract structured representations of code entities.
python
import ast
from pathlib import Path

def parse_module(filepath: str) -> dict:
    """Extract entities from a Python module via AST."""
    source = Path(filepath).read_text()
    tree = ast.parse(source, filename=filepath)

    entities = {
        "module": filepath,
        "classes": [],
        "functions": [],
        "imports": [],
        "constants": [],
    }

    for node in ast.walk(tree):
        if isinstance(node, ast.ClassDef):
            entities["classes"].append({
                "name": node.name,
                "bases": [ast.dump(b) for b in node.bases],
                "methods": [n.name for n in node.body if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef))],
                "decorators": [ast.dump(d) for d in node.decorator_list],
                "lineno": node.lineno,
            })
        elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
            if not any(isinstance(parent, ast.ClassDef) for parent in ast.walk(tree)):
                entities["functions"].append({
                    "name": node.name,
                    "args": [arg.arg for arg in node.args.args],
                    "returns": ast.dump(node.returns) if node.returns else None,
                    "is_async": isinstance(node, ast.AsyncFunctionDef),
                    "lineno": node.lineno,
                })
        elif isinstance(node, ast.Import):
            for alias in node.names:
                entities["imports"].append({"module": alias.name, "alias": alias.asname})
        elif isinstance(node, ast.ImportFrom):
            entities["imports"].append({
                "module": node.module,
                "names": [alias.name for alias in node.names],
                "level": node.level,
            })

    return entities
解析Python源文件以提取代码实体的结构化表示。
python
import ast
from pathlib import Path

def parse_module(filepath: str) -> dict:
    """Extract entities from a Python module via AST."""
    source = Path(filepath).read_text()
    tree = ast.parse(source, filename=filepath)

    entities = {
        "module": filepath,
        "classes": [],
        "functions": [],
        "imports": [],
        "constants": [],
    }

    for node in ast.walk(tree):
        if isinstance(node, ast.ClassDef):
            entities["classes"].append({
                "name": node.name,
                "bases": [ast.dump(b) for b in node.bases],
                "methods": [n.name for n in node.body if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef))],
                "decorators": [ast.dump(d) for d in node.decorator_list],
                "lineno": node.lineno,
            })
        elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
            if not any(isinstance(parent, ast.ClassDef) for parent in ast.walk(tree)):
                entities["functions"].append({
                    "name": node.name,
                    "args": [arg.arg for arg in node.args.args],
                    "returns": ast.dump(node.returns) if node.returns else None,
                    "is_async": isinstance(node, ast.AsyncFunctionDef),
                    "lineno": node.lineno,
                })
        elif isinstance(node, ast.Import):
            for alias in node.names:
                entities["imports"].append({"module": alias.name, "alias": alias.asname})
        elif isinstance(node, ast.ImportFrom):
            entities["imports"].append({
                "module": node.module,
                "names": [alias.name for alias in node.names],
                "level": node.level,
            })

    return entities

Step 2: Dependency Graph Construction

步骤2:依赖图构建

Build a directed graph of module-to-module dependencies.
bash
undefined
构建模块间依赖的有向图。
bash
undefined

Quick import graph using grep

Quick import graph using grep

grep -rn "from pplx_sdk" pplx_sdk/ --include="*.py" |
awk -F: '{print $1 " -> " $2}' |
sed 's|pplx_sdk/||g' | sort -u
grep -rn "from pplx_sdk" pplx_sdk/ --include="*.py" |
awk -F: '{print $1 " -> " $2}' |
sed 's|pplx_sdk/||g' | sort -u

Or using Python AST for precision

Or using Python AST for precision

python3 -c " import ast, os, json graph = {} for root, dirs, files in os.walk('pplx_sdk'): for f in files: if f.endswith('.py'): path = os.path.join(root, f) module = path.replace('/', '.').replace('.py', '') tree = ast.parse(open(path).read()) deps = set() for node in ast.walk(tree): if isinstance(node, ast.ImportFrom) and node.module: if node.module.startswith('pplx_sdk'): deps.add(node.module) elif isinstance(node, ast.Import): for alias in node.names: if alias.name.startswith('pplx_sdk'): deps.add(alias.name) if deps: graph[module] = sorted(deps) print(json.dumps(graph, indent=2)) "
undefined
python3 -c " import ast, os, json graph = {} for root, dirs, files in os.walk('pplx_sdk'): for f in files: if f.endswith('.py'): path = os.path.join(root, f) module = path.replace('/', '.').replace('.py', '') tree = ast.parse(open(path).read()) deps = set() for node in ast.walk(tree): if isinstance(node, ast.ImportFrom) and node.module: if node.module.startswith('pplx_sdk'): deps.add(node.module) elif isinstance(node, ast.Import): for alias in node.names: if alias.name.startswith('pplx_sdk'): deps.add(alias.name) if deps: graph[module] = sorted(deps) print(json.dumps(graph, indent=2)) "
undefined

Expected Layer Dependencies

预期层级依赖

mermaid
graph TD
    subgraph Valid["✅ Valid Dependencies"]
        client --> domain
        client --> transport
        client --> shared
        domain --> transport
        domain --> shared
        domain --> core
        transport --> shared
        transport --> core
        shared --> core
    end

    subgraph Invalid["❌ Layer Violations"]
        core -.->|VIOLATION| shared
        core -.->|VIOLATION| transport
        shared -.->|VIOLATION| transport
        transport -.->|VIOLATION| domain
    end

    style Valid fill:#e8f5e9
    style Invalid fill:#ffebee
mermaid
graph TD
    subgraph Valid["✅ Valid Dependencies"]
        client --> domain
        client --> transport
        client --> shared
        domain --> transport
        domain --> shared
        domain --> core
        transport --> shared
        transport --> core
        shared --> core
    end

    subgraph Invalid["❌ Layer Violations"]
        core -.->|VIOLATION| shared
        core -.->|VIOLATION| transport
        shared -.->|VIOLATION| transport
        transport -.->|VIOLATION| domain
    end

    style Valid fill:#e8f5e9
    style Invalid fill:#ffebee

Step 3: Knowledge Graph Extraction

步骤3:知识图谱提取

Build a knowledge graph connecting code entities with typed relationships.
构建连接代码实体与类型化关系的知识图谱。

Entity Types

实体类型

EntitySourceExample
Module
File path
pplx_sdk.transport.sse
Class
AST ClassDef
SSETransport
,
PerplexityClient
Function
AST FunctionDef
stream_ask
,
retry_with_backoff
Protocol
typing.Protocol
Transport
,
StreamParser
Exception
Exception subclass
TransportError
,
RateLimitError
Type
TypeAlias
Headers
,
JSONData
,
Mode
Constant
Module-level assign
SSE_ENDPOINT
,
DEFAULT_TIMEOUT
EntitySourceExample
Module
File path
pplx_sdk.transport.sse
Class
AST ClassDef
SSETransport
,
PerplexityClient
Function
AST FunctionDef
stream_ask
,
retry_with_backoff
Protocol
typing.Protocol
Transport
,
StreamParser
Exception
Exception subclass
TransportError
,
RateLimitError
Type
TypeAlias
Headers
,
JSONData
,
Mode
Constant
Module-level assign
SSE_ENDPOINT
,
DEFAULT_TIMEOUT

Relationship Types

关系类型

RelationshipMeaningExample
IMPORTS
Module imports another
transport.sse IMPORTS core.protocols
DEFINES
Module defines entity
core.exceptions DEFINES TransportError
INHERITS
Class extends another
AuthenticationError INHERITS TransportError
IMPLEMENTS
Class implements protocol
SSETransport IMPLEMENTS Transport
CALLS
Function calls another
stream_ask CALLS retry_with_backoff
RETURNS
Function returns type
stream_ask RETURNS Iterator[StreamChunk]
RAISES
Function raises exception
request RAISES AuthenticationError
USES_TYPE
Function uses type hint
request USES_TYPE Headers
BELONGS_TO
Entity belongs to layer
SSETransport BELONGS_TO transport
RelationshipMeaningExample
IMPORTS
Module imports another
transport.sse IMPORTS core.protocols
DEFINES
Module defines entity
core.exceptions DEFINES TransportError
INHERITS
Class extends another
AuthenticationError INHERITS TransportError
IMPLEMENTS
Class implements protocol
SSETransport IMPLEMENTS Transport
CALLS
Function calls another
stream_ask CALLS retry_with_backoff
RETURNS
Function returns type
stream_ask RETURNS Iterator[StreamChunk]
RAISES
Function raises exception
request RAISES AuthenticationError
USES_TYPE
Function uses type hint
request USES_TYPE Headers
BELONGS_TO
Entity belongs to layer
SSETransport BELONGS_TO transport

Knowledge Graph as Mermaid

知识图谱(Mermaid格式)

mermaid
graph LR
    subgraph core["core/"]
        Transport[/"Transport<br/>(Protocol)"/]
        PerplexitySDKError["PerplexitySDKError"]
        TransportError["TransportError"]
    end

    subgraph transport["transport/"]
        SSETransport["SSETransport"]
        HttpTransport["HttpTransport"]
    end

    subgraph shared["shared/"]
        retry["retry_with_backoff()"]
    end

    SSETransport -->|IMPLEMENTS| Transport
    HttpTransport -->|IMPLEMENTS| Transport
    TransportError -->|INHERITS| PerplexitySDKError
    SSETransport -->|RAISES| TransportError
    HttpTransport -->|CALLS| retry

    style core fill:#e1f5fe
    style transport fill:#fff3e0
    style shared fill:#f3e5f5
mermaid
graph LR
    subgraph core["core/"]
        Transport[/"Transport<br/>(Protocol)"/]
        PerplexitySDKError["PerplexitySDKError"]
        TransportError["TransportError"]
    end

    subgraph transport["transport/"]
        SSETransport["SSETransport"]
        HttpTransport["HttpTransport"]
    end

    subgraph shared["shared/"]
        retry["retry_with_backoff()"]
    end

    SSETransport -->|IMPLEMENTS| Transport
    HttpTransport -->|IMPLEMENTS| Transport
    TransportError -->|INHERITS| PerplexitySDKError
    SSETransport -->|RAISES| TransportError
    HttpTransport -->|CALLS| retry

    style core fill:#e1f5fe
    style transport fill:#fff3e0
    style shared fill:#f3e5f5

Step 4: Code Complexity Analysis

步骤4:代码复杂度分析

bash
undefined
bash
undefined

Lines of code per module

Lines of code per module

find pplx_sdk -name "*.py" -exec wc -l {} + | sort -n
find pplx_sdk -name "*.py" -exec wc -l {} + | sort -n

Cyclomatic complexity (if radon is available)

Cyclomatic complexity (if radon is available)

pip install radon 2>/dev/null && radon cc pplx_sdk/ -s -a
pip install radon 2>/dev/null && radon cc pplx_sdk/ -s -a

Function count per module

Function count per module

grep -c "def " pplx_sdk/**/.py 2>/dev/null ||
find pplx_sdk -name "
.py" -exec grep -c "def " {} +
grep -c "def " pplx_sdk/**/.py 2>/dev/null ||
find pplx_sdk -name "
.py" -exec grep -c "def " {} +

Class count per module

Class count per module

find pplx_sdk -name "*.py" -exec grep -c "class " {} +
undefined
find pplx_sdk -name "*.py" -exec grep -c "class " {} +
undefined

Step 5: Pattern Detection

步骤5:模式检测

Detect common patterns and anti-patterns in the codebase:
CheckCommandWhat to Look For
Circular importsAST import graph cycle detectionCycles in the dependency graph
Layer violationsImport direction analysisLower layers importing higher layers
Unused imports
ruff check --select F401
Imports that are never used
Dead code
vulture pplx_sdk/
(if available)
Functions/classes never called
Missing types
mypy pplx_sdk/ --strict
Untyped functions or
Any
usage
Large functionsAST line count per functionFunctions > 50 lines
Deep nestingAST indent depth analysisNesting > 4 levels
Protocol conformanceCompare class methods vs ProtocolMissing protocol method implementations
检测代码库中的常见模式与反模式:
检查项命令关注内容
循环导入AST导入图循环检测依赖图中的循环
层级违规导入方向分析下层模块导入上层模块
未使用导入
ruff check --select F401
从未使用的导入
死代码
vulture pplx_sdk/
(若已安装)
从未被调用的函数/类
缺失类型
mypy pplx_sdk/ --strict
未类型化的函数或
Any
的使用
大型函数按函数统计代码行数超过50行的函数
深层嵌套AST缩进深度分析嵌套层级超过4层
协议合规性类方法与协议对比缺失的协议方法实现

Step 6: JavaScript/TypeScript Code Graph (SPA)

步骤6:JavaScript/TypeScript代码图(SPA)

When analyzing a SPA codebase (React, Next.js, Vite), build a code graph from JavaScript/TypeScript source files.
分析SPA代码库(React、Next.js、Vite)时,从JavaScript/TypeScript源文件构建代码图。

Import Graph Extraction

导入图提取

bash
undefined
bash
undefined

ESM imports (import ... from '...')

ESM imports (import ... from '...')

grep -rn "import .* from " src/ --include=".ts" --include=".tsx" --include=".js" --include=".jsx" |
sed "s/:/ → /" | sort -u
grep -rn "import .* from " src/ --include=".ts" --include=".tsx" --include=".js" --include=".jsx" |
sed "s/:/ → /" | sort -u

Re-exports / barrel files

Re-exports / barrel files

grep -rn "export .* from " src/ --include=".ts" --include=".tsx" | sort -u
grep -rn "export .* from " src/ --include=".ts" --include=".tsx" | sort -u

Dynamic imports (lazy loading / code splitting)

Dynamic imports (lazy loading / code splitting)

grep -rn "import(" src/ --include=".ts" --include=".tsx" | sort -u
grep -rn "import(" src/ --include=".ts" --include=".tsx" | sort -u

CommonJS requires (legacy)

CommonJS requires (legacy)

grep -rn "require(" src/ --include="*.js" | sort -u
undefined
grep -rn "require(" src/ --include="*.js" | sort -u
undefined

React Component Tree

React组件树

bash
undefined
bash
undefined

Find all React components (function components)

Find all React components (function components)

grep -rn "export (default )?function |export const .* = (" src/ --include=".tsx" --include=".jsx"
grep -rn "export (default )?function |export const .* = (" src/ --include=".tsx" --include=".jsx"

Find component usage (JSX self-closing or opening tags)

Find component usage (JSX self-closing or opening tags)

grep -rn "<[A-Z][a-zA-Z][\ />\n]" src/ --include=".tsx" --include=".jsx" |
grep -oP '<[A-Z][a-zA-Z]
' | sort | uniq -c | sort -rn
grep -rn "<[A-Z][a-zA-Z][\ />\n]" src/ --include=".tsx" --include=".jsx" |
grep -oP '<[A-Z][a-zA-Z]
' | sort | uniq -c | sort -rn

Find hooks usage

Find hooks usage

grep -rn "use[A-Z][a-zA-Z](" src/ --include=".ts" --include=".tsx" |
grep -oP 'use[A-Z][a-zA-Z]
' | sort | uniq -c | sort -rn
grep -rn "use[A-Z][a-zA-Z](" src/ --include=".ts" --include=".tsx" |
grep -oP 'use[A-Z][a-zA-Z]
' | sort | uniq -c | sort -rn

Find context providers

Find context providers

grep -rn "createContext|.Provider" src/ --include=".tsx" --include=".ts"
undefined
grep -rn "createContext|.Provider" src/ --include=".tsx" --include=".ts"
undefined

Route Tree (Next.js / React Router)

路由树(Next.js / React Router)

bash
undefined
bash
undefined

Next.js App Router pages

Next.js App Router pages

find app/ -name "page.tsx" -o -name "page.jsx" -o -name "layout.tsx" 2>/dev/null
find app/ -name "page.tsx" -o -name "page.jsx" -o -name "layout.tsx" 2>/dev/null

Next.js Pages Router

Next.js Pages Router

find pages/ -name ".tsx" -o -name ".jsx" 2>/dev/null
find pages/ -name ".tsx" -o -name ".jsx" 2>/dev/null

React Router route definitions

React Router route definitions

grep -rn "Route|createBrowserRouter|path:" src/ --include=".tsx" --include=".ts"
undefined
grep -rn "Route|createBrowserRouter|path:" src/ --include=".tsx" --include=".ts"
undefined

SPA Dependency Graph as Mermaid

SPA依赖图(Mermaid格式)

mermaid
graph TD
    subgraph pages["Pages / Routes"]
        SearchPage["SearchPage"]
        ThreadPage["ThreadPage"]
    end

    subgraph components["Components"]
        SearchBar["SearchBar"]
        ResponseView["ResponseView"]
        SourceCard["SourceCard"]
    end

    subgraph hooks["Hooks"]
        useQuery["useQuery()"]
        useStreaming["useStreaming()"]
        useAuth["useAuth()"]
    end

    subgraph services["Services / API"]
        apiClient["apiClient"]
        sseHandler["sseHandler"]
    end

    SearchPage --> SearchBar
    SearchPage --> useQuery
    ThreadPage --> ResponseView
    ThreadPage --> useStreaming
    ResponseView --> SourceCard
    useQuery --> apiClient
    useStreaming --> sseHandler
    SearchBar --> useAuth

    style pages fill:#e1f5fe
    style components fill:#fff3e0
    style hooks fill:#f3e5f5
    style services fill:#e8f5e9
mermaid
graph TD
    subgraph pages["Pages / Routes"]
        SearchPage["SearchPage"]
        ThreadPage["ThreadPage"]
    end

    subgraph components["Components"]
        SearchBar["SearchBar"]
        ResponseView["ResponseView"]
        SourceCard["SourceCard"]
    end

    subgraph hooks["Hooks"]
        useQuery["useQuery()"]
        useStreaming["useStreaming()"]
        useAuth["useAuth()"]
    end

    subgraph services["Services / API"]
        apiClient["apiClient"]
        sseHandler["sseHandler"]
    end

    SearchPage --> SearchBar
    SearchPage --> useQuery
    ThreadPage --> ResponseView
    ThreadPage --> useStreaming
    ResponseView --> SourceCard
    useQuery --> apiClient
    useStreaming --> sseHandler
    SearchBar --> useAuth

    style pages fill:#e1f5fe
    style components fill:#fff3e0
    style hooks fill:#f3e5f5
    style services fill:#e8f5e9

SPA Entity Types

SPA实体类型

EntitySourceExample
Component
Function returning JSX
SearchBar
,
ResponseView
Hook
use*
function
useQuery
,
useAuth
Context
createContext()
AuthContext
,
ThemeContext
Route
Page/layout file
/search
,
/thread/[id]
Service
API client module
apiClient
,
sseHandler
Store
State managementZustand store, Redux slice
Type
TypeScript interface/type
SearchResult
,
ThreadData
EntitySourceExample
Component
Function returning JSX
SearchBar
,
ResponseView
Hook
use*
function
useQuery
,
useAuth
Context
createContext()
AuthContext
,
ThemeContext
Route
Page/layout file
/search
,
/thread/[id]
Service
API client module
apiClient
,
sseHandler
Store
State managementZustand store, Redux slice
Type
TypeScript interface/type
SearchResult
,
ThreadData

SPA Relationship Types

SPA关系类型

RelationshipMeaningExample
RENDERS
Component renders another
SearchPage RENDERS SearchBar
USES_HOOK
Component uses a hook
SearchPage USES_HOOK useQuery
PROVIDES
Component provides context
AuthProvider PROVIDES AuthContext
CONSUMES
Component consumes context
SearchBar CONSUMES AuthContext
CALLS_API
Hook/service calls API endpoint
useQuery CALLS_API /rest/search
IMPORTS
Module imports another
SearchPage IMPORTS SearchBar
LAZY_LOADS
Dynamic import for code splitting
App LAZY_LOADS SettingsPage
EXTENDS_TYPE
Type extends another
ThreadResponse EXTENDS_TYPE BaseResponse
RelationshipMeaningExample
RENDERS
Component renders another
SearchPage RENDERS SearchBar
USES_HOOK
Component uses a hook
SearchPage USES_HOOK useQuery
PROVIDES
Component provides context
AuthProvider PROVIDES AuthContext
CONSUMES
Component consumes context
SearchBar CONSUMES AuthContext
CALLS_API
Hook/service calls API endpoint
useQuery CALLS_API /rest/search
IMPORTS
Module imports another
SearchPage IMPORTS SearchBar
LAZY_LOADS
Dynamic import for code splitting
App LAZY_LOADS SettingsPage
EXTENDS_TYPE
Type extends another
ThreadResponse EXTENDS_TYPE BaseResponse

Step 7: Output Insights Report

步骤7:生成洞察报告

Generate a structured report combining all analyses:
markdown
undefined
整合所有分析结果生成结构化报告:
markdown
undefined

Code Analysis Report: pplx-sdk

Code Analysis Report: pplx-sdk

Module Summary

Module Summary

ModuleClassesFunctionsLinesComplexity
core/protocols.py2045A
transport/sse.py15180B
...............
ModuleClassesFunctionsLinesComplexity
core/protocols.py2045A
transport/sse.py15180B
...............

SPA Component Summary (when analyzing JS/TS)

SPA Component Summary (when analyzing JS/TS)

ComponentPropsHooks UsedChildrenLines
SearchPage2useQuery, useAuthSearchBar, ResultList120
...............
ComponentPropsHooks UsedChildrenLines
SearchPage2useQuery, useAuthSearchBar, ResultList120
...............

Dependency Graph

Dependency Graph

[Mermaid diagram]
[Mermaid diagram]

Knowledge Graph

Knowledge Graph

  • N entities, M relationships
  • [Mermaid diagram]
  • N entities, M relationships
  • [Mermaid diagram]

Layer Compliance

Layer Compliance

  • ✅ No circular dependencies
  • ✅ No upward layer violations
  • ⚠️ 2 unused imports detected
  • ✅ No circular dependencies
  • ✅ No upward layer violations
  • ⚠️ 2 unused imports detected

Complexity Hotspots

Complexity Hotspots

FunctionModuleCCLinesRecommendation
_parse_event
transport/sse.py845Consider splitting
FunctionModuleCCLinesRecommendation
_parse_event
transport/sse.py845Consider splitting

Dead Code

Dead Code

EntityModuleLast Referenced
.........
undefined
EntityModuleLast Referenced
.........
undefined

Documentation Discovery

文档发现

When analyzing dependencies or researching libraries, use these discovery methods to find LLM-optimized documentation:
分析依赖或研究库时,使用以下方法查找LLM优化的文档:

llms.txt / llms-full.txt

llms.txt / llms-full.txt

The
llms.txt
standard provides LLM-optimized documentation at known URLs:
bash
undefined
llms.txt
标准在已知URL提供LLM优化的文档:
bash
undefined

Check if a dependency publishes llms.txt

Check if a dependency publishes llms.txt

Check for the full version (entire docs in one file)

Check for the full version (entire docs in one file)

Use the llms-txt MCP server for indexed search

Use the llms-txt MCP server for indexed search

Tools: list_llm_txt, get_llm_txt, search_llm_txt

Tools: list_llm_txt, get_llm_txt, search_llm_txt

undefined
undefined

.well-known/agentskills.io

.well-known/agentskills.io

Discover agent skills published by libraries and frameworks:
bash
undefined
发现库和框架发布的Agent技能:
bash
undefined

Check if a site publishes agent skills

Check if a site publishes agent skills

Look for specific SKILL.md files

Look for specific SKILL.md files

MCP Documentation Servers

MCP文档服务器

MCP ServerPurposeKey Tools
context7
Library docs lookupContext-aware search by library name
deepwiki
GitHub repo documentation
read_wiki_structure
,
read_wiki_contents
,
ask_question
llms-txt
llms.txt file search
list_llm_txt
,
get_llm_txt
,
search_llm_txt
fetch
Any URL as markdownGeneral-purpose URL fetching
MCP Server用途核心工具
context7
库文档查询按库名进行上下文感知搜索
deepwiki
GitHub仓库文档
read_wiki_structure
,
read_wiki_contents
,
ask_question
llms-txt
llms.txt文件搜索
list_llm_txt
,
get_llm_txt
,
search_llm_txt
fetch
转换任意URL为Markdown通用URL抓取

Discovery Workflow

发现流程

1. Check llms.txt at dependency's docs URL
2. Check .well-known/agentskills.io for skills
3. Query deepwiki for the dependency's GitHub repo
4. Query context7 for library-specific context
5. Fall back to fetch for raw documentation URLs
1. 检查依赖文档URL中的llms.txt
2. 检查.well-known/agentskills.io中的技能
3. 查询deepwiki获取依赖的GitHub仓库信息
4. 查询context7获取库特定上下文
5. 回退使用fetch抓取原始文档URL

Integration with Other Skills

与其他技能的集成

When code-analysis finds...Delegate to...Action
Layer violation
architect
Produce corrected dependency diagram
Circular import
code-reviewer
Review and suggest refactor
Missing protocol method
scaffolder
Scaffold missing implementation
Dead code
code-reviewer
Confirm and remove
High complexity
code-reviewer
Review for refactor opportunity
New entity relationships
architect
Update architecture diagrams
SPA component tree
spa-expert
Cross-reference with runtime fiber tree
SPA API endpoints in source
reverse-engineer
Validate against live traffic captures
SPA hook dependencies
architect
Visualize hook → service → API chain
SPA barrel file cycles
code-reviewer
Review circular re-exports
代码分析发现...委托给...操作
层级违规
architect
生成修正后的依赖图
循环导入
code-reviewer
评审并建议重构
缺失协议方法
scaffolder
生成缺失的实现代码
死代码
code-reviewer
确认并移除
高复杂度
code-reviewer
评审重构机会
新实体关系
architect
更新架构图
SPA组件树
spa-expert
与运行时fiber树交叉验证
SPA源码中的API端点
reverse-engineer
与实时流量捕获结果对比验证
SPA Hook依赖
architect
可视化Hook→服务→API的调用链
SPA桶文件循环
code-reviewer
评审循环重导出问题