Skip to content

[dotnet-code] Consolidate skill resource lookup internals #382

Description

@github-actions

Summary

Consolidates skill resource/script indexing and lookup behind unexported providedSkill helpers. This keeps the Go provider internals closer to the .NET AgentSkill shape, where resource and script lookup are explicit skill-level operations, while preserving the existing map-backed exact-name behavior.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI/Skills/AgentSkill.cs - defines skill-owned resource and script lookup surfaces.

Public API and Behavior

No public Go API changed. No intentional behavior change was made.

Tests

  • go test ./agent/skills/...

Notes

Rejected candidates:

  • dotnet/src/Microsoft.Agents.AI.Workflows/OutputTag.cs - Go already has a close internal/public shape for output tags; changing it would be churn.
  • dotnet/src/Microsoft.Agents.AI.Workflows/ScopeId.cs - no clear matching Go implementation surfaced in the sampled workflow area, so a code change would be speculative.
  • dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/AgentResponseExtensions.cs - the Go OpenAI provider does not expose equivalent public conversion extensions, and adding them would risk public API change or feature work.

Generated by .NET-to-Go Code Portability Refactoring Agent · 315.7 AIC · ⌖ 30.4 AIC · ⊞ 20.8K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-code-skill-lookup-helpers-f67d15df366704c3.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (90 of 90 lines)
From b2c87948e7c47c8089e56d33951d9b8405db10c2 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Sun, 28 Jun 2026 22:42:53 +0000
Subject: [PATCH] Consolidate skill resource lookup internals

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/skills/provider.go | 44 ++++++++++++++++++++++++++--------------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/agent/skills/provider.go b/agent/skills/provider.go
index 2ba0d4f21..bfeec849a 100644
--- a/agent/skills/provider.go
+++ b/agent/skills/provider.go
@@ -82,6 +82,32 @@ type providedSkill struct {
 	scripts   map[string]Script
 }
 
+func newProvidedSkill(skill *Skill) providedSkill {
+	resources := make(map[string]Resource, len(skill.Resources))
+	for _, resource := range skill.Resources {
+		resources[resource.Name] = resource
+	}
+	scripts := make(map[string]Script, len(skill.Scripts))
+	for _, script := range skill.Scripts {
+		scripts[script.Name] = script
+	}
+	return providedSkill{
+		skill:     skill,
+		resources: resources,
+		scripts:   scripts,
+	}
+}
+
+func (skill providedSkill) lookupResource(name string) (Resource, bool) {
+	resource, ok := skill.resources[name]
+	return resource, ok
+}
+
+func (skill providedSkill) lookupScript(name string) (Script, bool) {
+	script, ok := skill.scripts[name]
+	return script, ok
+}
+
 type providedSkillSet struct {
 	byName map[string]providedSkill
 }
@@ -329,19 +355,7 @@ func deduplicateSkillsByName(skills []*Skill, logger *slog.Logger) []*Skill {
 func indexSkills(skills []*Skill) providedSkillSet {
 	indexed := make(map[string]providedSkill, len(skills))
 	for _, skill := range skills {
-		resources := make(map[string]Resource)
-		for _, resource := range skill.Resources {
-			resources[resource.Name] = resource
-		}
-		scripts := make(map[string]Script)
-		for _, script := range skill.Scripts {
-			scripts[script.Name] = script
-		}
-		indexed[skill.Frontmatter.Name] 
... (truncated)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions