New: Skill bounties are live. Post a request, fund the bounty, and creators compete for 7 days to build it -> See open bounties

    Guides
    claude-code
    best-practices
    workflow

    Claude Code Best Practices: What Actually Works (2026)

    The habits that separate people who get good output from Claude Code from people who fight it. Context management, CLAUDE.md, and Plan Mode discipline.

    July 31, 20267 min read
    Share:

    Most Claude Code frustration traces back to four things: too much context, no project conventions written down, no planning step on complex changes, and no skills installed. Each has a fix that takes minutes.

    Quick Answer: Keep sessions short and use /clear between unrelated tasks. Write a CLAUDE.md with your project's conventions. Use Plan Mode for anything touching three or more files. Install skills so Claude applies your standards without being told each time.

    Treat context as a budget, not a bucket

    Claude Code degrades over a long session. Early context, a resolved bug, an abandoned approach, a file you stopped caring about, stays in the window and competes with what matters now.

    The habit: /clear between unrelated tasks. /compact when you're mid-task and running low but need the history summarised.

    A useful signal: if Claude references something you dealt with 40 minutes ago as though it's current, the context is stale. Clear it.

    Why this works: relevance beats volume. Claude with 20% of the context and all of it relevant outperforms Claude with everything.

    Recommended skills

    Write a CLAUDE.md before you write prompts

    CLAUDE.md is a file in your project root that Claude reads at session start. Without one you re-explain your conventions every session, and Claude quietly invents them when you don't.

    A CLAUDE.md that earns its place:

    # Project: payments-api
    
    ## Stack
    Node 20, TypeScript strict, Fastify, Postgres via Drizzle, Vitest.
    
    ## Conventions
    - No default exports
    - Errors: throw typed AppError, never return null for failure
    - All DB access through repositories in src/repos/, never inline queries
    - Tests live next to source as *.test.ts
    
    ## Architecture decisions
    - Money is stored as integer cents, never float
    - All external calls go through src/clients/ with retry + timeout
    - Migrations are forward-only. Never edit an applied migration.
    
    ## Don't
    - Don't add dependencies without asking
    - Don't touch src/legacy/, it's being deleted in Q4
    

    Run /init to generate a starting point, then edit it. The generated version describes what exists; you need to add what should exist.

    What this demonstrates: the value is in the constraints and the "don't" section, not the stack list. Claude can read package.json. It can't infer that money is stored as cents.

    Use Plan Mode for anything multi-file

    Plan Mode blocks every write tool until you approve a plan. Claude reads, maps dependencies, and proposes a numbered list of changes.

    Use it for refactors, schema changes, unfamiliar codebases, and anything touching three or more files. Skip it for single-file edits and questions.

    The cost is roughly 30 seconds of reading. The benefit is catching a wrong approach before eleven files change rather than after.

    Full detail in Claude Code Plan Mode.

    Why this works: reviewing a plan is faster than reviewing a diff, and reverting a plan is free.

    Be specific about failure, not just success

    Most prompts describe the desired outcome. Better prompts describe what a wrong answer looks like.

    Instead of:

    Add caching to the user lookup
    

    Try:

    Add caching to getUserById in src/repos/users.ts.
    
    Requirements:
    - Cache in Redis, 5 minute TTL
    - Invalidate on any write to the users table
    - Cache misses must not throw if Redis is down, fall through to Postgres
    
    Do not add a new dependency. We already have ioredis in the project.
    

    What this demonstrates: the constraints do the work. The second prompt rules out the three most likely wrong answers before Claude starts.

    Install skills instead of repeating yourself

    If you're typing the same instruction in most sessions, that's a skill.

    Skills load automatically when their description matches your request. They work across Claude Code, Cursor, OpenClaw, Codex CLI, and other SKILL.md-compatible agents, so the same file follows you between tools.

    The ones worth installing first:

    code-reviewer, 764 installs, free. Structured review with severity ratings instead of general commentary.

    git-commit-writer, 232 installs, free. Conventional commits from the staged diff.

    env-doctor, 86 installs, free. Diagnoses why a project won't start.

    truth-first, 11 installs, free. Forces Claude to verify system state before acting on assumptions.

    Install by dropping the folder in ~/.claude/skills/. Browse all skills on Agensi.

    Why this works: a skill turns a preference you keep restating into a default.

    Run tests in the loop, not after

    Claude writes code that looks correct and fails at runtime more often than code that looks wrong. Closing that loop matters more than any prompting technique.

    Tell Claude the test command explicitly and ask it to run tests after changes:

    After each change, run `npm test -- --run` and fix any failures before moving on.
    

    Better, put it in CLAUDE.md so you never type it again.

    What this fixes: the pattern where Claude declares something done and you discover three broken tests an hour later.

    The habits, in order of impact

    1. Write a CLAUDE.md with conventions and constraints
    2. Install three or four skills for work you do repeatedly
    3. Use /clear between unrelated tasks
    4. Use Plan Mode for anything multi-file
    5. Give Claude the test command and ask it to run tests in the loop
    6. Write prompts that rule out wrong answers, not just describe right ones

    For the full command surface, read Claude Code Commands Reference.

    Keep reading

    Frequently Asked Questions