一键导入
ti-add-comments
Add ti-doc and ti-for-llm comments to mruby code for ti type checker integration
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add ti-doc and ti-for-llm comments to mruby code for ti type checker integration
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | ti-add-comments |
| description | Add ti-doc and ti-for-llm comments to mruby code for ti type checker integration |
You add special comments to mruby code that are consumed by the ti type checker's --llm-nav output.
The user will specify a file: ti-add-comments {file name}.rb
ti filename.rb --llm-nav - List classes and top-level methods that have callers or callees in the codeti filename.rb --llm-nav --target=Name - Display detailed signatures, callers/callees for a specific class or method in the codeIMPORTANT: Always run these commands as-is. Never pipe through head, tail, or any other truncation tool. The full output is required — partial output leads to missing call points and incomplete understanding.
There are two distinct comment types, each serving a different purpose in ti --llm-nav output:
# ti-doc: — Function documentationti --llm-nav --target=Name: [Method Signatures] section as the document: fielddef keyworddef)Example:
# ti-doc: calculate left space for line number
def calculate_line_number_space(line_number)
In ti --llm-nav --target=calculate_line_number_space output, this appears as:
## calculate_line_number_space(Union<untyped Integer>) -> Integer
- file: theme/editor_app.rb:109
- document: calculate left space for line number
- call points:
- theme/editor_app.rb:955
# ti-for-llm: — Important code explanationti --llm-nav: [Special Code Comments] section as the comment: fieldExample:
# ti-for-llm: stores the currently selected completion candidate
$completion_chars = nil
In ti --llm-nav output, this appears as:
[Special Code Comments]
## theme/editor_app.rb:90
- comment: stores the currently selected completion candidate
$completion_chars = nil
Run ti {file}.rb --llm-nav first. It lists classes and top-level methods. Identify which ones are missing document: fields or have vague ones.
For each class or method that needs comments, run:
ti {file}.rb --llm-nav --target=Name
This shows you the method signatures, existing document: fields, and call points. Use this to understand what each method does before writing its comment.
Do not fetch all details upfront — use --llm-nav to identify what needs work, then --target to drill in.
If the --target output doesn't give you enough context to write a good comment, use call points to find the exact line range and read only that range.
Rules:
# ti-doc: to every function that is missing one
def# ti-for-llm: to important non-function code such as:
Run ti {file}.rb --llm-nav and drill into updated targets with --target=Name to confirm all comments appear correctly.
# ti-doc: calculate indent decrease for tokens (just a rephrasing of the name)# ti-doc: returns indent_ct-1 if first token is 'end'/'else'/'elsif'/'when', otherwise returns indent_ct unchangedThe document: field in ti --llm-nav --target=Name output is the primary way an LLM understands your code without reading the source. Write ti-doc: comments rich enough that another LLM can make correct implementation decisions from the output alone.
ti-doc: when relevant-1 (e.g. "direction: 'left' or 'right'")Too vague (LLM still needs to read source):
# ti-doc: handle backspace
def handle_backspace(state)
Rich enough to act on:
# ti-doc: handle backspace key — deletes char at cursor position, or moves to previous line if code is empty; returns true if cursor moved to a different line
def handle_backspace(state)
Too vague:
# ti-for-llm: cursor column index
@cursor_col_index = -1
Rich enough:
# ti-for-llm: cursor column position within current code line — -1 means end of line (default), 0..n means specific position
@cursor_col_index = -1