There are a lot of simple examples to add custom properties, but since Blender 3.0 there have been some API changes that made it a bit confusing to create via python some custom properties to PoseBone with some adjustments to its internals. Can't find a solution...
Here is an example that somewhat worked in 2.9:
import bpy
# Get the bone
pbone = bpy.data.objects["Armature"].pose.bones["Bone"]
# Create the custom property and assign a value
pbone['myControl'] = 0
# Check if _RNA_UI dictionary exists, if not create
if "_RNA_UI" not in pbone.keys():
pbone["_RNA_UI"] = {}
# Update _RNA_UI dictionary with min, max, softmin, and softmax values for the custom property
pbone["_RNA_UI"].update({"myControl": {"min":0.0, "max":1.0}})
I bet there are simpler ways to make it in 2.9, but this one worked for me. It HAS to be for PoseBone and not other types, because it should work for a rig. Of course I want also other options than min/max like "is Library overridable" but I'm breaking this into baby steps. Problem is that in 3.0 it's broken.