Pisuan-Know skill-template-inserter

模板内容插入技能,支持在编辑器指定位置插入模板内容,包括光标位置、文档末尾或指定位置。

install
source · Clone the upstream repo
git clone https://github.com/yogyoho/Pisuan-Know
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/yogyoho/Pisuan-Know "$T" && mkdir -p ~/.claude/skills && cp -r "$T/src/skills/skill_template_inserter" ~/.claude/skills/yogyoho-pisuan-know-skill-template-inserter && rm -rf "$T"
manifest: src/skills/skill_template_inserter/SKILL.md
source content

模板内容插入技能 (Template Inserter Skill)

概述

本技能用于在编辑器中插入模板内容,支持:

  • 位置控制: 光标位置、文档末尾、指定位置
  • 模板获取: 根据模板ID获取模板内容
  • 格式转换: 支持HTML、Markdown等格式
  • 插槽标记: 保留模板中的插槽标记供后续填充

核心功能

1. 在光标位置插入

from src.skills.skill_template_inserter import TemplateInserterSkill

skill = TemplateInserterSkill()
result = await skill.execute(
    template_id="env_impact_chapter_7",
    position="cursor",
)

2. 在文档末尾插入

result = await skill.execute(
    template_id="conclusion_template",
    position="end",
)

3. 在指定位置插入

result = await skill.execute(
    template_id="table_template",
    position="specific",
    target_position={
        "line": 100,
        "column": 0,
    },
)

4. 直接插入内容

result = await skill.execute(
    content="<p>直接插入的内容</p>",
    position="cursor",
)

参数说明

参数类型必需默认值说明
template_idstring否*-模板ID
contentstring否*-直接插入的内容
positionstring"cursor"插入位置(cursor/end/specific)
target_positionobject-指定位置(position为specific时必需)
formatstring"html"内容格式(html/markdown/text)

*注:template_id 和 content 至少提供一个

返回结果

{
  "success": true,
  "data": {
    "inserted": true,
    "content": "<p>插入的内容...</p>",
    "position": "cursor",
    "slots": ["project_name", "total_area"]
  }
}

相关技能