Provides a streamlined workflow for developing FastGPT system tools, including type safety, proper configuration management, and automated testing.
When to Use This Skill
Use this skill when performing FastGPT tool development tasks:
- Creating a new standalone tool or toolset
- Implementing API integrations with proper authentication
- Developing tools with Zod validation and TypeScript types
- Setting up shared configuration between toolset subtools
- Writing comprehensive tests for tool functionality
Core Capabilities
- Type-Safe Development: Zod schema validation + TypeScript type inference
- Configuration Management: Shared secret configuration within a toolset, with version control support
- Systematic Testing: Automated test generation and validation
- Code Quality: Built-in code review and optimization steps
- Best Practices: Follows FastGPT design patterns and conventions
Development Workflow
Follow this 4-phase workflow when developing FastGPT tools. Each phase has clear objectives, actions, and quality standards.
Phase 1: Requirements and Design
Objective: Create a comprehensive requirements document
Steps:
- Review
references/design_spec.mdfor existing design patterns - Define the scope and functionality of the tool/toolset
- Specify input/output configuration using Zod schemas
- Document API requirements and test credentials
- Use
references/requirement_template.mdas a starting point
Quality Standards:
- ✅ All functionality clearly defined
- ✅ Input/output types specified
- ✅ Edge cases and error scenarios documented
Deliverable: Complete design document (see references/requirement_template.md)
Phase 2: Implementation
Objective: Develop the tool following FastGPT patterns
Steps:
- Create the directory structure (
tool/ortoolset/children/) - Implement
config.ts, including the correct version list - Develop
src/index.ts, including business logic with Zod validation - If needed, add shared modules (
client.ts、utils.ts)
Code Conventions:
- Adopt camelCase naming conventions
- Type imports:
import { type Foo } from 'bar' - Minimize error handling (let the framework handle common cases)
- Keep functions concise with a single responsibility
Quality Standards:
- ✅ TypeScript compiles without errors
- ✅ Follows existing project patterns
- ✅ Configuration structure is correct
Phase 3: Testing and Validation
Objective: Ensure reliability through comprehensive testing
Steps:
- Install dependencies:
bun install - In
test/index.test.tswrite test cases - Run the test suite:
bun test - Fix failing tests and edge cases
- Validate TypeScript:
bun run tsc --noEmit
Test Coverage:
- Input Validation (Zod schema boundary cases)
- Business Logic Correctness
- Error Handling Scenarios
- Resource Cleanup (if applicable)
Quality Standards:
- ✅ All tests pass
- ✅ No TypeScript errors
- ✅ Build succeeds:
bun run build
Phase 4: Review and Optimization
Goal: Optimize code quality before completion
Steps:
- Code review, looking for simplification opportunities
- Remove unused code and dependencies
- Optimize performance bottlenecks
- Final integration testing
- Update documentation
Quality Standards:
- ✅ Code is clear and maintainable
- ✅ No unnecessary complexity
- ✅ Final test run succeeds
Quick Reference
Common Commands
# 安装依赖
bun install
# 运行测试
bun test
# 类型检查
bun run tsc --noEmit
# 构建
bun run build
# 测试特定文件
bun test test/index.test.ts
File Templates
Access detailed templates and specifications:
- Requirements Template:
references/requirement_template.md - Complete Design Specification:
references/design_spec.md - Tool Configuration Example: design_spec.md Section 4.1
- Tool Set Configuration Example: design_spec.md Section 5.1
- Zod Validation Schema: design_spec.md Section 7.2
- Test Structure: design_spec.md Section 9.1
Key Design Principles
- Separation of Concerns: Configuration ≠ Logic ≠ Tools
- Type Safety: Zod validation → TypeScript type inference
- Shared Configuration: Tool set keys are inherited by child tools
- Single Responsibility: One tool = one function
- Fail Fast: Let the framework handle common errors
Bound Resources
Scripts Directory
init_skill.py: Initialize a new skill with the correct structurepackage_skill.py: Validate and package the skill into a distributable zip filequick_validate.py: Quickly validate the skill structure
References Directory
design_spec.md: Complete FastGPT tool design specification (10 sections)requirement_template.md: Template for creating tool requirements documents
Usage Patterns
- View detailed technical specifications → Read
references/design_spec.md - Create new tool requirements → Use
references/requirement_template.md - Manage skill → Use
scripts/*.pytool
Related Documentation
- Tool types:
@tool/type/toolinToolTypeEnum - Configuration types:
@tool/typeinToolConfigType、ToolSetConfigType - FastGPT types:
WorkflowIOValueTypeEnum、FlowNodeInputTypeEnum