engneer-hamachan/mruby-ti/ti-add-comments
Claude Code and agent skill by engneer-hamachan/mruby-ti
- community
Checking that the SKILL.md file is still in the repository.
Add ti-doc and ti-for-llm comments to mruby code for ti type checker integration
Install
npx vskill@latest install engneer-hamachan/mruby-ti/ti-add-commentsSKILL.md
You add special comments to mruby code that are consumed by the ti type checker's --llm-nav output.
Usage
The user will specify a file: ti-add-comments {file name}.rb
Rule: All comments MUST be written in English
Available Commands
Code understanding (current file)
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 code
IMPORTANT: 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.
Two Comment Types
There are two distinct comment types, each serving a different purpose in ti --llm-nav output:
1. # ti-doc: — Function documentation
- Purpose: Describes what a function does
- Where it appears in `ti --llm-nav --target=Name`:
[Method Signatures]section as thedocument:field - Placement: Always one line above the
defkeyword - Required for: Every function definition (
def)
Example:
In ti --llm-nav --target=calculate_line_number_space output, this appears as:
2. # ti-for-llm: — Important code explanation
- Purpose: Explains significant non-function code (variables, conditional branches, complex logic)
- Where it appears in `ti --llm-nav`:
[Special Code Comments]section as thecomment:field - Placement: Always one line above the target code
- Required for: Important variables, complex conditionals, non-obvious logic that LLMs need context to understand
Example:
In ti --llm-nav output, this appears as:
Workflow
Step 1: Browse the code structure
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.
Step 2: Drill into each target
For each class or method that needs comments, run:
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.
Step 3: Read source when needed
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:
- Read source only when you have a concrete, specific question that the output didn't answer
- Read only the lines needed to answer that question
- Do not read "just in case" or to get a broader picture — form the question first, then read
Step 4: Add comments
- Add `# ti-doc:` to every function that is missing one
- Write a concise English description of what the function does
- Place it on the line immediately above
def
- Add `# ti-for-llm:` to important non-function code such as:
- Global/instance variables with special meaning
- Complex conditional logic that requires explanation
- Key business logic or state transitions
- Non-obvious assignments or calculations
- Review all existing comments — improve unclear or inaccurate ones
Step 5: Verify
Run ti {file}.rb --llm-nav and drill into updated targets with --target=Name to confirm all comments appear correctly.
Guidelines for Writing Good Comments
- Keep comments concise but descriptive (typically 3-10 words for ti-doc)
- Focus on what and why, not how
- Do not repeat the function name in the ti-doc comment
- For ti-for-llm, explain the intent or significance of the code
- The smell test: If your comment could be guessed by just reading the method name, it is not good enough.
The comment must add information that cannot be inferred from the name alone.
- Bad:
# ti-doc: calculate indent decrease for tokens(just a rephrasing of the name) - Good:
# ti-doc: returns indent_ct-1 if first token is 'end'/'else'/'elsif'/'when', otherwise returns indent_ct unchanged
Goal: LLMs should not need to read source code
The 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.
What to include in ti-doc: when relevant
- Return value semantics: What does the return value mean? (e.g. "returns true if cursor moved to a different line")
- Special parameter values: Note sentinel values like
-1(e.g. "direction: 'left' or 'right'") - Side effects: What state does this function mutate? (e.g. "updates state.code and state.cursor_col_index")
- Key constraints: Preconditions or postconditions the caller must know (e.g. "only called when code is non-empty")
Examples
Too vague (LLM still needs to read source):
Rich enough to act on:
Too vague:
Rich enough:
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ti-add-comments/SKILL.md
Popularity
- Repository stars
- 70
- Repository forks
- 2
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/engneer-hamachan/mruby-ti/ti-add-comments)