一键导入
examples
Guidelines for creating and maintaining example YAML files in the cmd/examples directory. Use when adding new CRD fields or modifying example code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guidelines for creating and maintaining example YAML files in the cmd/examples directory. Use when adding new CRD fields or modifying example code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | examples |
| description | Guidelines for creating and maintaining example YAML files in the cmd/examples directory. Use when adding new CRD fields or modifying example code. |
This skill documents the conventions for creating and maintaining example YAML files in the cmd/examples directory. Following these guidelines ensures consistent, informative documentation for users.
Concrete Values: Always set concrete values for fields in example code. Do NOT use comments to explain how to use a field.
//) are NOT rendered in the output YAMLDocumentation in CRD Definitions: All field documentation must be in the CRD struct definition, NOT in example code comments.
///) are extracted by the schema generator and rendered in YAMLNew Fields Must Be Demonstrated: When adding new optional fields, update the example to show the field with a concrete value.
Some(...) with a representative value, not NoneAdd documentation to the CRD struct (in libs/*/src/crd.rs):
/// Template for referencing a pre-existing PersistentVolumeClaim.
/// This allows users to manage PVCs externally.
///
/// Template variables available:
/// - `{kanidm_name}`: Kanidm CR name
/// - `{statefulset_name}`: StatefulSet name
///
/// Example: `{kanidm_name}-data` resolves to `my-idm-data`.
#[serde(skip_serializing_if = "Option::is_none")]
pub existing_claim_template: Option<String>,
Set a concrete value in the example (in cmd/examples/src/*.rs):
// CORRECT: Concrete value that will be rendered in YAML
existing_claim_template: Some("my-kanidm-data".to_string()),
// WRONG: Commented explanation (NOT rendered in YAML)
// existing_claim_template: Some("my-kanidm-data".to_string()),
existing_claim_template: None,
Regenerate examples:
make examples
Example files (cmd/examples/src/*.rs) should:
my-idm, default)The YAML generator (cmd/examples/src/yaml.rs):
required array) are commented out with #Key insight: The YAML generator reads documentation from the CRD schema, not from example code comments. This is why all documentation must be in CRD definitions.
| Mistake | Why It's Wrong | Fix |
|---|---|---|
| Adding comments in example code | Not rendered in YAML output | Move to CRD doc comments |
Setting new fields to None | Field doesn't appear in generated YAML | Set Some(...) with concrete value |
| Hand-editing generated YAML files | Will be overwritten by make examples | Only modify example code or CRD |
| Documenting behavior in examples | Documentation won't be consistent | Document in CRD definition |
After modifying examples or CRD definitions:
make examples to regenerate YAML files# Regenerate example YAML files
make examples
# Regenerate CRD YAML after CRD changes
make crdgen
# Run both after CRD modifications
make crdgen && make examples
cmd/examples/src/*.rs - Example struct definitionscmd/examples/src/yaml.rs - YAML generation logiclibs/*/src/crd.rs - CRD definitions with documentationexamples/*.yaml - Generated example YAML filescharts/kaniop/crds/crds.yaml - Generated CRD YAMLPrepare and publish a new release. Use when the user asks to release, cut a release, or publish a new version.
Guidelines for documenting reusable patterns discovered during work. Use when completing tasks that reveal non-obvious workflows or project conventions.
Guidelines for modifying the Helm chart. Use when changing values.yaml, templates, or adding new configuration options.