Claudius affected Hamlet's madness in a number of ways.
First, he set its wheels in motion by killing Hamlet's father, King Hamlet. This in turn led to the visits by his father's ghost. Once Hamlet's father demanded his son avenge his death, Hamlet's madness began.
Claudius worsened the situation by chastising Hamlet for continuing to mourn his father's death. He suggested Hamlet should act like a man and get over the death. He also flaunted his relationship with Hamlet's mother and his new role in Hamlet's life (father). This only spurred Hamlet's hatred and desire for revenge, which ultimately led to his madness.
As Hamlet's hatred of his uncle grew, Claudius continued to interfere: sending childhood friends Rosencrantz and Guildenstern and Ophelia's father to spy on his nephew/son. The spying added to Hamlet's instability by leaving him with few to trust.
We gain a better understanding of Claudius through his ruthlessness. Hamlet is first unable to murder his Uncle because of his conscience, which his uncle does not posses. He and Hamlet do share some qualities. They both use people as pawns and the depth of their plans grows as they become further entrenched in their conflict.