extract-to-atlas-lib

Moves duplicated Go primitives from operator and CSI driver into the shared atlas-lib module.

4|Updated Dec 1, 2025
One-click install
npx skills add https://github.com/simplyblock/simplyblock-operator --skill extract-to-atlas-lib-simplyblock
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-to-atlas-lib
Source: https://github.com/simplyblock/simplyblock-operator/tree/main/.claude/skills/extract-to-atlas-lib
Command: npx skills add https://github.com/simplyblock/simplyblock-operator --skill extract-to-atlas-lib-simplyblock

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When the same helper exists in both the simplyblock operator and the CSI driver, the two copies drift apart and fixes land in only one. This Skill governs the full extraction of a shared primitive into the atlas-lib Go library: deciding whether it belongs there, choosing the right package, performing the move, deleting both copies, and updating the documentation the move invalidates. ## Core Features & Use Cases - Placement decisions: Applies explicit rules for whether a primitive belongs in atlas-lib or stays in the consumer, whether to extend an existing package or create a new one, and whether it is public or internal. - Ordered migration workflow: Writes the primitive and its tests in atlas-lib first, adopts it in each consumer, deletes both copies, and proves deletion with grep and full test runs. - Documentation upkeep: Updates the atlas-lib README layout index, use-case sections, Today pointers, and package doc comments that an extraction silently falsifies. - Use Case: You find that csi-driver contains a copy of an unexported nvmeof helper. The Skill directs you to export it in place in atlas-lib, adopt it in both consumers, delete the copies, and verify with grep and make test across all three modules. ## Quick Start Ask the AI to extract the duplicated NVMe connect helper from the operator and csi-driver into atlas-lib and delete both copies.

Frequently Asked Questions about extract-to-atlas-lib

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I move duplicated Go code into a shared library?

Write the primitive and its tests in the shared library first, then adopt it in each consumer, then delete both copies. Prove the deletion with grep over both consumer modules and run the full test suite across all modules.

When should a helper go into a shared Go library versus staying in the consumer?

It belongs in the shared library when it is about a node-level storage primitive, a control-plane concept, or an identity rule both components must agree on. Reconcilers, CSI RPC handlers, and anything referencing CRD types stay in the consumer.

Should I extend an existing Go package or create a new one?

Extend the package that already owns the concern. A new package is justified only when the concern is genuinely not covered by an existing one, and its package comment must explain the seam in one sentence.

Can a shared library import CRD types from the operator API?

No. A CRD type never crosses the library boundary. If a primitive seems to need one, extract the plain data fields it operates on instead of the type itself.

What if a consumer must temporarily keep its own copy after extraction?

That is a transition, not a completed extraction. Name the owner and the condition for removal, and do not claim the deduplication until the last copy is deleted and verified by grep.