Use when writing Go code to interact with Hetzner Cloud API - automation, infrastructure provisioning, bots, integrations, or programmatic cloud operations
Provides type-safe access to Hetzner Cloud API for Go automation and infrastructure provisioning. Use when writing Go code to create servers, manage networks, volumes, firewalls, or perform programmatic cloud operations with automatic retries and action polling.
/plugin marketplace add gaarutyunov/dev-skills/plugin install hetzner@dev-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/api-reference.mdreferences/patterns.mdThe official Go SDK for Hetzner Cloud provides type-safe access to 23+ resource types with automatic retries, action polling, and comprehensive error handling. Use it for bots, automation, integrations, and complex workflows. For quick CLI operations, use hetzner:hcloud-cli instead.
import "github.com/hetznercloud/hcloud-go/v2/hcloud"
// Create client
client := hcloud.NewClient(hcloud.WithToken("your-api-token"))
go get github.com/hetznercloud/hcloud-go/v2/hcloud
| Task | Method |
|---|---|
| Servers | |
| List servers | client.Server.All(ctx) |
| Get server | client.Server.GetByID(ctx, 123) or GetByName(ctx, "web") |
| Create server | client.Server.Create(ctx, hcloud.ServerCreateOpts{}) |
| Delete server | client.Server.Delete(ctx, server) |
| Reboot/Reset | client.Server.Reboot(ctx, server) / Reset(ctx, server) |
| Networks | |
| Create network | client.Network.Create(ctx, hcloud.NetworkCreateOpts{}) |
| Attach server | client.Server.AttachToNetwork(ctx, server, opts) |
| Volumes | |
| Create volume | client.Volume.Create(ctx, hcloud.VolumeCreateOpts{}) |
| Attach volume | client.Volume.Attach(ctx, volume, server) |
| Actions | |
| Wait for action | client.Action.WaitFor(ctx, action) |
| Poll with callback | client.Action.WaitForFunc(ctx, callback, action) |
See references/api-reference.md for complete method list:
client := hcloud.NewClient(
hcloud.WithToken("token"), // Required
hcloud.WithEndpoint("https://api.hetzner.cloud/v1"), // Custom endpoint
hcloud.WithApplication("myapp", "1.0.0"), // User-Agent
hcloud.WithDebugWriter(os.Stderr), // Debug logging
hcloud.WithHTTPClient(customClient), // Custom HTTP client
hcloud.WithRetryOpts(hcloud.RetryOpts{ // Retry config
MaxRetries: 5,
BackoffFunc: hcloud.ExponentialBackoff(2, time.Second),
}),
hcloud.WithPollOpts(hcloud.PollOpts{ // Action polling
BackoffFunc: hcloud.ConstantBackoff(500 * time.Millisecond),
}),
)
See references/patterns.md for idiomatic patterns:
All long-running operations return an Action:
result, _, err := client.Server.Create(ctx, opts)
if err != nil {
return err
}
// Wait for completion
if err := client.Action.WaitFor(ctx, result.Action); err != nil {
return err
}
// Or with progress callback
err = client.Action.WaitForFunc(ctx,
func(update *hcloud.Action) error {
fmt.Printf("Progress: %.0f%%\n", update.Progress)
return nil
},
result.Action,
)
import "github.com/hetznercloud/hcloud-go/v2/hcloud"
err := someAPICall()
// Check specific error codes
if hcloud.IsError(err, hcloud.ErrorCodeNotFound) {
// Resource doesn't exist
}
// Get error details
if apiErr, ok := err.(*hcloud.APIError); ok {
fmt.Printf("Error: %s - %s\n", apiErr.Code, apiErr.Message)
}
Common error codes:
ErrorCodeNotFound - Resource doesn't existErrorCodeInvalidInput - Validation errorErrorCodeForbidden - Insufficient permissionsErrorCodeRateLimitExceeded - Rate limit hit (auto-retried)ErrorCodeConflict - Resource changed (auto-retried)ErrorCodeLocked - Another action running| Problem | Solution |
|---|---|
| Nil pointer panic | Always check error before using result |
| Action timeout | Use ctx, cancel := context.WithTimeout(...) |
| Missing pagination | Use client.Server.All(ctx) for complete list |
| Action failed | Check action error with WaitFor() return value |
| Rate limiting | SDK auto-retries, but add backoff for bulk ops |
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.