AgentSkillsCN

code-walk-thru

当用户希望您在EDITOR中逐个浏览(或逐行解读)代码或文本文件时,此技能便能大显身手——您可以借此向用户解释某段代码的运行原理,或展示您所做的代码改动等。通常,您会多次使用此技能,逐一向用户展示您的代码改动或文件内容,有时还会特别标注具体行号。这样一来,用户便能在自己喜爱的EDITOR中轻松跟随您的讲解,随时关注您在各个文件中所作的修改,甚至精确到文件内的特定行号。

SKILL.md
--- frontmatter
name: code-walk-thru
description: Use this when user wants you to walk through (code or text) files in a EDITOR to either explain how some code works, or to show the user what changes you made, etc. You would typically use this repeatedly to show the user your changes or code files one by one, sometimes with specific line-numbers. This way the user is easily able to follow along in their favorite EDITOR as you point at various files possibly at specific line numbers within those files.
template: "`# asdfasdf`"

code-walk-thru

Instructions

Depending on which EDITOR the user says they are using, you will use a different "show-file" cli command that shows (in the EDITOR) a specific file, optionally at specific line-number, as in examples below. If no editor specified, you must ask the user which editor they are using.

IMPORTANT: you must walk thru the files ONE BY ONE, and you MUST wait for the user to say something before moving on to the next file, or to same file different line.

  • VSCode:
code
code --goto <file_path>:<line_number>
  • PyCharm:
code
pycharm --line <line_number> <file_path>
  • IntelliJ:
code
intellij --line <line_number> <file_path>
  • Zed:
code
zed path/to/file.md:43
  • Vim/Neovim:
code
vim +42 blah.py
nvim +42 blah.py

If any of these fail tell the user to install the corresponding CLI tool for their editor.