Pixiu 过滤器开发与调试
pixiu-filter-author
创建并调试 dubbo-go-pixiu 的 HTTP/网络过滤器。适用于添加、注册或接入 Pixiu 过滤器,以及过滤器能编译但无法运行的情况。不适用于适配器或协议监听器 SPI 相关工作。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 574
- Forks
- 195
01 前言 Front Matter
- name
- pixiu-filter-author
- description
- Creates and debugs dubbo-go-pixiu HTTP/Network filters. Use when adding, registering, or wiring Pixiu filters, or when a filter compiles but does not run. Do not use for adapter or protocol-listener SPI work.
03 SKILL.md 正文
pixiu-filter-author
Purpose
Build Pixiu HTTP/Network filters that register and run.
When to use
-
Use when:
- Adding, fixing, or wiring Pixiu HTTP/Network filters.
- Porting Envoy/Kong/APISIX filters.
- Diagnosing filters that compile but do not run.
-
Do not use for:
- Registry adapter or protocol-listener SPI implementation.
Inputs
<HARD-GATE> Do not generate YAML, write code, create files, or take any implementation action until the user has provided all required inputs. This is a first principle.
If any required input is missing, this turn must only ask for the missing fields in the current input group; do not generate examples, defaults, YAML, code, or final output.
Even if configuration information seems inferable, obvious, or implied by context, you must still ask the user to confirm it. Do not proceed until the user confirms it. </HARD-GATE>
- Choose filter type (required):
- Required:
filter_type:httpornetwork
- Required:
- Common plugin information (required):
- Required:
Kindconstant value, also used as YAMLname
- Required:
- HTTP filter (required when
filter_type: http):- Required:
- Which stages to implement:
Decode,Encode, or both - Processing logic for each stage, in natural language or pseudocode
- Which stages to implement:
- Optional:
Configfields and validation logic
- Required:
- Network filter (required when
filter_type: network):- Required:
- Which
NetworkFiltercallbacks to implement, such asOnData,OnTripleData, orServeHTTP - Processing logic for each callback, in natural language or pseudocode
- Which
- Optional:
Configfields and validation logic
- Required:
Workflow
- Check required Inputs first:
- Read existing code, config, and already provided user information first; do not ask again for information already present or stated.
- Ask one
Inputsgroup at a time. Each time, output only that group's required fields, with a short explanation after each field. - If the current group's required fields are incomplete, ask only for the missing fields and do not move to the next group.
- After the current group's required fields are complete, ask whether to fill that group's optional fields; if yes, list those optional fields with short explanations.
- After optional fields are skipped or completed, apply that group's defaults to complete implementation or mounting snippets; defaults must not override existing code, config, or user input.
- Read current source before writing code:
pkg/common/extension/filter/filter.gofor SPI interfaces andpkg/pluginregistry/registry.gofor the current blank-import list.- HTTP filter example:
pkg/filter/cors/cors.go. - Network filter example:
pkg/filter/network/dubboproxy/.
- Choose package shape by
filter_type: HTTP filters go underpkg/filter/<name>/orpkg/filter/http/<name>/; Network filters go underpkg/filter/network/<name>/. - Implement the matching SPI: HTTP defines
Kind,Plugin,FilterFactory,Filter, andConfig; Network definesKind,Plugin,Filter, andConfig. - Finish registration and mounting: in the filter package's
init(), call the registration function —filter.RegisterHttpFilter(&Plugin{})for an HTTP filter,filter.RegisterNetworkFilterPlugin(&Plugin{})for a Network filter; add a blank import inpkg/pluginregistry/registry.go; then mount according to filter type under HCM or the listener filter-chain.
Output format
- Show the relevant YAML fragment.
Validation
- Verify the filter package's
init()actually callsfilter.RegisterHttpFilter(&Plugin{})(HTTP) orfilter.RegisterNetworkFilterPlugin(&Plugin{})(Network). - Verify
pkg/pluginregistry/registry.goblank-imports the new package. - Verify HTTP filters are nested under HCM
http_filters[], and Network filters are under listenerfilter_chains.filters[]. - Verify
PrepareFilterChaindeep-copiesfactory.cfgfields into each per-request Filter instance and does not share pointers.
04 同仓库更多 Skills
Pixiu MCP 网关配置生成与校验
pixiu-mcp-gateway
创建并校验 dubbo-go-pixiu MCP 网关的 conf.yaml。适用于 MCP server 过滤器、tools/list、tools/call、Mcp-Session-Id、MCP 认证、Nacos MCP 注册中心,或将后端 HTTP API 暴露为 MCP 工具。不适用于 LLM 模型代理。
Pixiu LLM 网关配置
pixiu-llm-gateway
创建并验证 dubbo-go-pixiu 的 LLM 网关 conf.yaml。适用于 LLM 代理/tokenizer/kvcache 过滤器、llm_meta、vLLM、LMCache、重试/回退或 Nacos LLM 发现。不适用于 MCP 网关配置。
Pixiu HTTP 转 Dubbo 路由配置
pixiu-http-to-dubbo
创建并调试 dubbo-go-pixiu 的 HTTP 到 Dubbo 路由 YAML 配置。适用于 api_config.yaml/conf.yaml 路由、直连 Dubbo URL、基于注册中心的 Dubbo、mappingParams、mapType、parameterTypes、opt.types/opt.values 或泛型调用(generic-invoke)错误。不适用于非 Dubbo 的 HTTP 代理路由或新的注册中心适配器实现。