← Back to Skills Marketplace
sdk-team

Alibabacloud Sdk Client Initialization For Golang

by alibabacloud-skills-team · GitHub ↗ · v0.0.1-beta · MIT-0
cross-platform ⚠ suspicious
109
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install alibabacloud-sdk-client-initialization-for-golang
Description
Initialize and manage Alibaba Cloud SDK clients in Go. Covers sync.Once singleton, goroutine safety, endpoint vs region configuration, VPC endpoints, and deb...
README (SKILL.md)

Client Initialization Best Practices (Go)

Core Rules

  • Client is goroutine-safe — safe to share across goroutines without additional synchronization.
  • Use singleton pattern — do NOT create new client instances per request. Frequent client creation wastes resources.
  • Prefer explicit endpoint over region-based endpoint resolution.

Recommended Client Creation

import (
    "os"
    "sync"

    openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
    ecs "github.com/alibabacloud-go/ecs-20140526/v3/client"
    "github.com/alibabacloud-go/tea/tea"
)

var (
    ecsClient     *ecs.Client
    ecsClientOnce sync.Once
)

func GetEcsClient() *ecs.Client {
    ecsClientOnce.Do(func() {
        config := &openapi.Config{
            AccessKeyId:     tea.String(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")),
            AccessKeySecret: tea.String(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")),
            Endpoint:        tea.String("ecs.cn-hangzhou.aliyuncs.com"),
        }
        var err error
        ecsClient, err = ecs.NewClient(config)
        if err != nil {
            panic(err)
        }
    })
    return ecsClient
}

Endpoint Configuration

Priority: explicit Endpoint > region-based resolution via RegionId.

// Preferred: explicit endpoint
config.Endpoint = tea.String("ecs.cn-hangzhou.aliyuncs.com")

// Alternative: SDK resolves endpoint from region
config.RegionId = tea.String("cn-hangzhou")

VPC Endpoints

Use VPC endpoints when running inside Alibaba Cloud VPC:

config.Endpoint = tea.String("ecs-vpc.cn-hangzhou.aliyuncs.com")

File Upload APIs (Advance)

Set both RegionId and Endpoint to the same region for file upload APIs:

config.RegionId = tea.String("cn-shanghai")
config.Endpoint = tea.String("objectdet.cn-shanghai.aliyuncs.com")
// VPC file upload authorization:
client.OpenPlatformEndpoint = tea.String("openplatform-vpc.cn-shanghai.aliyuncs.com")
client.EndpointType = tea.String("internal")

SDK Components

Component Description
Core SDK (darabonba-openapi) Generic calls, no product dependency
Product SDK (e.g., ecs-20140526) Typed client, models, convenience methods

Debugging

Enable debug mode via environment variable to log all requests:

export DEBUG=tea
Usage Guidance
This skill appears to do what it says (Go best practices for Alibaba Cloud clients) but it uses sensitive environment variables in its examples while the manifest declares none. Before installing or using it: (1) Confirm where and how your ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET will be provided and stored; prefer instance/RAM roles or short-lived STS tokens over long-lived keys. (2) Avoid enabling DEBUG=tea in production—it can log request contents and headers with secrets. (3) If you plan to allow the agent to run these instructions, ensure the agent process/enclave cannot exfiltrate environment variables to untrusted endpoints. (4) Ask the skill author to declare required env vars (and primary credential) in the manifest or to show vetted code; treat the current omission as a red flag. If you need higher assurance, request the actual source code or a signed, published reference rather than instruction-only content.
Capability Analysis
Type: OpenClaw Skill Name: alibabacloud-sdk-client-initialization-for-golang Version: 0.0.1-beta The skill bundle provides legitimate documentation and Go code examples for initializing Alibaba Cloud SDK clients. It follows industry best practices by using environment variables for credentials and implementing the singleton pattern with sync.Once. No malicious code, data exfiltration, or prompt injection attempts were found in SKILL.md or _meta.json.
Capability Assessment
Purpose & Capability
Name/description and the SKILL.md are consistent: the document provides Go examples and best practices for initializing Alibaba Cloud SDK clients (singleton pattern, endpoints, VPC endpoints, debug). However the runtime instructions rely on environment credentials (ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET) even though the skill metadata lists no required env or primary credential, which is an omission/incoherence.
Instruction Scope
The SKILL.md contains concrete code that calls os.Getenv(...) for sensitive credentials and suggests setting DEBUG=tea to log all requests. The manifest did not declare those environment requirements. The instructions also recommend panicking on client construction errors (which may crash a process) and enabling debug logging that could expose sensitive headers/payloads — these behaviors expand the security surface beyond what the manifest communicates.
Install Mechanism
This is an instruction-only skill with no install spec and no code files to be written or executed by an installer, which is the lowest-risk install mechanism.
Credentials
Although asking for Alibaba Cloud credentials is reasonable for an SDK client, the skill manifest declares no required environment variables or primary credential while the code examples explicitly read ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET (and references DEBUG). This mismatch (undeclared sensitive env access) is disproportionate and should be fixed or justified.
Persistence & Privilege
The skill does not request always:true, does not modify other skills or system-wide settings, and is instruction-only. It does not request persistent presence or elevated agent privileges.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install alibabacloud-sdk-client-initialization-for-golang
  3. After installation, invoke the skill by name or use /alibabacloud-sdk-client-initialization-for-golang
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.0.1-beta
- Initial beta release. - Provides best practices for initializing and managing Alibaba Cloud SDK clients in Go. - Documents goroutine-safe client usage and recommends the singleton pattern with `sync.Once`. - Explains endpoint and region configuration, including VPC and file upload scenarios. - Includes sample code for safe client initialization. - Details debug instructions and key SDK components.
Metadata
Slug alibabacloud-sdk-client-initialization-for-golang
Version 0.0.1-beta
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Alibabacloud Sdk Client Initialization For Golang?

Initialize and manage Alibaba Cloud SDK clients in Go. Covers sync.Once singleton, goroutine safety, endpoint vs region configuration, VPC endpoints, and deb... It is an AI Agent Skill for Claude Code / OpenClaw, with 109 downloads so far.

How do I install Alibabacloud Sdk Client Initialization For Golang?

Run "/install alibabacloud-sdk-client-initialization-for-golang" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Alibabacloud Sdk Client Initialization For Golang free?

Yes, Alibabacloud Sdk Client Initialization For Golang is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Alibabacloud Sdk Client Initialization For Golang support?

Alibabacloud Sdk Client Initialization For Golang is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Alibabacloud Sdk Client Initialization For Golang?

It is built and maintained by alibabacloud-skills-team (@sdk-team); the current version is v0.0.1-beta.

💬 Comments