The generalization is that the symmetry underlying the gauge fields acts on other fields and the gauge-covariant derivatives of those other fields are analogous to the torsion. An example is the Higgs field in the Standard Model.
First: some conventions that will make it a lot easier to provide more detail in the answer to the question.
For the following, I'll use indexed notation for linear functionals, e.g. $T^α_{UV}$ is a functional of a co-vector $α = α_ρ dx^μ$ and vectors $U^μ ∂_μ$ and $V^ν ∂_ν$: co-vectors go upstairs and vectors downstairs. The usual index notation can be fit into this in an upwardly-compatible way by, e.g. $T^ρ_{μν} = T^{dx^ρ}_{∂_μ ∂_ν}$. The functional is "tensorial" in an index if it is linear in that index, and it is a tensor if it is linear in all of its indices. The Kronecker delta becomes the contraction operator $δ^α_U = δ^ρ_μ α_ρ U^μ = α_ν U^ν = α·U$, and is tensor. The connection comes out of the covariant derivative operator by
$$Γ^α_{UV} = \left(∇_U V\right)·α = α_ρ U^μ \left(δ^ρ_ν ∂_μ + Γ^ρ_{μν}\right) V^ν$$
and is only tensorial in $α$ and $U$, but not in $V$. As another example, the "structure coefficients" functional (for lack of an official name)
$$f^α_{UV} = [U,V]·α = α_ρ \left(U^μ ∂_μ V^ρ - V^ν ∂_ν U^ρ\right)$$
is only tensorial in $α$. For coordinate indices, it vanishes: $f^ρ_{μν} = 0$. An example of an operator-valued functional that is tensorial is the directional derivative operator:
$$∂_U = U^ρ ∂_ρ,$$
which is treated, conventionally, in the mathematical literature as the corresponding co-vector, itself: $∂_U = U$.
Now, start from the Cartan structure equations
$$Ω^a_b = dω^a_b + ω^a_c ∧ ω^c_b,\quad Θ^a = dθ^a + ω^a_c ∧ θ^c.$$
The players involved in this are the following.
- The co-frame one-forms $θ^a = h^a_μ dx^μ$. They are dual to the frame vectors $e_b = h^ρ_b ∂_ρ$ and the two matrices $\left(h^a_μ\right)$ and $\left(h^ρ_b\right)$ are inverses. If you also include frame and co-frame indices into the generalized notation, then both $h^a_μ$ and $h^ρ_b$ generalize to $δ^α_U$, since $δ^a_μ = δ^{θ^a}_{∂_μ} = ∂_μ·θ^a = h^a_μ$, and $δ^ρ_b = δ^{dx^ρ}_{e_b} = e_b·dx^ρ = h^ρ_b$. The inverse relation between the frame and co-frame makes this consistent when both indices made frame and co-frame, since $δ^{θ^a}_{e_b} = e_b·θ^a = δ^a_b$.
- The connection one-forms $ω^c_b = Γ^c_{μb} dx^μ$. The coefficients are just the connection coefficients written in frame and co-frame indices, since $Γ^c_{μb} = Γ^{θ^c}_{∂_μ e_b} = h^c_ρ \left(δ^ρ_ν ∂_μ + Γ^ρ_{μν}\right) h^ν_b$. The connection one-forms, themselves, can be treated as functionals, with $ω^α_V = α_ρ \left(δ^ρ_ν d + ω^ρ_ν\right) V^ν$. It is tensorial in $α$, but only affine in $V$.
- The torsion two-forms $Θ^c = ½ T^c_{μν} dx^μ ∧ dx^ν$, where $T^c_{μν} = Γ^c_{μν} - Γ^c_{νμ}$. The torsion generalizes to the linear functional
$$T^α_{UV} = \left(∇_U V - ∇_V U - [U,V]\right)·α = Γ^α_{UV} - Γ^α_{VU} - f^α_{UV}$$
and is tensorial in all of its indices. The subtraction $f^α_{UV}$ is included to compensate for and subtract out the non-tensorial parts of $Γ^α_{UV}$ and $Γ^α_{VU}$.
- The curvature two-forms $Ω^c_d = ½ R^c_{dμν} dx^μ ∧ dx^ν$, where $R^ρ_{σμν} = ∂_μ Γ^ρ_{νσ} - ∂_ν Γ^ρ_{μσ} + Γ^ρ_{μτ} Γ^τ_{νσ} - Γ^ρ_{ντ} Γ^τ_{μσ}$. The operator form of this is
$$\begin{align}
R^α_{WUV}
&= \left(\left(∇_U ∇_V - ∇_V ∇_U - ∇_{[U,V]}\right) W\right)·α\\
&= \left(∂_U Γ^ρ_{VW} - ∂_V Γ^ρ_{UW}\right) α_ρ + Γ^α_{Uρ} Γ^ρ_{VW} - Γ^α_{Vρ} Γ^ρ_{UW} - f^ρ_{UV} Γ^α_{ρW}
\end{align}$$
and is also tensorial in all of its indices, and the subtraction $f^ρ_{UV} Γ^α_{ρW}$ compensates for the non-tensorial parts of the remainder of the expression.
The connection and curvature are associated with the gauge group $GL(n)$, where $n$ is the dimension of the underlying manifold. They can be combined into the respective Lie-valued forms:
$$A = ω^c_a E^a_c,\quad F = Ω^c_a E^a_c$$
with the following Lie brackets
$$\left[E^a_c, E^b_d\right] = δ^a_d E^b_c - δ^b_c E^a_d.$$
In component form, the one-form and two-form are both Lie-valued:
$$A = A_μ dx^μ\quad (A_μ = Γ^c_{μa} E^c_a),\quad F = ½ F_{μν} dx^μ ∧ dx^ν\quad (F_{μν} = R^c_{aμν} E^c_a),$$
with
$$F_{μν} = ∂_μ A_ν - ∂_ν A_μ + \left[A_μ, A_ν\right].$$
The frame and torsion fields can be combined into vector-valued one-forms and two-forms:
$$q = θ^a E_a,\quad v = Θ^a E_a,$$
with vector-valued component forms
$$q = q_μ dx^μ\quad (q_μ = h^a_μ E_a),\quad v = ½ v_{μν} dx^μ ∧ dx^ν\quad (v_{μν} = T^a_{μν} E_a).$$
The basis of the vector space is given by the $E_a$, and they are acted on to the left by the Lie algebra, with
$$E^c_a · E_b = δ^c_b E_a.$$
Correspondingly, we can write
$$v_{μν} = ∂_μ q_ν - ∂_ν q_μ + A_μ · q_ν - A_ν · q_μ.$$
This is what we'll generalize to other gauge groups and for fields $q$ that are form-valued.
To generalize it, rewrite everything algebraically by adopting the conventions that the basis vectors $\left(E^a_c\right)$ and $\left(E_c\right)$ freely intersperse with the $dx^μ$, that $\left[E^a_c, E^b_d\right] = E^a_c E^b_d - E^b_d E^a_c$ (i.e. by embedding the Lie algebra of $GL(n)$ in a covering algebra), that $E^a_c E_d = E^a_c · E_d$ and that differential forms multiply by the wedge product. Then, using the anti-symmetry $dx^μ ∧ dx^ν = -dx^ν ∧ dx^μ$ we have
$$\begin{align}
A^2
&= \left(A_μ dx^μ\right) \left(A_ν dx^ν\right)\\
&= A_μ A_ν dx^μ ∧ dx^ν\\
&= ½ \left(A_μ A_ν dx^μ ∧ dx^ν + A_ν A_μ dx^ν ∧ dx^μ\right)\\
&= ½ \left(A_μ A_ν - A_ν A_μ\right) dx^μ ∧ dx^ν\\
&= ½ \left[A_μ, A_ν\right] dx^μ ∧ dx^ν.
\end{align}$$
Therefore
$$d A + A^2 = F.$$
The corresponding "Bianchi identity" can then be readily derived:
$$\begin{align}
d F + A F
&= d(d A) + d(A^2) + A (d A) + A (A^2)\\
&= 0 + (d A A - A d A) + A d A + A^2 A\\
&= (d A + A^2) A\\
&= F A.
\end{align}$$
Thus
$$d F + A F - F A = 0.$$
In addition, we have
$$\begin{align}
A q
&= \left(A_μ dx^μ\right) \left(q_ν dx^ν\right)\\
&= A_μ · q_ν dx^μ ∧ dx^ν\\
&= ½ \left(A_μ · q_ν dx^μ ∧ dx^ν + A_ν · q_μ dx^ν ∧ dx^μ\right)\\
&= ½ \left(A_μ · q_ν - A_ν · q_μ\right) dx^μ ∧ dx^ν,
\end{align}$$
making use of the anti-symmetry of the wedge product, again. Thus
$$d q + A q = v.$$
The analogue of the Bianchi identity is given by
$$\begin{align}
d v + A v
&= d (d q) + d (A q) + A (d q) + A (A q)\\
&= 0 + (d A q - A d q) + A d q + A^2 q\\
&= (d A + A^2) q\\
&= F q.
\end{align}$$
As an example, for a gauge field $A = A^a_μ Y_a dx^μ$, with a Lie basis $\left(Y_a\right)$ and Lie brackets $\left[Y_a, Y_b\right] = f^c_{ab} Y_c$, the field strength $F = ½ F^c_{μν} dx^μ ∧ dx^ν$ is given component-wise by
$$F^c_{μν} = ∂_μ A^c_ν - ∂_ν A^c_μ + f^c_{ab} A^a_μ A^b_ν.$$
Suppose there are another set of fields - scalar fields - $q = q^A e_A$ that are acted on the left by $Y_a · e_B = f^C_{aB} e_C$. The two sets of indices $(a)$ and $(A)$ may need not have the same dimension.
Then $v = v^C_μ e_C dx^μ$, where
$$v^C_μ = ∂_μ q^C + f^C_{aB} A^a_μ q^B.$$
This $v$ field is the gauge-covariant derivative of the $q$ field.
As a more concrete case-in-point: the gauge field $A$ is the boson field for the Standard Model, the gauge group is $U(1) × SU(2) × SU(3)$, and the scalar field $q$ is the Higgs.