golang-data-structures

Revisar · 59
Indexado en Registry

Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy sem

Verified installs0
Estrellas12
Versión1.0.0
Calidad58/100 · Prometedor
Confianza59/100 · Do not auto-install
Auditoría73/100 · Requiere revisión

Perfil del activo

Agents de programación y desarrollo

Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.

Ver categoría

Escenario

Agents de programación

I need a coding agent that can understand a repository, edit code, and review pull requests.

Afinidad con Agent

Claude Code + CLI + Codex

Funciona con Codex, Claude Code, Cursor, CLI o Agents personalizados.

Instalar

Listo

npx skills add yzfly/skills --skill golang-data-structures

Mantenimiento

Actual

Actualizado hoy

Riesgo

Requiere revisión

Dependency or permission surface needs review

Calidad de GitHub

12

58/100 Calidad · 67/100 Confianza

Etiquetas de cobertura

CodingAgents de programaciónDiseño y creatividadagent-skill

Notas de revisión

Dependency or permission surface needs review · The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.

Tarjeta de adopción del Agent

Confianza, auditoría y preparación de instalación de un vistazo

Estas puntuaciones combinan metadatos públicos del repositorio, señales de revisión de OpenAgentSkill, actualidad de mantenimiento y preparación de instalación. Sirven para preseleccionar; no sustituyen la revisión humana.

Calidad

Prometedor
58

Useful candidate, but compare it with alternatives before adopting.

Confianza

Do not auto-install
59

Trust Score v5 found insufficient evidence for agent installation. Treat this as discovery material, not an executable recommendation.

Auditoría

Requiere revisión
73

Revisión legible por máquina de la preparación de instalación, los metadatos de seguridad, el mantenimiento y el riesgo de adopción.

Trust Score de OpenAgentSkill v5

Revisión humana antes de instalar

Choose a stronger alternative or inspect the source manually before any install attempt.

CodexClaude CodeCursorOpenAgentSkill CLI

Estrellas

12 estrellas de GitHub

Actividad del repositorio

12 estrellas y 2 forks

Mantenimiento

Actualizado hoy

Licencia

MIT

Instalar

npx skills add yzfly/skills --skill golang-data-structures

Seguridad de instalación

Ruta estándar de paquete o instalación en tiempo de ejecución

Superficie de permisos

shell or command execution, network or browser access

Resultados del Agent

Aún no hay datos de resultados del Agent

Documentación

Contexto sólido de README/SKILL.md

Resumen de riesgo

Revisar antes de producción

  • The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
  • Low GitHub adoption signal
  • Quality score needs review
  • GitHub adoption: 12 GitHub stars

Preparación de instalación

Ruta de instalación disponible

  • La ruta de instalación está disponible
  • La evidencia del repositorio está disponible
  • La licencia está declarada
  • Aún no hay evidencia de resultados Agent-Proven

Metadatos legibles por Agent

Datos de decisión legibles por máquina para este skill.

Usa este bloque o el JSON integrado para decidir si un Agent debe instalar este skill, elegir una alternativa o pedir revisión humana primero.

Abrir JSON

Tareas adecuadas

  • flujos de RAG and knowledge
  • Equipos de Claude Code
  • builders willing to evaluate younger projects
  • Chunk documents

Agents adecuados

CodexClaude CodeCursorOpenAgentSkill CLICLI

Decisión de instalación

Comando
npx skills add yzfly/skills --skill golang-data-structures
Política
Revisar
Revisión humana

Confianza y riesgo

Confianza
59/100
Auditoría
73/100
Nivel de riesgo
Requiere revisión

Ciclo de resultados

Endpoint
/api/agent/outcome
ID del evento
resolve
Resultados
5

Comando de instalación

npx skills add yzfly/skills --skill golang-data-structures

No usar cuando

  • Equipos que necesitan un SLA con soporte del proveedor
  • production agents without a repository review
  • Low GitHub adoption signal
  • The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
  • No OpenAgentSkill engagement data yet

Seguridad de Agent v2

49/100 · Evitar instalación automática

ExperimentalRevisar

Sparse or mixed signals. Useful for discovery, but not for autonomous installation.

Test manually in an isolated workspace and compare against safer alternatives.

Resolver con API

Alto

Ejecución de shell o comandos

Los metadatos del skill hacen referencia a terminal, CLI, shell, subprocesos o flujos de ejecución de comandos.

Medio

Acceso a red

El skill probablemente consulta páginas remotas, API, repositorios o servicios externos.

  • Indicios de permisos de alto riesgo: ejecución de shell o comandos
  • Dependency or permission surface needs review

Destinos de instalación

Instala este skill en tu flujo de Agent

Usa el endpoint público para obtener el comando, la lista de seguridad, prompts y enlaces canónicos.

skill install

OpenAgentSkill CLI

Resolve policy, run the source installer safely, and report a verified install receipt.

$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install yzfly-golang-data-structures

Plan de resolución de Agent

Deja que un Agent valide el ajuste antes de instalar.

La API Resolve devuelve la skill elegida, alternativas, política de seguridad, notas de auditoría, destino de instalación y un prompt listo para usar.

Abrir plan de texto

Agent debe revisar

  • Task fit and alternatives from Resolve API.
  • Audit score, trust score, and safety policy warnings.
  • Install target compatibility for Codex, Claude Code, Cursor, or CLI.

Copiar prompt

Task: Use golang-data-structures in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-data-structures%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/yzfly-golang-data-structures/install
Install command: npx skills add yzfly/skills --skill golang-data-structures
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.

Traspaso de Agent

Da al Agent la ruta de instalación, no otro directorio.

Usa el endpoint público para obtener el comando, la lista de seguridad, prompts y enlaces canónicos.

Abrir API de instalación

Prompt de Agent

Use golang-data-structures for this task. Review https://www.openagentskill.com/api/skills/yzfly-golang-data-structures/install, then install with: npx skills add yzfly/skills --skill golang-data-structures

Metadatos del Registry

Perfil legible por Agent para seleccionar skills automáticamente.

La API Registry expone señales de decisión, confianza, auditoría, casos de uso e instalación sin raspar la interfaz.

Abrir Manifest

Afinidad con Agent

57/100

RAG and knowledge

Plataformas

Claude Code

Informe de auditoría

Requiere revisión · 73/100

Revisión legible por máquina de la preparación de instalación, los metadatos de seguridad, el mantenimiento y el riesgo de adopción.

Ver informe de auditoríaVer informe de evaluación

Panel de decisión de Agent

Needs validation for RAG and knowledge

Do a manual repository review before adding this to an agent workflow.

57
Preparación
Revisar
Etapa

Rol en la pila

Requiere validación

Ajuste principal

RAG and knowledge

Etiqueta de confianza

Requiere revisión manual

Ruta de instalación

Comando listo

Úsalo cuando

  • flujos de RAG and knowledge
  • Equipos de Claude Code
  • builders willing to evaluate younger projects

Evidencia

  • recent repository activity
  • install command or GitHub repo available
  • perfil de calidad 58/100

revisar primero

  • Low GitHub adoption signal
  • The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
  • No OpenAgentSkill engagement data yet

Ruta de implementación

  1. 1Instálalo en un Agent de sandbox y ejecuta una tarea de RAG and knowledge de principio a fin.
  2. 2Compare output quality, latency, and failure behavior against at least one alternative.
  3. 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.

Perfil de confianza

Do not auto-install

Trust Score v5 found insufficient evidence for agent installation. Treat this as discovery material, not an executable recommendation.

59
Trust Score de OpenAgentSkill

Adopción en GitHub

Corregir

12 estrellas de GitHub

Actividad de stars/forks

Corregir

12 estrellas y 2 forks; la actividad de issues no está disponible en los metadatos actuales

Mantenimiento reciente

Aprobado

Actualizado hoy

Claridad de licencia

Aprobado

MIT

Señales positivas

  • Revisión de IA aprobada
  • La ruta de instalación está disponible
  • La evidencia del repositorio está disponible
  • Repositorio mantenido recientemente
  • El comando de instalación no muestra un patrón de alto riesgo evidente
  • El ciclo de resultados está listo, pero necesita la primera ejecución real de Agent

Revisar antes de instalar

  • The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
  • Low GitHub adoption signal
  • Quality score needs review
  • GitHub adoption: 12 GitHub stars
  • Stars/forks activity: 12 stars, 2 forks; issue activity unavailable in current metadata
  • Dependency/runtime risk: command execution surface, external package install surface
  • Aún no hay informes reales de resultados del Agent
  • Se requiere revisión humana antes de una instalación desatendida

Acción recomendada

Choose a stronger alternative or inspect the source manually before any install attempt.

Perfil de calidad

Prometedor candidato para flujos de Agent

Useful candidate, but compare it with alternatives before adopting.

58
Estrellas de GitHub
12
Actualidad
Hoy
Listo para instalar
Licencia
MIT
Revisar antes de instalar: Low GitHub adoption signal · The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.

Ajuste de flujo

Usa esta skill en estos escenarios

Ajuste de flujo

Añadir a un flujo completo

Lista de alternativas

Compara antes de instalar

Similar skills that may fit this task.

Comparar todo

Resumen

--- name: golang-data-structures description: "Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy semantics. Use when choosing or optimizing Go data structures, implementing generic containers, using container/ packages, unsafe or weak pointers, or questioning slice/map internals." user-invocable: true license: MIT compatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang. metadata: author: samber version: "1.1.1" openclaw: emoji: "🗃️" homepage: https://github.com/samber/cc-skills-golang requires: bins: - go install: [] allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent ---

**Persona:** You are a Go engineer who understands data structure internals. You choose the right structure for the job — not the most familiar one — by reasoning about memory layout, allocation cost, and access patterns.

# Go Data Structures

Built-in and standard library data structures: internals, correct usage, and selection guidance. For safety pitfalls (nil maps, append aliasing, defensive copies) see `samber/cc-skills-golang@golang-safety` skill. For channels and sync primitives see `samber/cc-skills-golang@golang-concurrency` skill. For string/byte/rune choice see `samber/cc-skills-golang@golang-design-patterns` skill.

## Best Practices Summary

1. **Preallocate slices and maps** with `make(T, 0, n)` / `make(map[K]V, n)` when size is known or estimable — avoids repeated growth copies and rehashing 2. **Arrays** SHOULD be preferred over slices only for fixed, compile-time-known sizes (hash digests, IPv4 addresses, matrix dimensions) 3. **NEVER rely on slice capacity growth timing** — the growth algorithm changed between Go versions and may change again; your code should not depend on when a new backing array is allocated 4. **Use `container/heap`** for priority queues, **`container/list`** only when frequent middle insertions are needed, **`container/ring`** for fixed-size circular buffers 5. **`strings.Builder`** MUST be preferred for building strings; **`bytes.Buffer`** MUST be preferred for bidirectional I/O (implements both `io.Reader` and `io.Writer`) 6. Generic data structures SHOULD use the **tightest constraint** possible — `comparable` for keys, custom interfaces for ordering 7. **`unsafe.Pointer`** MUST only follow the 6 valid conversion patterns from the Go spec — NEVER store in a `uintptr` variable across statements 8. **`weak.Pointer[T]`** (Go 1.24+) SHOULD be used for caches and canonicalization maps to allow GC to reclaim entries

## Slice Internals

A slice is a 3-word header: pointer, length, capacity. Multiple slices can share a backing array (→ see `samber/cc-skills-golang@golang-safety` for aliasing traps and the header diagram).

### Capacity Growth

- < 256 elements: capacity doubles - > = 256 elements: grows by ~25% (`newcap += (newcap + 3*256) / 4`) - Each growth copies the entire backing array — O(n)

### Preallocation

```go // Exact size known users := make([]User, 0, len(ids))

// Approximate size known results := make([]Result, 0, estimatedCount)

// Pre-grow before bulk append (Go 1.21+) s = slices.Grow(s, additionalNeeded) ```

### `slices` Package (Go 1.21+)

Key functions: `Sort`/`SortFunc`, `BinarySearch`, `Contains`, `Compact`, `Grow`. For `Clone`, `Equal`, `DeleteFunc` → see `samber/cc-skills-golang@golang-safety` skill.

**[Slice Internals Deep Dive](./references/slice-internals.md)** — Full `slices` package reference, growth mechanics, `len` vs `cap`, header copying, backing array aliasing.

## Map Internals

Maps are hash tables with 8-entry buckets and overflow chains. They are reference types — assigning a map copies the pointer, not the data.

### Preallocation

```go m := make(map[string]*User, len(users)) // avoids rehashing during population ```

### `maps` Package Quick Reference (Go 1.21+)

| Function | Purpose | | ----------------- | ---------------------------- | | `Collect` (1.23+) | Build map from iterator | | `Insert` (1.23+) | Insert entries from iterator | | `All` (1.23+) | Iterator over all entries | | `Keys`, `Values` | Iterators over keys/values |

For `Clone`, `Equal`, sorted iteration → see `samber/cc-skills-golang@golang-safety` skill.

**[Map Internals Deep Dive](./references/map-internals.md)** — How Go maps store and hash data, bucket overflow chains, why maps never shrink (and what to do about it), comparing map performance to alternatives.

## Arrays

Fixed-size, value types. Copied entirely on assignment. Use for compile-time-known sizes:

```go type Digest [32]byte // fixed-size, value type var grid [3][3]int // multi-dimensional cache := map[[2]int]Result{} // arrays are comparable — usable as map keys ```

Prefer slices for everything else — arrays cannot grow and pass by value (expensive for large sizes).

## container/ Standard Library

| Package | Data Structure | Best For | | --- | --- | --- | | `container/list` | Doubly-linked list | LRU caches, frequent middle insertion/removal | | `container/heap` | Min-heap (priority queue) | Top-K, scheduling, Dijkstra | | `container/ring` | Circular buffer | Rolling windows, round-robin | | `bufio` | Buffered reader/writer/scanner | Efficient I/O with small reads/writes |

Container types use `any` (no type safety) — consider generic wrappers. **[Container Patterns, bufio, and Examples](./references/containers.md)** — When to use each container type, generic wrappers to add type safety, and `bufio` patterns for efficient I/O.

## strings.Builder vs bytes.Buffer

Use `strings.Builder` for pure string concatenation (avoids copy on `String()`), `bytes.Buffer` when you need `io.Reader` or byte manipulation. Both support `Grow(n)`. **[Details and comparison](./references/containers.md)**

## Generic Collections (Go 1.18+)

Use the tightest constraint possible. `comparable` for map keys, `cmp.Ordered` for sorting, custom interfaces for domain-specific ordering.

```go type Set[T comparable] map[T]struct{}

func (s Set[T]) Add(v T) { s[v] = struct{}{} } func (s Set[T]) Contains(v T) bool { _, ok := s[v]; return ok } ```

**[Writing Generic Data Structures](./references/generics.md)** — Using Go 1.18+ generics for type-safe containers, understanding constraint satisfaction, and building domain-specific generic types.

## Pointer Types

| Type | Use Case | Zero Value | | --- | --- | --- | | `*T` | Normal indirection, mutation, optional values | `nil` | | `unsafe.Pointer` | FFI, low-level memory layout (6 spec patterns only) | `nil` | | `weak.Pointer[T]` (1.24+) | Caches, canonicalization, weak references | N/A |

**[Pointer Types Deep Dive](./references/pointers.md)** — Normal pointers, `unsafe.Pointer` (the 6 valid spec patterns), and `weak.Pointer[T]` for GC-safe caches that don't prevent cleanup.

## Copy Semantics Quick Reference

| Type | Copy Behavior | Independence | | --- | --- | --- | | `int`, `float`, `bool`, `string` | Value (deep copy) | Fully independent | | `array`, `struct` | Value (deep copy) | Fully independent | | `slice` | Header copied, backing array shared | Use `slices.Clone` | | `map` | Reference copied | Use `maps.Clone` | | `channel` | Reference copied | Same channel | | `*T` (pointer) | Address copied | Same underlying value | | `interface` | Value copied (type + value pair) | Depends on held type |

## Third-Party Libraries

For advanced data structures (trees, sets, queues, stacks) beyond the standard library:

- **`emirpasic/gods`** — comprehensive collection library (trees, sets, lists, stacks, maps, queues) - **`deckarep/golang-set`** — thread-safe and non-thread-safe set implementations - **`gammazero/deque`** — fast double-ended queue

When using third-party libraries, refer to their official documentation and code examples for current API signatures. Context7 can help as a discoverability platform.

## Cross-References

- → See `samber/cc-skills-golang@golang-performance` skill for struct field alignment, memory layout optimization, and cache locality - → See `samber/cc-skills-golang@golang-safety` skill for nil map/slice pitfalls, append aliasing, defensive copying, `slices.Clone`/`Equal` - → See `samber/cc-skills-golang@golang-concurrency` skill for channels, `sync.Map`, `sync.Pool`, and all sync primitives - → See `samber/cc-skills-golang@golang-design-patterns` skill for `string` vs `[]byte` vs `[]rune`, iterators, streaming - → See `samber/cc-skills-golang@golang-structs-interfaces` skill for struct composition, embedding, and generics vs `any` - → See `samber/cc-skills-golang@golang-code-style` skill for slice/map initialization style

## Common Mistakes

| Mistake | Fix | | --- | --- | | Growing a slice in a loop without preallocation | Each growth copies the entire backing array — O(n) per growth. Use `make([]T, 0, n)` or `slices.Grow` | | Using `container/list` when a slice would suffice | Linked lists have poor cache locality (each node is a separate heap allocation). Benchmark first | | `bytes.Buffer` for pure string building | Buffer's `String()` copies the underlying bytes. `strings.Builder` avoids this copy | | `unsafe.Pointer` stored as `uintptr` across statements | GC can move the object between statements — the `uintptr` becomes a dangling reference | | Large struct values in maps (copying overhead) | Map access copies the entire value. Use `map[K]*V` for large value types to avoid the copy |

## References

- [Go Data Structures (Russ Cox)](https://research.swtch.com/godata) - [The Go Memory Model](https://go.dev/ref/mem) - [Effective Go](https://go.dev/doc/effective_go)

Detalles técnicos

Versión
1.0.0
Licencia
MIT
Última actualización
23 ago 2026
Publicado
23 ago 2026

Resumen de decisión

Requiere validación

57
Listo
Revisar
Etapa

recent repository activity

Auditoría

Revisión de instalación

Revisión de instalación y adopción

73
Requiere revisión
Seguridad
74/100
Mantenimiento
100/100
Instalar
92/100
Abrir auditoría completaVer informe de evaluación

Evidencia probada por Agent

Evidencia probada por Agent

Informes de resultados tras resolver, revisar, instalar y una ejecución limitada.

0
Probado
Needs first agent runAuto-instalación: revisar primeroÚltimo: Desconocido
Tasa de éxito
Fallo reciente
Resultados
0
Calidad de salida
Fallidos
0
No relevante
0
Instalaciones
0
Bloqueado por riesgo
0
Configuración necesaria
0
Producción
0

Aún no hay datos de resultados de Agent. La primera ejecución puede informar éxito, configuración necesaria, bloqueos de riesgo, fallo o irrelevancia mediante /api/agent/outcome.

Instalar

Añadir al flujo de Agent

Gratis y de código abierto. Revisa el informe antes de instalar en Agents de producción.

Bucle de crecimiento

Kit para compartir

X

Borrador basado en un caso para golang-data-structures, listo para publicar manualmente en X.

Nota del curador
golang-data-structures: Golang data structures — slices (internals, capacity growth, preallocation, slices package),...

12 stars

https://www.openagentskill.com/skills/yzfly-golang-data-structures?ref=x
Abrir borrador de X
Respuesta opcional con comando de instalación
Listing + install path for golang-data-structures:
https://www.openagentskill.com/skills/yzfly-golang-data-structures?ref=x

Install: npx skills add yzfly/skills --skill golang-data-structures

Fuente de la ficha

Indexado por Registry

Reclamable

Esta ficha se indexó desde fuentes públicas y no está marcada como oficial hasta que se apruebe una reclamación de mantenedor.

Creador
yzfly
Indexado por
Índice comunitario de OpenAgentSkill

La atribución enlaza al repositorio público o al perfil del creador. Los creadores pueden reclamar la ficha para actualizar las señales de propiedad.

Reclamar este skill

Reclamación del propietario

Reclamar esta ficha de skill

Esta ficha Indexado por Registry se atribuye a yzfly, pero aún no está marcada como oficial. Reclámala para añadir una señal de propietario verificado y hacer más fiables futuras actualizaciones de lanzamiento, instalación y auditoría.

Kit de enlaces para creadores

Añade las insignias de evidencia a tu README

Muestra la ficha canónica, las señales actuales de confianza y auditoría, y evidencia real de Agent-Proven donde los desarrolladores evalúan el repositorio.

[![Listed on OpenAgentSkill](https://www.openagentskill.com/api/badge/yzfly-golang-data-structures?metric=listed&label=Listed)](https://www.openagentskill.com/skills/yzfly-golang-data-structures)
[![OpenAgentSkill Trust](https://www.openagentskill.com/api/badge/yzfly-golang-data-structures?metric=trust&label=Trust)](https://www.openagentskill.com/skills/yzfly-golang-data-structures)
[![OpenAgentSkill Audit](https://www.openagentskill.com/api/badge/yzfly-golang-data-structures?metric=audit&label=Audit)](https://www.openagentskill.com/skills/yzfly-golang-data-structures/audit)
[![Agent Proven](https://www.openagentskill.com/api/badge/yzfly-golang-data-structures?metric=proven&label=Agent%20Proven)](https://www.openagentskill.com/skills/yzfly-golang-data-structures)

Autor

Y

yzfly

@yzfly

Etiquetas

Afinidad con plataforma

Señales de salud

Estrellas de GitHub
12
Puntuación de calidad
31/100
Último push de GitHub
23 ago 2026
Pistas del framework
Desconocido
Vistas de OpenAgentSkill
0
Copias de instalación
0
Clics externos
0

Señal de comunidad

Comparte si este skill resulta útil para tu flujo de Agent. Los comentarios agregados mejoran la clasificación con el tiempo.

Confianza y seguridad

Do not auto-install

59
  • Adopción en GitHub12 estrellas de GitHubCorregir
  • Actividad de stars/forks12 estrellas y 2 forks; la actividad de issues no está disponible en los metadatos actualesCorregir
  • Mantenimiento recienteActualizado hoyAprobado
  • Claridad de licenciaMITAprobado
  • Completitud de README/SKILL.mdLos metadatos incluyen suficiente contexto de uso y flujo de trabajoAprobado
  • Riesgo de dependencias/runtimecommand execution surface, external package install surfaceRevisar