Let's start by computing heat capacities in a context that is a bit more general than polytropic processes; those defined by the constancy of some state variable $X$.
For concreteness, let's assume we are considering a thermodynamic system, like an ideal gas, whose state can be characterized by its temperature, pressure, and volume $(T,P,V)$ and for which the first law of thermodynamics reads
\begin{align}
dE = \delta Q - PdV
\end{align}
We further assume that there exists some equation of state which relates $T$, $V$, and $P$ so that the state of the system can in fact be specified by any two of these variables. Suppose that we want to determine the heat capacity of the system for a quasistatic process (curve in thermodynamic state space) for which some quantity $X=X(P,V)$ is kept constant. The trick is to first note that every state variable can be written (at least locally in sufficiently non-pathological cases), as a function of $T$ and $X$. Then the first law can be written as follows:
\begin{align}
\delta Q
&= dE + PdV \\
&= \left[\left(\frac{\partial E}{\partial T}\right)_{X}+P\left(\frac{\partial V}{\partial T}\right)_{X}\right]dT + \left[\left(\frac{\partial E}{\partial X}\right)_{T}+P\left(\frac{\partial V}{\partial X}\right)_{T}\right]dX
\end{align}
Now, we see that if we keep the quantity $X$ constant along the path, then $\delta Q$ is proportional to $dT$, and the proportionality function is (by definition) the heat capacity for a process at constant $X$;
\begin{align}
C_X = \left(\frac{\partial E}{\partial T}\right)_{X}+P\left(\frac{\partial V}{\partial T}\right)_{X}
\end{align}
Now, if you want an explicit expression for this heat capacity, then you simply need to determine the energy, pressure, and volume functions of $T$ and $X$ and then take the appropriate derivatives.
Consider, for example, a polytropic process like you originally described, and further, consider a monatomic ideal gas for which the energy and equation of state can be written as follows:
\begin{align}
E = \frac{3}{2} NkT, \qquad PV = NkT
\end{align}
For this process, we have
\begin{align}
X = PV^n
\end{align}
Using the equation of state and the definition of $X$, we obtain
\begin{align}
V = (NkT)^{1/(1-n)}X^{1/(n-1)}, \qquad P = (NkT)^{n/(n-1)}X^{1/(1-n)}
\end{align}
and now you can take the required derivatives in to obtain $C_X$ where $X$ is appropriate for an arbitrary polytropic process.
Moral of the story. If the system you care about can be written as a function of only two state variables, write all quantities in terms of $T$ and $X$, the variable you want to keep constant. Then, the first law takes the form $\delta Q = \mathrm{stuff}\,dT + \mathrm{stuff}\,dX$ and the $\mathrm{stuff}$ in front of $dT$ is, by definition, the desired heat capacity.