Agent skill
common-operations
Implement idiomatic Kubernetes operations with label selectors, strategic merge patches, and proper error handling for production-grade CLI tooling.
Install this agent skill to your Project
npx add-skill https://github.com/adaptive-enforcement-lab/claude-skills/tree/main/plugins/build/skills/common-operations
SKILL.md
Common Operations
When to Use This Skill
A well-designed Kubernetes CLI provides idiomatic operations that work consistently across resource types. This section covers:
- List Resources - Query resources with label selectors
- Rollout Restart - Trigger rolling restarts without downtime
- ConfigMap Operations - Store and retrieve configuration data
- Watch Resources - React to real-time resource changes
Implementation
See the full implementation guide in the source documentation.
Key Principles
| Practice | Description |
|---|---|
| Use label selectors | Filter resources server-side, not client-side |
| Prefer patches over updates | Patches are safer for concurrent modifications |
| Use strategic merge patches | Kubernetes-native patch format for resources |
| Handle not found errors | Check apierrors.IsNotFound(err) before creating |
| Respect resource versions | Use optimistic concurrency for updates |
Use the Kubernetes API idiomatically: label selectors, patches, and proper error handling.
Techniques
Operation Patterns
graph TB
CLI[CLI Command] --> List[List Resources]
CLI --> Mutate[Mutate Resources]
CLI --> Watch[Watch Changes]
List --> Filter[Label Selectors]
Mutate --> Patch[Strategic Merge Patch]
Mutate --> Create[Get-or-Create]
Watch --> Events[Event Stream]
%% Ghostty Hardcore Theme
style CLI fill:#65d9ef,color:#1b1d1e
style List fill:#a7e22e,color:#1b1d1e
style Mutate fill:#fd971e,color:#1b1d1e
style Watch fill:#9e6ffe,color:#1b1d1e
style Filter fill:#5e7175,color:#f8f8f3
style Patch fill:#5e7175,color:#f8f8f3
style Create fill:#5e7175,color:#f8f8f3
style Events fill:#5e7175,color:#f8f8f3
References
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
github-token-permissions-overview
Understanding GITHUB_TOKEN scope, default permissions, and implementing least-privilege principle for GitHub Actions workflows.
secure
Find and fix security issues before they become incidents. Vulnerability scanning, SBOM generation, supply chain security, and secure authentication workflows.
complete-workflow-examples
Copy-paste hardened CI/CD workflows with SHA-pinned actions, minimal GITHUB_TOKEN permissions, OIDC authentication, and comprehensive security scanning for GitHub Actions.
ephemeral-runner-patterns
Disposable runner patterns for GitHub Actions. Container-based, VM-based, and ARC deployment strategies with complete state isolation between jobs.
action-pinning-overview
Why pinning GitHub Actions to SHA-256 commits matters for supply chain security. Attack vectors from unpinned actions and comparison of tag vs SHA pinning.
github-actions-security-patterns-hub
Complete security patterns for GitHub Actions covering action pinning, GITHUB_TOKEN permissions, third-party action risks, secret management, and runner security.
Didn't find tool you were looking for?