You have a toxic manager. The advice you've gotten so far is some version of "document everything and go to HR." That's incomplete advice. Here's the fuller framework.
First, classify the toxicity: Type A. Incompetent but well-meaning: makes bad decisions, doesn't shield team, but isn't malicious. (Fixable through workarounds.) Type B. Volatile but high-functioning: explodes occasionally, demanding standards, but does fight for the team. (Survivable, especially if they like you.) Type C. Politically threatening: takes credit, throws people under the bus, plays favorites. (Most dangerous, leave faster than feels comfortable.) Type D. Abusive (harassment, discrimination, retaliation): legal territory. Document, escalate, exit, possibly litigate.
The right move differs sharply by type. Mixing them up is the most common mistake.
For Type A (incompetent but well-meaning): Manage up aggressively. Bring decisions pre-formed with recommendations. Build relationships with their peers and skip-level. You need exposure outside this one relationship to be promotable. Time horizon: 6-12 months. If the manager doesn't grow into the role, leave the team (not necessarily the company).
For Type B (volatile but high-functioning): Learn their patterns. Most volatile managers are predictable if you watch closely. Don't take volatility personally; it's almost never about you. Demand specific feedback after the explosion: "What specifically should I do differently?" This often surfaces actual signal. Time horizon: as long as you're growing. The day you stop learning, leave.
For Type C (politically threatening): DOCUMENT. Save every email, every Slack thread. Forward important ones to personal email. Build relationships outside their sphere of influence, fast. Start interviewing externally. The window between "I have a bad manager" and "my manager has poisoned my reputation past the point of repair" is shorter than you think. 6 months max.
For Type D (abusive): Different playbook entirely. Engage employment attorney early ($300-500 for a consultation is worth it). Document everything in writing (not Slack). HR works for the company, not for you, they are not your ally.
The advice "document everything and go to HR" is correct only for Type D. For A and B, it's overkill. For C, it's too slow.