# Encapsulate Paired Ops

> Review that paired operations and fields that always appear together are encapsulated in a helper or nested struct.

- Skill: `kubernetes-sigs-kueue/encapsulate-paired-ops` (Agent Skill)
- Install (CLI): `npx get-skill add kubernetes-sigs-kueue/encapsulate-paired-ops`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kubernetes-sigs-kueue/encapsulate-paired-ops/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: kubernetes-sigs (https://skillmd.com/u/kubernetes-sigs-kueue)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/kubernetes-sigs-kueue/encapsulate-paired-ops

---


# Skill: Encapsulate Paired Operations and Fields

**Flag (operations):** Two function calls that always appear together (e.g., `subtractPendingResources` + `inadmissibleWorkloads.delete`, or `addPendingResources` + `inadmissibleWorkloads.insert`).

**Ask:** Wrap them in a single helper so callers cannot forget one half. The invariant should be enforced by the API, not by convention.

**Flag (fields):** Two struct fields that must always be set and cleared together (e.g., `inflight` + `inflightResources`).

**Ask:** Encapsulate them in a nested struct so they are updated atomically. This eliminates the "what if field A is nil but field B is not" inconsistency.

