360 Secure SkillHub
360 安全技能中心

splitsym

splitsym 是一个 Python 命令行工具,按文件扩展名识别注释语法(#、//、--、;、%、<!-- -->、(* *) 等),提取行注释、块注释与文档字符串,支持指定行范围及自定义 symbols.json 配置,输出带行号的注释文本。

turinfohlen
turinfohlen
热度 30.43
最近更新 2026-05-11 17:46:05
分类:效率依赖:代码执行 / 读写文件应用场景:代码审查 / 文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add splitsym
Metadata
name
splitsym
description
Extract comments and split symbols from source files. Use when users want to extract inline comments, docstrings, or block comments from code files to understand structure or generate documentation.

splitsym

Extract split symbols (line or pair) from source files. Analyzes source code and extracts comments based on file type.

Usage

splitsym <file> [--lines M-N] [--config CONFIG]

Arguments

Argument Description
file Source file to analyze (required)
--lines Optional line range (e.g., 100-200)
--config Path to symbols.json config (default: ~/.config/splitsym/symbols.json)

Supported File Types

Extension Comment Style
.py, .rb, .sh, .yaml # comment
.c, .js, .ts, .java // comment
.sql, .hs -- comment
.lisp, .clj ; comment
.tex, .erl % comment
.html, .xml, .vue <!-- comment -->
.py """docstring""" or '''docstring'''
.ml, .mli (* comment *)

Example

# Extract all comments from a Python file
splitsym myfile.py

# Extract comments from specific line range
splitsym myfile.py --lines 100-200

# Use custom config
splitsym myfile.py --config ./my-symbols.json

Output Format

   123      PAIR: multi-line comment content...
     45    # This is a comment line
  • Line numbers are right-aligned (6 digits)
  • Indentation is preserved
  • PAIR: prefix indicates multi-line block comments