A typical way to do it is to treat puzzles the same as players and rate them based on whether they "win/lose" and the rating of the "opponent"
ChessTempo has a nice explanation here copied below:
The rating system is inspired by an idea implemented at the Chess
Tactics Server. CTS treats both problem solvers and the problems as
opponents with their own ratings and adjusts their rating after
problem completion (or failure) based on the Glicko ratings system.
For blitz style games, time taken to solve problems is considered and
an extra bonus is given for problems solved quickly. The solver gets a
larger rating increase for problems solved quicker than one standard
deviation from the average time taken for that problem. For problems
solved faster than average but less than one standard deviation from
the average, the normal Glicko based adjustment is made. If the
problem is solved in slower than average time then the Glicko rating
adjustment is reduced in proportion to how much slower than average
the problem was solved. Very slow solutions may result in losing
rating points, however you will never lose more points than you would
if you simply got the problem wrong.
When calculating the average time taken on a problem, only correct
solutions are included, time taken from incorrect attempts are not
used to calculate the average time a problem takes to solve.
It is important to note that after a recent change to time handling in
blitz mode, time taken after the first move is punished more severely
than time taken before making your first move. The intention of this
feature is to discourage 'incremental' guessing to try and solve a
problem, rewarding users who sum up the situation before making their
move sequence. Users who prefer to use an incremental approach may
still do so, however their rating will be lower than users at the same
level who think out the solutions first.
Normal Glicko adjustments are made for standard ratings with no
penalty for time taken. Problems marked incorrect cause the rating of
that problem to increase and the solver's rating to decrease as
dictated by normal Glicko rating calculations. Normal Glicko
adjustments are also made for blitz problems that are marked wrong
(i.e. the time taken in blitz is ignored when making rating
adjustments for incorrect problems).