.claude/skills/cr-field/SKILL.md
Use when adding a new field to an existing Custom Resource. Guides the full workflow: API types, code generation, CRD examples, client investigation, handler mapping, and tests.
npx skillsauth add epam/edp-keycloak-operator cr-fieldInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Add a new field to an existing Custom Resource following the project's established conventions. Work through all steps in order. Do not skip steps.
File: api/v1/{kind}_types.go (or api/v1alpha1/ for alpha resources).
Add the struct field with a godoc comment and kubebuilder markers. Choose markers that match the field's semantics:
// +required / // +optional// +nullable — for pointer slices or maps that can be explicitly null// +kubebuilder:validation:Enum=val1;val2 — restrict to allowed values// +kubebuilder:default=value — set a default when field is omitted// +kubebuilder:example=value — example shown in generated docs// +kubebuilder:validation:XValidation:rule=...,message=... — CEL validation (e.g. immutability)JSON tag: json:"fieldName,omitempty" for optional fields, json:"fieldName" for required.
See api/v1/keycloakclient_types.go for the full variety of marker patterns in use.
make generate && make manifests
This regenerates DeepCopy methods and CRD YAMLs in config/crd/bases/ and deploy-templates/crds/.
Add the new field with a meaningful example value to:
config/samples/v1_v1_{kind}.yamldeploy-templates/_crd_examples/{kind}.yamlThis is the critical investigation step before touching any handler code.
All controllers use pkg/client/keycloakv2/. Confirm the handler imports this package.
Check pkg/client/keycloakv2/contracts.go for the relevant client interface
(GroupsClient, ClientsClient, RolesClient, etc.).
Representation types are type aliases — grep pkg/client/keycloakv2/generated/client_generated.go
for the struct name (e.g. GroupRepresentation, ClientRepresentation, RoleRepresentation)
to see which fields are available.
openapi.yaml is auto-generated and must not be edited manually. Ask the user how to proceed before making any further changes.In internal/controller/{resource}/chain/ find the handler that creates/updates the resource
(usually create_or_update_{resource}.go or put_{resource}.go).
Map the field in both paths:
Reference: internal/controller/keycloakrealmgroup/chain/create_or_update_group.go
File: internal/controller/{resource}/chain/*_test.go
Add the field to the spec setup and to the mock expectations for all test cases: create path, update path, and error paths.
Reference: internal/controller/keycloakrealmgroup/chain/create_or_update_group_test.go
File: internal/controller/{resource}/*_controller_integration_test.go
Add the field to the CR creation spec. Assert the correct value is persisted in Keycloak
using Eventually() + g.Expect().
Reference: internal/controller/keycloakrealmgroup/keycloakrealmgroup_controller_integration_test.go
Invoke the run-golangci-lint skill, then the run-tests skill.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.