golang-data-structures

Revoir · 59
Indexé dans 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
Stars12
Version1.0.0
Qualité58/100 · Prometteur
Confiance59/100 · Do not auto-install
Audit73/100 · Revue nécessaire

Profil de l’actif

Agents de code et de développement

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

Voir la catégorie

Scénario

Agents de code

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

Adéquation Agent

Claude Code + CLI + Codex

Compatible avec Codex, Claude Code, Cursor, CLI ou des Agents personnalisés.

Installer

Prêt

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

Maintenance

À jour

Mis à jour aujourd’hui

Risque

Revue nécessaire

Dependency or permission surface needs review

Qualité GitHub

12

58/100 Qualité · 67/100 Confiance

Tags de couverture

CodingAgents de codeDesign et créationagent-skill

Notes de revue

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.

Carte d’adoption Agent

Confiance, audit et préparation à l’installation en un coup d’œil

Ces scores combinent les métadonnées publiques du dépôt, les signaux de revue OpenAgentSkill, la fraîcheur de maintenance et la préparation à l’installation. Ils servent à présélectionner et ne remplacent pas la revue humaine.

Qualité

Prometteur
58

Useful candidate, but compare it with alternatives before adopting.

Confiance

Do not auto-install
59

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

Audit

Revue nécessaire
73

Revue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.

Trust Score OpenAgentSkill v5

Revue humaine avant installation

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

CodexClaude CodeCursorOpenAgentSkill CLI

Stars

12 stars GitHub

Activité du dépôt

12 stars et 2 forks

Maintenance

Mis à jour aujourd’hui

Licence

MIT

Installer

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

Sécurité d’installation

Chemin d’installation standard de package ou runtime

Surface de permissions

shell or command execution, network or browser access

Résultats Agent

Pas encore de données de résultats Agent

Documentation

Contexte README/SKILL.md solide

Résumé des risques

Revoir avant production

  • 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

Préparation à l’installation

Chemin d’installation disponible

  • Le chemin d’installation est disponible
  • La preuve du dépôt est disponible
  • La licence est déclarée
  • Pas encore de preuve de résultat Agent-Proven

Métadonnées lisibles par Agent

Données de décision lisibles par machine pour ce skill.

Utilisez ce bloc ou le JSON intégré pour décider si un Agent doit installer ce skill, choisir une alternative ou demander d’abord une revue humaine.

Ouvrir JSON

Tâches adaptées

  • workflows RAG and knowledge
  • Équipes Claude Code
  • builders willing to evaluate younger projects
  • Chunk documents

Agents adaptés

CodexClaude CodeCursorOpenAgentSkill CLICLI

Décision d’installation

Commande
npx skills add yzfly/skills --skill golang-data-structures
Politique
Revoir
Revue humaine
Oui

Confiance et risque

Confiance
59/100
Audit
73/100
Niveau de risque
Revue nécessaire

Boucle de résultat

Endpoint
/api/agent/outcome
ID d’événement
resolve
Résultats
5

Commande d’installation

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

Ne pas utiliser quand

  • Équipes qui nécessitent un SLA soutenu par le fournisseur
  • 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

Sécurité Agent v2

49/100 · Éviter l’installation automatique

ExpérimentalRevoir

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

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

Résoudre via API

Élevé

Exécution shell ou de commande

Les métadonnées de la skill font référence à des workflows de terminal, CLI, shell, sous-processus ou exécution de commande.

Moyen

Accès réseau

La skill récupère probablement des pages distantes, API, dépôts ou services externes.

  • Indices de permissions à haut risque : exécution shell ou de commande
  • Dependency or permission surface needs review

Cibles d’installation

Installer ce skill dans votre workflow Agent

Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.

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 résolution Agent

Laissez un Agent vérifier la pertinence avant l’installation.

L’API Resolve renvoie la skill sélectionnée, des alternatives, la politique de sécurité, les notes d’audit, la cible d’installation et un prompt prêt à l’emploi.

Ouvrir le plan texte

L’Agent doit vérifier

  • 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.

Copier le 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.

Relais Agent

Donnez à l’Agent le chemin d’installation, pas un autre annuaire.

Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.

Ouvrir l’API d’installation

Prompt 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

Métadonnées Registry

Profil lisible par Agent pour la sélection automatique de skills.

L’API Registry fournit les signaux de décision, confiance, audit, cas d’usage et installation sans analyser l’interface.

Ouvrir Manifest

Adéquation Agent

57/100

RAG and knowledge

Plateformes

Claude Code

Rapport d’audit

Revue nécessaire · 73/100

Revue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.

Voir le rapport d’auditVoir le rapport d’évaluation

Panneau de décision Agent

Needs validation for RAG and knowledge

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

57
Préparation
Revoir
Étape

Rôle dans la pile

Validation nécessaire

Pertinence principale

RAG and knowledge

Libellé de confiance

Revue manuelle nécessaire

Chemin d’installation

Commande prête

À utiliser lorsque

  • workflows RAG and knowledge
  • Équipes Claude Code
  • builders willing to evaluate younger projects

Preuves

  • recent repository activity
  • install command or GitHub repo available
  • profil qualité 58/100

revoir d’abord

  • 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

Chemin d’implémentation

  1. 1Installez-le dans un Agent en sandbox et exécutez une tâche de RAG and knowledge de bout en bout.
  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.

Profil de confiance

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 OpenAgentSkill

Adoption GitHub

Corriger

12 stars GitHub

Activité stars/forks

Corriger

12 stars et 2 forks; l’activité des issues n’est pas disponible dans les métadonnées actuelles

Maintenance récente

Validé

Mis à jour aujourd’hui

Clarté de licence

Validé

MIT

Signaux positifs

  • Revue IA approuvée
  • Le chemin d’installation est disponible
  • La preuve du dépôt est disponible
  • Dépôt maintenu récemment
  • La commande d’installation ne présente aucun motif de haut risque évident
  • La boucle de résultats est prête mais nécessite la première exécution réelle de l’Agent

Réviser avant installation

  • 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
  • Pas encore de rapports de résultats Agent réels
  • Une revue humaine est requise avant une installation sans surveillance

Action recommandée

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

Profil qualité

Prometteur candidat pour les workflows Agent

Useful candidate, but compare it with alternatives before adopting.

58
Stars GitHub
12
Actualité
Aujourd’hui
Prêt à installer
Oui
Licence
MIT
Réviser avant installation: 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.

Adéquation au workflow

Utilisez cette skill dans ces scénarios

Adéquation au workflow

Ajouter à un workflow complet

Liste d’alternatives

Comparer avant installation

Similar skills that may fit this task.

Tout comparer

Vue d’ensemble

--- 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)

Détails techniques

Version
1.0.0
Licence
MIT
Dernière mise à jour
23 août 2026
Publié
23 août 2026

Instantané de décision

Validation nécessaire

57
Prêt
Revoir
Étape

recent repository activity

Audit

Revue d’installation

Revue d’installation et d’adoption

73
Revue nécessaire
Sécurité
74/100
Maintenance
100/100
Installer
92/100
Ouvrir l’audit completVoir le rapport d’évaluation

Preuves validées par Agent

Preuves validées par Agent

Rapports après resolve, revue, installation et une exécution limitée.

0
Validé
Needs first agent runAuto-installation: revoir d’abordDernier: Inconnu
Taux de réussite
Échec récent
Résultats
0
Qualité de sortie
Échecs
0
Non pertinent
0
Installations
0
Bloqué par le risque
0
Configuration requise
0
Production
0

Aucune donnée de résultat Agent pour l’instant. La première exécution peut signaler succès, besoin de configuration, blocage de risque, échec ou non-pertinence via /api/agent/outcome.

Installer

Ajouter au workflow Agent

Gratuit et open source. Examinez le rapport avant l’installation dans des Agents de production.

Boucle de croissance

Kit de partage

X

Brouillon guidé par scénario pour golang-data-structures, prêt pour une publication manuelle sur X.

Note du curateur
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
Ouvrir le brouillon X
Réponse facultative avec commande d’installation
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

Source de la fiche

Indexé par Registry

Revendiable

Cette fiche a été indexée à partir de sources publiques et n’est pas marquée officielle tant qu’une revendication de mainteneur n’est pas approuvée.

Créateur
yzfly
Indexé par
Index communautaire OpenAgentSkill

L’attribution renvoie au dépôt public ou au profil du créateur. Les créateurs peuvent revendiquer la fiche pour mettre à jour les signaux de propriété.

Revendiquer ce skill

Revendication du propriétaire

Revendiquer cette fiche de skill

Cette fiche Indexé par Registry est attribuée à yzfly, mais n’est pas encore marquée officielle. Revendiquez-la pour ajouter un signal de propriétaire vérifié et rendre les futures mises à jour de lancement, d’installation et d’audit plus fiables.

Kit de backlinks créateur

Ajoutez les badges de preuve à votre README

Affichez la fiche canonique, les signaux actuels de confiance et d’audit, ainsi que de vraies preuves Agent-Proven là où les développeurs évaluent le dépôt.

[![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)

Auteur

Y

yzfly

@yzfly

Adéquation plateforme

Signaux de santé

Stars GitHub
12
Score de qualité
31/100
Dernier push GitHub
23 août 2026
Indications de framework
Inconnu
Vues OpenAgentSkill
0
Copies d’installation
0
Clics sortants
0

Signal de communauté

Indiquez si ce skill semble utile à votre workflow Agent. Les retours agrégés améliorent le classement au fil du temps.

Confiance et sécurité

Do not auto-install

59
  • Adoption GitHub12 stars GitHubCorriger
  • Activité stars/forks12 stars et 2 forks; l’activité des issues n’est pas disponible dans les métadonnées actuellesCorriger
  • Maintenance récenteMis à jour aujourd’huiValidé
  • Clarté de licenceMITValidé
  • Complétude README/SKILL.mdLes métadonnées incluent suffisamment de contexte d’usage et de workflowValidé
  • Risque dépendances/runtimecommand execution surface, external package install surfaceVérifier