Hi,
There are several ways to do this. A possibility is to use xTensor's internal tool to define derivative operators:
<< xAct`xTensor`
xAct`xTensor`Private`MakeLinearDerivative[{derL, derR}, True]
Then now we have:
In[8]:= derL[a + b]
Out[8]= derR[a] + derR[b]
In[9]:= derL[a b]
Out[9]= b derR[a] + a derR[b]
Note how we write derL in input and we get derR in output. This can be useful when derL has patterns but derR does not, say for example with covariant derivatives like
xAct`xTensor`Private`MakeLinearDerivative[{cd[a_], cd[a]}, True]
Then we can use
In[11]:= cd[b][x y]
Out[11]= y cd[b][x] + x cd[b][y]
The True in the second argument indicates that the Leibniz rule is needed. If we use False then only linearity over Plus is implemented.
Cheers,
Jose.