gdp-knowledge

Provides GDP framework development standards, layered architecture patterns, and RAL resource access guides for Golang services.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/yuezhen-huang/my-bytedance-skillhub --skill gdp-knowledge-yuezhen-huang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gdp-knowledge
Source: https://github.com/yuezhen-huang/my-bytedance-skillhub/tree/main/gdp-knowledge
Command: npx skills add https://github.com/yuezhen-huang/my-bytedance-skillhub --skill gdp-knowledge-yuezhen-huang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers building Golang backend services on ByteDance's GDP (Go Development Platform) framework need authoritative guidance on IDL-driven development, code layering rules, component usage, and RAL resource access, which is otherwise scattered across internal documentation. ## Core Features & Use Cases - Development Standards: Covers IDL-driven workflow, gdp init/update/lint commands, and the Handler → Action → Domain → DAL → DAO layered architecture with concrete code examples for each layer. - Component Guides: Documents GDP config, log, metrics, testing (mocks), compkg, and plugin/middleware development with usage patterns and best practices. - RAL Resource Access: Explains configuration and client usage for RPC, MySQL (GORM), Abase/Redis, and EventBus resources, including transactions, caching, and multi-cluster setups. - Use Case: When creating a new GDP service, follow the init command guide to scaffold the project, then use the code-layer examples to implement business logic in the correct layer and RAL docs to wire up database and cache access. ## Quick Start Ask the agent to explain the GDP code layering rules and show how to implement a Domain layer function that calls DAL and returns a business error code.

Frequently Asked Questions about gdp-knowledge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I initialize a new GDP project in Golang?

Run gdp init with your service PSM, for example gdp init tiktok.user.api. It generates the full directory structure, action layer code, router registration, main.go, and go.mod. Use --cfg-only to generate only the .gdp/app.yaml config first if you need custom grouping rules.

What is the GDP code layering architecture?

GDP enforces a Handler → Action → Domain → DAL → DAO call chain. Action handles parameter binding, Domain implements business logic, DAL aggregates data and calls RPC, and DAO performs atomic database CRUD. Router, handler, action, and domain files are auto-generated by gdp update and must not be manually created.

How do I access MySQL and Redis in a GDP service?

Use the RAL (Resource Access Layer) component. Configure resources in YAML with Protocol rds for MySQL or redis/abase for caches, then call db.Conn(ctx) for GORM-style queries or redis.GetClient() for cache operations. RAL supports transactions, connection pooling, and multi-cluster routing.

What is the difference between GDP plugins and middleware?

Plugins are af-framework-only, AOP-based, and execute in phases (OnStartup, OnShutdown, OnSuccess, OnError), running before middleware. Middleware uses a chain-of-responsibility pattern with Next/Abort control and works in both af (HTTP) and raf (RPC) frameworks. Choose plugins for complex multi-stage logic and middleware for simpler cross-cutting concerns.

How do I write unit tests for GDP domain logic?

Use the gdp/mocks package, which is only allowed in _test.go files. Wrap cases with mocks.Run, create contexts via NewMockContext, and mock RAL resources like redis.Mock() or db.Mock(). Mocks are automatically released after each test run.

Why does gdp update forbid manually creating files in action or domain directories?

Files under router, handler, action, and domain are generated from the IDL by gdp update, so manually created files break the IDL-driven workflow and may be overwritten or cause inconsistencies. You should only add business logic inside already generated files, while dal, dao, and pkg directories are manually created.