code-semantic-labeler

Automate semantic labeling of code nodes using Python AST analysis.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/bettercallfan/deerflow --skill code-semantic-labeler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-semantic-labeler
Source: https://github.com/bettercallfan/deerflow/tree/main/skills/custom/program_snippet/code-semantic-labeler
Command: npx skills add https://github.com/bettercallfan/deerflow --skill code-semantic-labeler

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires abc, ast, json, os, sys, code-to-ast-new, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill automates the semantic labeling of code, facilitating the mapping of code nodes to urban business semantics, which is crucial for urban brain applications.

Core Features & Use Cases

  • Semantic Labeling: Maps code nodes to urban business semantics using a combination of rule-based and LLM-based approaches.
  • AST Analysis: Uses code-to-ast-new for AST analysis to extract core variables and function calls.
  • Code Summarization: Summarizes code to provide an overall semantic understanding when rules do not match.
  • Use Case: Imagine you have a large codebase in a city brain application. Use this Skill to automatically label nodes in the code, aiding in understanding and managing the codebase.

Quick Start

To analyze code using the code-semantic-labeler skill, use the following command:

python scripts/label.py --code "import cv2\n\n# 读取视频\ncap = cv2.VideoCapture(0)\n\n# 目标检测\nresults = model.predict(frame)\n\n# 目标跟踪\ntracks = tracker.update(results)\n\n# 保存结果\ndb.save(tracks)"

Frequently Asked Questions about code-semantic-labeler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate code semantic labeling for urban brain applications?

Automate code semantic labeling by mapping code nodes to urban business semantics using rule-based and LLM-based approaches. This process applies AST analysis to extract core variables and function calls, providing semantic understanding for large urban brain codebases.

How does AST analysis extract code semantics for summarization?

AST analysis uses the code-to-ast-new library to parse code and extract core variables and function calls. When rules do not match, it summarizes the code to provide an overall semantic understanding of the codebase structure and logic.

Do I need Python 3.7+ to perform code analysis and semantic labeling?

Yes, you need Python 3.7+ along with the abc, ast, json, os, sys, and code-to-ast-new libraries to perform code analysis and semantic labeling. These dependencies are required for the AST analysis and semantic mapping processes.

Can I use code summarization when rule-based semantic labeling fails?

Yes, code summarization is automatically applied when rule-based semantic labeling fails to match. It provides an overall semantic understanding of the code by summarizing the extracted AST nodes and function calls.

What is the best way to map code nodes to urban business semantics?

The best way to map code nodes to urban business semantics is by combining rule-based matching with LLM-based code summarization. This dual approach ensures accurate semantic labeling even when predefined rules do not cover specific code patterns.

What are the limitations of rule-based code semantic labeling?

Rule-based code semantic labeling is limited by its predefined rules, which may not cover all code patterns. When rules fail to match, the system falls back to code summarization to provide an overall semantic understanding of the code.