Credit feels like a fixed pie, give some away and there's less for you. In practice it behaves more like trust: the more visibly you give it away, the more people want to work with you, and the more good work ends up attached to your name over time.
Giving credit is the easier half of this to get right, and most people still get it wrong by defaulting to silence. Naming specific people, specifically, in front of the people who matter, not a vague "great team effort", is what actually lands. Generic credit costs you nothing and gives the recipient nothing either. Specific credit costs you nothing and genuinely changes how someone feels about working with you.
"Great team effort on this one, everyone."
"I want to call out that the fix here came from Priya noticing a pattern in the error logs that the rest of us had missed for two days. That instinct is exactly why this got caught before it hit customers."
Taking credit is the harder half, because the instinct many people have is to deflect it entirely, "oh, it was nothing," "really it was the whole team", which feels humble but actually creates a different problem: it makes it hard for anyone above you to accurately track what you're capable of. There's a version of accepting credit that's honest and doesn't overreach: acknowledge your specific contribution plainly, and credit whoever else was involved in the same breath.
"Thanks, I led the redesign of the onboarding flow, and Marcus did the engineering work that made it actually ship on time. It was a real two-person effort."
That sentence does two things at once: it lets the person you're talking to accurately understand what you did, and it makes sure Marcus isn't invisible in the story. Neither of those things happens if you either grab all the credit or deflect all of it, both versions leave the room with a distorted picture of what actually happened.
The trickiest version of this is when credit gets misattributed by someone else, in the moment, in front of others, your idea gets attributed to a colleague, or vice versa. Correcting it in the room, calmly and without making it a bigger deal than it is, is almost always better than letting it slide and quietly resenting it later. "Just to clarify, that approach was actually something Dana proposed last week" takes five seconds and prevents a much longer-running frustration.