The $n$-dimensional matrix representations of a group or an associative algebra $A$ form a space (algebraic variety) Rep$(A,n)$ called the $n$-th representation variety of $A$. This is a classical geometric invariant that plays a role in many areas of mathematics. The construction of Rep$(A,n)$ is natural (functorial) in $A$, but it is not ‘exact’ in the sense of homological algebra. In this talk, we will explain how to refine Rep$(A,n)$ by constructing a derived representation variety DRep$(A,n)$, which is an example of a derived moduli space in algebraic geometry. For an application, we will look at the classical varieties of commuting matrices, and present a series of combinatorial conjectures extending the famous Macdonald conjectures in representation theory.