Skip to content

feat: add Skill Templates for quick agent creation#6440

Closed
stakeswky wants to merge 1 commit intolabring:mainfrom
stakeswky:feat/skill-templates
Closed

feat: add Skill Templates for quick agent creation#6440
stakeswky wants to merge 1 commit intolabring:mainfrom
stakeswky:feat/skill-templates

Conversation

@stakeswky
Copy link
Copy Markdown
Contributor

Feature: Skill Templates

Closes #6320

Summary

This PR introduces Skill Templates - a way to quickly create specialized AI agents with pre-configured system prompts, tools, and variables. Skills provide a middle ground between Simple Apps (too basic) and Workflows (too complex) for common use cases.

What's Changed

Core Types & Constants (packages/global/)

  • New: AppTypeEnum.skill - New app type for skill-based agents
  • New: AppToolSourceEnum.skill - Tool source identifier for skills
  • New: packages/global/core/app/skill/type.ts
    • SkillTemplateSchema - Template metadata (name, description, avatar, etc.)
    • SkillConfigSchema - Runtime config (systemPrompt, tools, variables, datasets)
    • SkillManifestSchema - Complete skill definition
  • New: packages/global/core/app/skill/constants.ts
    • SkillCategoryEnum - Categories: writing, coding, research, customer-service, data-analysis
    • 3 built-in skill templates:
      • Coding Assistant
      • Document Q&A
      • Customer Service
  • New: packages/global/core/app/skill/utils.ts
    • skillManifest2AppConfig() - Converts skill manifest to app creation parameters
    • getSkillRuntimeNodes() - Generates workflow nodes for skill execution

API Endpoints (projects/app/src/pages/api/core/app/skill/)

  • New: GET /api/core/app/skill/list - List all available skill templates
  • New: GET /api/core/app/skill/detail?skillId={id} - Get skill template details
  • New: POST /api/core/app/skill/create - Create app from skill template

Frontend (projects/app/src/)

  • New: web/core/app/api/skill.ts - Frontend API client
  • Updated: pageComponents/app/constants.ts - Added skill to createAppTypeMap
  • Updated: pageComponents/dashboard/constant.ts - Added skill to appTypeTagMap
  • Updated: pages/dashboard/create/index.tsx - Added AppTypeEnum.skill to CreateAppType

OpenAPI Schemas (packages/global/openapi/core/app/skill/api.ts)

  • ListSkillResponseSchema
  • DetailSkillQuerySchema & DetailSkillResponseSchema
  • CreateSkillAppBodySchema & CreateSkillAppResponseSchema

Tests (test/cases/)

  • New: test/cases/global/core/app/skill/type.test.ts - Type validation tests
  • New: test/cases/global/core/app/skill/utils.test.ts - Utility function tests

Usage Example

// 1. List available skills
const skills = await getSkillList();

// 2. Create app from skill
const appId = await postCreateSkillApp({
  skillId: 'skill-coding-assistant',
  name: 'My Coding Assistant',
  variables: {
    language: 'Python'
  },
  toolIds: ['my-custom-tool'],
  datasetIds: ['my-knowledge-base']
});

Design Decisions

  1. Static Templates: Skills are defined in code (not database) for:

    • Easy version control
    • Simple extensibility
    • No migration needed
  2. App Type Integration: Skills are a new AppTypeEnum value:

    • First-class citizen like chatAgent and workflow
    • Works with existing app infrastructure
    • Proper categorization in UI
  3. Variable Substitution: System prompts support {{variable}} syntax:

    • Allows personalization without code changes
    • User-provided values at creation time
  4. Minimal Invasiveness: Reuses existing:

    • Workflow nodes (FlowNodeTypeEnum.agent)
    • Tool system
    • Dataset bindings
    • Permission system

Testing

# Run skill-related tests
pnpm test -- test/cases/global/core/app/skill/

Tests cover:

  • Zod schema validation
  • Built-in template integrity
  • Variable substitution logic
  • Node/edge generation

Checklist

  • Type definitions with Zod schemas
  • Built-in skill templates
  • API endpoints (list, detail, create)
  • Frontend constants
  • Unit tests
  • Design documentation
  • Integration tests (optional for MVP)
  • UI implementation (separate PR)

Migration

No database migration required. Skill templates:

  • Are stored as static TypeScript constants
  • Are converted to standard App schema at creation
  • Become regular apps after creation (type = skill)

Screenshots / Demo

N/A - This PR provides the backend infrastructure. UI will be implemented in a follow-up PR.

Related


Reviewers: Please pay special attention to:

  1. Type safety of skill schemas
  2. Correctness of node generation in getSkillRuntimeNodes()
  3. API endpoint authentication/authorization

Introduce Skill Templates - pre-packaged agent capability templates that allow
users to quickly create specialized agents with pre-configured system prompts,
tools, variables, and optional dataset bindings.

- Add AppTypeEnum.skill and AppToolSourceEnum.skill
- Add skill type definitions (SkillTemplateSchema, SkillConfigSchema, SkillManifestSchema)
- Add 3 built-in skill templates (Coding Assistant, Document Q&A, Customer Service)
- Add API endpoints: list, detail, create
- Add frontend constants and API client
- Add unit tests for types and utils
- No database migration required

Closes labring#6320
@github-actions
Copy link
Copy Markdown

Preview sandbox Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_sandbox_ee92e5b242128b4409086a2b31ae2d8b000ec7c2

@github-actions
Copy link
Copy Markdown

Preview mcp_server Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_mcp_server_ee92e5b242128b4409086a2b31ae2d8b000ec7c2

@c121914yu c121914yu closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

后续会引进Skills功能么

2 participants