Mahonia are best left unpruned if possible but there are instances when you may want to prune a Mahonia shrub. All pruning is best done in late summer, you can prune out any damaged or diseased branches but as disease is not really a issue with Mahonis this is proberly not needed.
If you have an established Mahonia that seems bare at the bottom and has long bare branches reaching out then they can be pruned to encourage new growth.
First you can prune out some of the branches totaly to let more light into the centre of the plant, this will encourage new growth in Spring. Long branches that are bare untill the wnd of the branches can be pruned so that the branch is only around 1ft (12?) long, this will encourage new leaf growth in these branches.
Finaly pruning can be done to keep the shrubs shape well rounded by trimming leaves off to form the desired shape.
Like mentioned above Mahonia are best left unpruned but giving them a little pruning or even a hard pruning will not do them any harm.