/code-practices:tradeoffsfrom code-practices
Present multiple approaches with explicit tradeoffs before committing to one. Use when there are multiple valid solutions to a problem.
Ships in code-practices. Installing the plugin adds it to Claude Code.
Use when there are multiple valid approaches to a problem. Force explicit consideration of alternatives.
Karpathy: "They don't present tradeoffs, they don't push back when they should."
LLMs pick an approach and run with it. This skill forces consideration of alternatives and their tradeoffs.
Before implementing, ask: "Is there more than one reasonable way to do this?"
If yes, stop and enumerate the options.
Don't filter yet. List every approach that could work:
## Options for User Session Storage
### Option A: JWT in localStorage
### Option B: JWT in httpOnly cookie
### Option C: Server-side sessions with Redis
### Option D: Server-side sessions with database
For each option, consider:
| Criterion | Option A | Option B | Option C | Option D |
|---|---|---|---|---|
| Security | XSS vulnerable | CSRF vulnerable | Most secure | Secure |
| Scalability | Excellent | Excellent | Needs Redis | DB load |
| Complexity | Simple | Medium | Medium | Simple |
| Stateless | Yes | Yes | No | No |
| Mobile support | Easy | Hard | Easy | Easy |
## Recommendation: Option B (JWT in httpOnly cookie)
### Why
- Best balance of security and simplicity
- Immune to XSS attacks (main threat vector)
- CSRF mitigated with SameSite=Strict
### What We Give Up
- Slightly more complex mobile integration (need to handle cookies)
- Token can't be easily accessed from JavaScript (intentional)
- Slightly larger request payload (cookie sent with every request)
### What We Gain
- Automatic CSRF protection with SameSite
- No JavaScript access = immune to XSS token theft
- Built-in expiration handling
### Alternative Considered
Option C (Redis sessions) would be more secure but adds infrastructure complexity. Recommended if we later need session revocation.
Present the tradeoffs to stakeholders. Don't assume the "obvious" choice is correct.
## Decision: [What needs to be decided]
### Context
[Why this decision matters]
### Options Considered
#### Option A: [Name]
**Pros:** [List]
**Cons:** [List]
**Best when:** [Conditions]
#### Option B: [Name]
**Pros:** [List]
**Cons:** [List]
**Best when:** [Conditions]
### Recommendation
[Which option and why]
### Tradeoffs Accepted
[What we're giving up]
### Revisit If
[Conditions that would change this decision]
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub rahulsub/code-practices-plugin --plugin code-practices13 commands in this plugin
/cleanupSystematic code cleanup after completing features. Use after refactoring or periodically to remove dead code, console statements, TODOs, and tech debt./code-reviewReview code like a skeptical senior engineer. Use when reviewing PRs, after generating significant code, or before merging changes./context-managementManage Claude Code sessions effectively. Use during long sessions, multi-step tasks, or when responses start degrading. Covers /clear, checklists, and subagents.Other plugins' commands for the same job