Agent Skillssandgardenhq/sgai › knowledge

knowledge

GitHub

提供访问sgai工作区中智能体、技能和代码片段的能力,支持列表查询与详情检索,用于发现和理解工作区内定义的知识资产。

docs/sgai-skills/knowledge/SKILL.md sandgardenhq/sgai

触发场景

需要查找工作区内可用的智能体 浏览或获取特定技能的详细说明 按语言查找或检索代码片段内容

安装

npx skills add sandgardenhq/sgai --skill knowledge -g -y
更多选项

非标准路径

npx skills add https://github.com/sandgardenhq/sgai/tree/main/docs/sgai-skills/knowledge -g -y

不安装直接使用

npx skills use sandgardenhq/sgai@knowledge

指定 Agent (Claude Code)

npx skills add sandgardenhq/sgai --skill knowledge -a claude-code -g -y

安装 repo 全部 skill

npx skills add sandgardenhq/sgai --all -g -y

预览 repo 内 skill

npx skills add sandgardenhq/sgai --list

SKILL.md

Frontmatter
{
    "name": "knowledge",
    "description": "Access agents, skills, and code snippets available in sgai workspaces. Use when you need to discover what agents are defined in a workspace, browse available skills, get skill instructions, find code snippets by language, or retrieve snippet content for a specific task.",
    "compatibility": "Requires a running sgai server. Knowledge is workspace-scoped (agents\/skills\/snippets from the workspace .sgai\/ directory)."
}

Knowledge

sgai workspaces contain agent definitions, skills, and code snippets in their .sgai/ directory. Use these endpoints to discover and retrieve that knowledge.

List Available Agents

Endpoint: GET /api/v1/agents?workspace={name}

curl -s "$BASE_URL/api/v1/agents?workspace=my-project"

Response:

{
  "agents": [
    {
      "name": "coordinator",
      "description": "Coordinates the work flow between specialized agents."
    },
    {
      "name": "go",
      "description": "Coordinates Go implementation and review by delegating to Go specialist subagents."
    },
    {
      "name": "react",
      "description": "Coordinates React implementation and review by delegating to React specialist subagents."
    }
  ]
}

Agents are loaded from .sgai/agent/*.md files in the workspace.

List Available Skills

Skills are organized into categories based on their directory structure.

Endpoint: GET /api/v1/skills?workspace={name}

curl -s "$BASE_URL/api/v1/skills?workspace=my-project"

Response:

{
  "categories": [
    {
      "name": "coding-practices",
      "skills": [
        {
          "name": "go-code-review",
          "fullPath": "coding-practices/go-code-review",
          "description": "Go code review checklist based on official Go style guides."
        },
        {
          "name": "react-best-practices",
          "fullPath": "coding-practices/react-best-practices",
          "description": "React and Next.js performance optimization guidelines."
        }
      ]
    },
    {
      "name": "General",
      "skills": [
        {
          "name": "test-driven-development",
          "fullPath": "test-driven-development",
          "description": "Write tests first, watch them fail, then implement."
        }
      ]
    }
  ]
}

Skills are loaded from .sgai/skills/*/SKILL.md files.

Get Skill Detail

Endpoint: GET /api/v1/skills/{path...}?workspace={name}

# Get a skill at a specific path
curl -s "$BASE_URL/api/v1/skills/coding-practices/go-code-review?workspace=my-project"

# Get a top-level skill
curl -s "$BASE_URL/api/v1/skills/test-driven-development?workspace=my-project"

Response:

{
  "name": "go-code-review",
  "fullPath": "coding-practices/go-code-review",
  "content": "<rendered HTML of skill content>",
  "rawContent": "# Go Code Review\n\n## When to Use\n..."
}
  • content — HTML-rendered markdown
  • rawContent — raw markdown without frontmatter

List Code Snippets

Endpoint: GET /api/v1/snippets?workspace={name}

curl -s "$BASE_URL/api/v1/snippets?workspace=my-project"

Response:

{
  "languages": [
    {
      "name": "go",
      "snippets": [
        {
          "name": "HTTP Server with Routes",
          "fileName": "http-server-routes",
          "fullPath": "go/http-server-routes",
          "description": "Set up an HTTP server with Go 1.22+ enhanced routing.",
          "language": "go"
        }
      ]
    },
    {
      "name": "typescript",
      "snippets": [
        {
          "name": "SSE Client Hook",
          "fileName": "sse-client",
          "fullPath": "typescript/sse-client",
          "description": "React hook for Server-Sent Events with reconnection.",
          "language": "typescript"
        }
      ]
    }
  ]
}

List Snippets by Language

Endpoint: GET /api/v1/snippets/{lang}?workspace={name}

curl -s "$BASE_URL/api/v1/snippets/go?workspace=my-project"

Response:

{
  "language": "go",
  "snippets": [
    {
      "name": "HTTP Server with Routes",
      "fileName": "http-server-routes",
      "fullPath": "go/http-server-routes",
      "description": "Set up an HTTP server with Go 1.22+ enhanced routing.",
      "language": "go"
    }
  ]
}

Get Snippet Detail

Endpoint: GET /api/v1/snippets/{lang}/{fileName}?workspace={name}

curl -s "$BASE_URL/api/v1/snippets/go/http-server-routes?workspace=my-project"

Response:

{
  "name": "HTTP Server with Routes",
  "fileName": "http-server-routes",
  "language": "go",
  "description": "Set up an HTTP server with Go 1.22+ enhanced routing.",
  "whenToUse": "When defining HTTP routes using net/http ServeMux in Go 1.22+",
  "content": "package main\n\nimport \"net/http\"\n\nfunc main() {\n..."
}

List Available Models

Endpoint: GET /api/v1/models?workspace={name}

curl -s "$BASE_URL/api/v1/models?workspace=my-project"

Response:

{
  "models": [
    {"id": "openai/gpt-5.5", "name": "openai/gpt-5.5"},
    {"id": "openai/gpt-4o", "name": "openai/gpt-4o"}
  ],
  "defaultModel": "openai/gpt-5.5"
}

The models list comes from opencode models and contains base model IDs. The defaultModel is the coordinator's GOAL.md model with any parenthesized variant removed.

Workspace Query Parameter

All knowledge endpoints accept an optional ?workspace=name query parameter:

  • If omitted, uses the first workspace found
  • If provided, scopes results to that workspace's .sgai/ directory
# Explicit workspace
curl -s "$BASE_URL/api/v1/agents?workspace=my-project"

# First workspace (implicit)
curl -s "$BASE_URL/api/v1/agents"

Knowledge Directory Structure

The workspace's .sgai/ directory layout:

.sgai/
  agent/
    coordinator.md       # agent definition files
    go.md
  skills/
    test-driven-development/
      SKILL.md           # skill definition
    coding-practices/
      go-code-review/
        SKILL.md
  snippets/
    go/
      http-server-routes.go  # code snippets
    typescript/
      sse-client.ts

版本历史

  • 9efbb7b 当前 2026-07-25 08:54

同 Skill 集合

docs/sgai-skills/adhoc/SKILL.md
docs/sgai-skills/compose/SKILL.md
docs/sgai-skills/human-interaction/SKILL.md
docs/sgai-skills/monitoring/SKILL.md
docs/sgai-skills/session-control/SKILL.md
docs/sgai-skills/using-sgai/SKILL.md
docs/sgai-skills/workspace-management/SKILL.md

元信息

文件数
0
版本
9efbb7b
Hash
ed2ed78e
收录时间
2026-07-25 08:54

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 23:12
浙ICP备14020137号-1 $访客地图$