← 返回 Skills 市场
hefuwei-95

配置拉取代码生成

作者 hefuwei-95 · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ✓ 安全检测通过
200
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install config-pull-template
功能描述
生成配置拉取代码模板。用于在 Android 项目中接入配置中心、白名单、单独接口或推拉结合的配置。 触发条件:用户想要创建配置拉取功能,需要生成对应的 Kotlin/Java 代码模板。
使用说明 (SKILL.md)

配置拉取代码生成

根据用户提供的配置信息,生成对应的代码模板。

交互流程

第一步:询问配置作用

向用户确认:这个配置的作用是什么? 例如:ANR 监控配置、服务费配置、活动配置等。

第二步:确认接入方式

让用户选择接入方式:

  1. 配置中心 - 需要提供:

    • 配置中心组件 Key(如 com.youzan.retailHD.anr
    • 字段 Key(如 config
    • 模板 Value(JSON 字符串,可选)
  2. 白名单 - 需要提供:

    • 白名单 Key(如 anr_feature
  3. 单独接口 - 需要提供:

    • 接口 URL(如 youzan.retail.trade.misc.shopsetting.query/1.0.0
  4. 推拉结合 - 需要提供:

    • 推送 Key
    • 拉取接口 URL

第三步:确认所属模块

让用户选择配置所属模块:

  • 商品模块(module_goods)
  • 营销模块(module_marketing)
  • 其他模块

代码生成规则

通用规则

  • 代码优先使用 Kotlin 编写
  • 数据模型如果跟网络相关需要添加 @Keep 注解
  • 生成代码后,必须写入到 workspace 对应文件,并展示给用户看

白名单接入

生成 WhiteListManager(如果已存在则复用):

object WhiteListManager {

    fun is{Feature}Enabled() {
        WhiteListTask.isInWhiteList("{key}").subscribe({ result ->
            // TODO 待实现
        }, { error ->
            // TODO 待实现
        })
    }
}

生成 Plugin 钩子(方法名必须与注解名一致!)

在对应模块的 PluginModule 中添加三个方法:

// 文件位置:/modules/module_xxx/src/common/java/com/youzan/retail/xxx/PluginModule.kt

@ShopSwitched
fun onShopSwitched() {
    WhiteListManager.is{Feature}Enabled()
}

@AppStart
fun onAppStart() {
    WhiteListManager.is{Feature}Enabled()
}

@ConfigFetch
fun onConfigFetch() {
    WhiteListManager.is{Feature}Enabled()
}

配置中心

参考 config-center-template.md

根据模块 + 作用,在对应模块的 common 下创建 XXXConfigManager 类:

  • 路径:/modules/module_xxx/src/common/java/com/youzan/retail/xxx/
  • CONFIG_KEY_CONFIG_VERSION 固定为 1.0.0
  • 如果提供了模板 JSON,需要生成对应的配置类(使用 @Keep 注解)

同时生成 Plugin 钩子(方法名必须与注解名一致!):

@ShopSwitched
fun onShopSwitched() {
    {Name}ConfigManager.init()
}

@AppStart
fun onAppStart() {
    {Name}ConfigManager.init()
}

@ConfigFetch
fun onConfigFetch() {
    {Name}ConfigManager.init()
}

单独接口

参考 api-template.md

在对应模块的 common 下创建:

  • XXXConfigManager - 业务逻辑
  • XXXTask - Task 层
  • XXXService - Service 接口(包含 @POST 注解和 URL)

同时生成 Plugin 钩子(方法名必须与注解名一致!):

@ShopSwitched
fun onShopSwitched() {
    {Name}ConfigManager.query{Name}Config()
}

@AppStart
fun onAppStart() {
    {Name}ConfigManager.query{Name}Config()
}

@ConfigFetch
fun onConfigFetch() {
    {Name}ConfigManager.query{Name}Config()
}

推拉结合

参考 push-pull-template.md

在对应模块的 common 下创建 XXXRefreshUtils 类,内部实现 IConfigDataNotification 接口注册推送通知。

同时生成 Plugin 钩子(方法名必须与注解名一致!):

@ShopSwitched
fun onShopSwitched() {
    {Name}RefreshUtils.register{Name}Notification()
    {Name}ConfigManager.query{Name}Config()
}

@AppStart
fun onAppStart() {
    {Name}RefreshUtils.register{Name}Notification()
    {Name}ConfigManager.query{Name}Config()
}

@ConfigFetch
fun onConfigFetch() {
    {Name}ConfigManager.query{Name}Config()
}

Plugin 钩子说明

配置拉取的调用时机通过 Plugin 实现。不同模块的 Plugin 位置:

  • 商品模块:modules/module_goods/src/common/java/com/youzan/retail/goods/PluginModule.kt
  • 营销模块:modules/module_marketing/src/common/java/com/youzan/retail/marketing/PluginModule.kt

可用的注解:

  • @ShopSwitched - 店铺切换时调用
  • @AppStart - 应用启动时调用
  • @ConfigFetch - 配置同步时调用

重要规则

  1. 每次生成配置时,必须同时生成这三个 Plugin 钩子方法!
  2. 方法名必须与注解名一致@ShopSwitchedonShopSwitched()@AppStartonAppStart()@ConfigFetchonConfigFetch()
  3. 生成代码后,必须写入到 workspace 对应文件
安全使用建议
This skill is coherent for generating Android config-pull code templates and does not ask for credentials or install anything. Before running: 1) Be prepared that the skill will write files into your agent workspace — review and approve generated files before committing. 2) Pay attention to any API URLs, push keys, or SecurityKey references you supply; the generated code will include them and they may cause the app to contact external services at runtime. 3) Run the generator in a development branch or sandbox and inspect outputs for hard-coded secrets or unexpected endpoints. If you need the generator to avoid writing files automatically, ask it to only show the code instead of writing to workspace.
功能分析
Type: OpenClaw Skill Name: config-pull-template Version: 1.0.2 The skill is a code generation tool designed to help Android developers create boilerplate code for configuration management (Config Center, Whitelists, APIs). It provides structured Kotlin templates and instructions for the agent to write generated code into specific project directories (e.g., `SKILL.md`, `references/api-template.md`). No evidence of malicious intent, data exfiltration, or unauthorized execution was found; the file-writing behavior is consistent with its stated purpose as a development utility.
能力评估
Purpose & Capability
Name/description (generate Android Kotlin/Java templates for config pull) matches the contents: templates for config center, whitelist, single API, and push-pull integration are provided, and the instructions focus on generating code and plugin hooks for modules. Required capabilities (none) are proportional to the task.
Instruction Scope
SKILL.md instructs the agent to interactively collect configuration details from the user and to generate code files in the workspace at specified module paths. It does not instruct reading system files, env vars, or external endpoints. Note: generated templates include use of project-side symbols (e.g., SecurityKey.clientId / clientSecret) and placeholders for API URLs/push keys; the skill itself does not read or exfiltrate those values, but the generated code will reference them at runtime in the target project and may include arbitrary API endpoints supplied by the user.
Install Mechanism
No install spec and no code files that execute on the host — instruction-only skill. This is low-risk from installation standpoint.
Credentials
The skill declares no required environment variables, binaries, or credentials. Templates reference project-level secrets (SecurityKey.clientId/Secret) as part of generated code, but the skill does not request access to those secrets.
Persistence & Privilege
always:false and no attempt to modify other skills or system config. The skill requires writing generated files into the agent workspace (explicitly mandated). Writing to the workspace is expected for a code generator but is a privileged action — users should confirm generated changes before committing them.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install config-pull-template
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /config-pull-template 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
修正 Plugin 方法名与注解名一致
v1.0.1
新增 Plugin 钩子生成
v1.0.0
初始版本
元数据
Slug config-pull-template
版本 1.0.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

配置拉取代码生成 是什么?

生成配置拉取代码模板。用于在 Android 项目中接入配置中心、白名单、单独接口或推拉结合的配置。 触发条件:用户想要创建配置拉取功能,需要生成对应的 Kotlin/Java 代码模板。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 200 次。

如何安装 配置拉取代码生成?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install config-pull-template」即可一键安装,无需额外配置。

配置拉取代码生成 是免费的吗?

是的,配置拉取代码生成 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

配置拉取代码生成 支持哪些平台?

配置拉取代码生成 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 配置拉取代码生成?

由 hefuwei-95(@hefuwei-95)开发并维护,当前版本 v1.0.2。

💬 留言讨论