Skip to content

Simplify skill content return and revise usage instructions for resources laoading - #83

Closed
bm23btech11013-hash wants to merge 2 commits into
10xHub:mainfrom
bm23btech11013-hash:main
Closed

Simplify skill content return and revise usage instructions for resources laoading#83
bm23btech11013-hash wants to merge 2 commits into
10xHub:mainfrom
bm23btech11013-hash:main

Conversation

@bm23btech11013-hash

Copy link
Copy Markdown

This pull request updates how skill information and instructions are presented to users. The changes focus on improving the clarity and usability of skill activation and documentation, especially regarding how to use skills and their resources.

Improvements to skill usage instructions and documentation:

  • Enhanced the skill usage instructions in the build_trigger_table method of registry.py to provide a clearer, step-by-step guide on how to activate skills and access additional resources, and restructured the skills listing for better readability.
  • Simplified the output of set_skill in activation.py by removing the appended list of available resources and related instructions, making the returned content more concise.

Removed resource listing from skill content return.

Signed-off-by: Atharva Kulkarni <bm23btech11013@iith.ac.in>
Updated skill usage instructions and formatting in registry.py.

Signed-off-by: Atharva Kulkarni <bm23btech11013@iith.ac.in>
Copilot AI review requested due to automatic review settings April 2, 2026 08:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the skills UX surfaced to the LLM by (1) revising the “available skills” prompt content to include clearer activation instructions and a new skills listing format, and (2) simplifying set_skill() output by no longer appending a resources list.

Changes:

  • Reworked SkillsRegistry.build_trigger_table() output into step-by-step usage guidance plus a trigger-based skills listing.
  • Simplified set_skill() to return only the skill header + content (no “Available Resources” appendix).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
agentflow/skills/registry.py Changes the injected skills prompt text and the per-skill listing format (now trigger-focused).
agentflow/skills/activation.py Changes the set_skill() return contract by removing the appended resources listing/instructions.

lines.append(f"| `{meta.name}` | {safe_desc} |")
# Skill header with triggers
max_triggers_display = 4
triggers_str = ", ".join(f'"{t}"' for t in meta.triggers[:max_triggers_display])

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta.triggers values can include | or newlines (see existing tests), but the new rendering no longer escapes/sanitizes them. This can break the markdown formatting of the injected system prompt and will fail the current sanitization expectations. Consider applying the same escaping as before (replace | with \\|, \n with spaces) per-trigger before joining.

Suggested change
triggers_str = ", ".join(f'"{t}"' for t in meta.triggers[:max_triggers_display])
display_triggers = []
for t in meta.triggers[:max_triggers_display]:
# Escape characters that can break markdown formatting.
sanitized = t.replace("\n", " ").replace("|", "\\|")
display_triggers.append(f'"{sanitized}"')
triggers_str = ", ".join(display_triggers)

Copilot uses AI. Check for mistakes.
Comment on lines +169 to +171
triggers_str = ", ".join(f'"{t}"' for t in meta.triggers[:max_triggers_display])
if len(meta.triggers) > max_triggers_display:
triggers_str += f" (+{len(meta.triggers) - max_triggers_display} more)"

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a skill has no triggers (meta.triggers is empty), the output becomes triggers: with nothing after it. Previously the table fell back to using meta.description in that case, which provides actionable guidance and is covered by existing tests. Please add a fallback (e.g., show the description or a clear "no triggers" marker).

Suggested change
triggers_str = ", ".join(f'"{t}"' for t in meta.triggers[:max_triggers_display])
if len(meta.triggers) > max_triggers_display:
triggers_str += f" (+{len(meta.triggers) - max_triggers_display} more)"
if meta.triggers:
triggers_str = ", ".join(
f'"{t}"' for t in meta.triggers[:max_triggers_display]
)
if len(meta.triggers) > max_triggers_display:
triggers_str += f" (+{len(meta.triggers) - max_triggers_display} more)"
else:
# Fallback: when no triggers are defined, use the skill description
# (previous behavior, and covered by existing tests).
triggers_str = meta.description or "no triggers"

Copilot uses AI. Check for mistakes.
"3. If you need a specific resource mentioned in the skill, "
"call `set_skill(skill_name, resource_name)`\n",
"4. Then provide your answer using the loaded content\n",
"### Skills & Resources\n",

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section header says "### Skills & Resources", but the list that follows only includes triggers and doesn't mention resources (names or counts). Either include resource info here or rename the header to avoid misleading prompt content.

Suggested change
"### Skills & Resources\n",
"### Skills\n",

Copilot uses AI. Check for mistakes.
Comment on lines 93 to 99
content = registry.load_content(skill_name, hot_reload=hot_reload)
if not content:
return f"ERROR: Skill '{skill_name}' found but content could not be loaded."

header = skill_name.upper().replace("-", " ")
result = f"## SKILL: {header}\n\n{content}"

# List available resources (if any)
if meta.resources:
resource_list = "\n".join(f" - {r}" for r in meta.resources)
result += (
f"\n\n---\n### Available Resources\n"
f"This skill has reference documents available. "
f'Call `set_skill("{skill_name}", "<resource_name>")` to load any you need:\n'
f"{resource_list}"
)

return result
return f"## SKILL: {header}\n\n{content}"

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the "Available Resources" section from the skill output, but the existing test suite asserts that set_skill(name) includes a resource list (e.g., tests/test_skills.py::test_skill_content_lists_resources). Update the tests (and any dependent docs) to match the new contract, or provide an alternative way for callers/LLMs to discover resource names.

Copilot uses AI. Check for mistakes.
@Iamsdt

Iamsdt commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

This pr is replaced by #86

@Iamsdt Iamsdt closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants