agentleFS
karmabkarmab/kcli/skills/kcli-plan-authoring/SKILL.md

kcli-plan-authoring

Skill658 starsChanged 13 days agoApache-2.0View on GitHub

Guides creation of kcli plan files for deploying VMs, networks, and infrastructure. Use when writing YAML plans with Jinja2 templating or debugging plan execution issues.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create kcli_parameters.yml alongside your plan:

    line 164
  2. Very specific:

    Validate YAML syntax: - Use python -c "import yaml.

    line 216
  3. Very specific:

    Check Jinja2 rendering: - Look for unbalanced {{ }} or {% %}

    line 217
  4. Distinctive:

    Check dependencies: - Ensure images/networks exist before VMs reference them

    line 219

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

kcli Plan Authoring

Plan File Structure

Plans are YAML files with Jinja2 templating. Resources are defined as top-level keys with a type field.

parameters:
  param1: value1
  param2: value2

resourcename:
  type: resourcetype
  key1: value1
  key2: {{ param1 }}

Resource Types

VM (default if no type specified)

myvm:
  image: fedora40
  memory: 4096
  numcpus: 2
  disks:
    - size: 20
    - size: 10
      pool: otherpool
  nets:
    - name: default
    - name: mynet
      ip: 192.168.1.10
      netmask: 255.255.255.0
      gateway: 192.168.1.1
  cmds:
    - echo hello > /tmp/test
  files:
    - path: /etc/myconfig
      content: |
        key=value

Profile

myprofile:
  type: profile
  image: centos9stream
  memory: 2048
  numcpus: 2
  disks:
    - 10
  nets:
    - default

Network

mynetwork:
  type: network
  cidr: 192.168.100.0/24
  dhcp: true
  nat: true
  domain: mylab.local

Image

myimage:
  type: image
  url: https://example.com/image.qcow2
  pool: default

Container

mycontainer:
  type: container
  image: nginx:latest
  ports:
    - 8080:80

Jinja2 Templating

Parameter Substitution

parameters:
  cluster_name: mycluster
  worker_count: 3

{{ cluster_name }}-master:
  image: rhcos
  
{% for i in range(worker_count) %}
{{ cluster_name }}-worker-{{ i }}:
  image: rhcos
{% endfor %}

Conditionals

parameters:
  enable_storage: true

myvm:
  image: fedora40
{% if enable_storage %}
  disks:
    - size: 100
{% endif %}

Custom Filters

kcli provides custom Jinja2 filters in kvirt/jinjafilters/jinjafilters.py:

Path/File Filters:

  • basename - Get filename from path
  • dirname - Get directory from path
  • diskpath - Convert to /dev/ path if needed
  • exists - Check if file/path exists
  • pwd_path - Handle workdir paths in containers
  • real_path - Get real/absolute path
  • read_file - Read file contents

String/Data Filters:

  • none - Return empty string if None
  • type - Return type name (string, int, dict, list)
  • base64 - Base64 encode value
  • certificate - Wrap in BEGIN/END CERTIFICATE if needed
  • count - Count occurrences of character

Kubernetes/Cluster Filters:

  • kubenodes - Generate node names for cluster
  • defaultnodes - Generate default node list
  • has_ctlplane - Check if list has ctlplane/master entries

Version/Release Filters:

  • github_version - Get latest version from GitHub releases
  • min_ocp_version - Compare OpenShift versions (minimum)
  • max_ocp_version - Compare OpenShift versions (maximum)

Network Filters:

  • local_ip - Get local IP for network interface
  • network_ip - Get IP from network CIDR
  • ipv6_wrap - Wrap IPv6 addresses in brackets

Utility Filters:

  • kcli_info - Get VM info via kcli command
  • find_manifests - Find YAML manifests in directory
  • wait_crd - Generate wait script for CRD creation
  • wait_csv - Generate wait script for CSV readiness
  • filter_bgp_peers - Filter BGP peer list

Standard Jinja2 filters (default, join, upper, lower, etc.) also work

Parameter Files

Create kcli_parameters.yml alongside your plan:

cluster_name: prod
worker_count: 5
memory: 8192

Override at runtime:

kcli create plan -f myplan.yml -P worker_count=10 myplan

Common VM Parameters

ParameterDefaultDescription
numcpus2Number of CPUs
memory512Memory in MB
pooldefaultStorage pool
imageNoneBase image name
nets[default]Network list
disks[{size:10}]Disk list
cmds[]Post-boot commands
files[]Files to inject
keys[]SSH public keys
starttrueAuto-start VM
cloudinittrueEnable cloud-init

Plan Execution

# Create plan
kcli create plan -f myplan.yml myplanname

# Create with parameter overrides
kcli create plan -f myplan.yml -P memory=4096 -P image=fedora40 myplanname

# List plans
kcli list plan

# Get plan info
kcli info plan myplanname

# Delete plan (and all its resources)
kcli delete plan myplanname

# Update existing plan
kcli update plan -f myplan.yml myplanname

Debugging Plans

  1. Validate YAML syntax - Use python -c "import yaml; yaml.safe_load(open('plan.yml'))"
  2. Check Jinja2 rendering - Look for unbalanced {{ }} or {% %}
  3. Run with debug - kcli -d create plan -f plan.yml test
  4. Check dependencies - Ensure images/networks exist before VMs reference them

Example: Multi-VM Plan

parameters:
  domain: lab.local
  base_image: centos9stream

labnetwork:
  type: network
  cidr: 10.0.0.0/24
  dhcp: true
  domain: {{ domain }}

webserver:
  image: {{ base_image }}
  memory: 2048
  nets:
    - labnetwork
  cmds:
    - dnf -y install nginx
    - systemctl enable --now nginx

database:
  image: {{ base_image }}
  memory: 4096
  disks:
    - size: 20
    - size: 50
  nets:
    - labnetwork
  cmds:
    - dnf -y install postgresql-server
    - postgresql-setup --initdb

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.