$cat ./tips/all
grep
prompting/tip-001
HOT

>Use CLAUDE.md for Persistent Context

Create a CLAUDE.md file in your project root to give Claude Code persistent context about your project. This file is automatically read at the start of every conversation, so you can include coding standards, project structure, and key decisions.

markdown
# CLAUDE.md

## Project Overview
This is a Next.js 14 app using TypeScript and Tailwind.

## Coding Standards
- Use functional components with hooks
- Prefer named exports over default exports
- Always use TypeScript strict mode

## Key Decisions
- We use Zustand for state management
- API routes are in /app/api
CLAUDE.mdcontextproject-setup
workflows/tip-005

>Set Max Turns for Autonomous Mode

Use the --max-turns flag to let Claude Code work autonomously for multiple steps. Great for complex refactoring tasks where you trust Claude to make good decisions.

bash
# Let Claude work for up to 10 turns without asking
claude --max-turns 10 "Refactor all components to use TypeScript strict mode"
autonomousflagsrefactoring
workflows/tip-012

>Git Integration Best Practices

Let Claude Code handle your git workflow. It can stage changes, write commit messages, and even create PRs. Just be clear about when you want to commit.

markdown
# Good prompts for git operations
"Stage and commit these changes with a descriptive message"
"Create a PR for this feature branch to main"
"Show me the diff before committing"

# Claude will handle git commands and ask for approval
gitversion-controlcommits
productivity/tip-003

>Use /compact to Save Context

When your conversation gets long, use the /compact command to summarize the conversation and free up context window space. This lets you continue working on complex projects without losing important information. AI context is like milk - it's best served fresh and condensed.

commandscontext-windowperformance
prompting/tip-006

>Use Plan Mode for Complex Tasks

Before tackling a big feature, ask Claude to create a plan first. This helps ensure you're aligned on the approach before any code is written. People new to AI coding often assume it can one-shot anything - plan mode doubles your success rate.

markdown
# Start with a plan
You: "Plan how we should implement user authentication with OAuth"

# Claude will outline the steps, files to create, and approach
# Then you can approve or adjust before implementation
planningarchitecturebest-practices
productivity/tip-014

>Slash Commands Reference

Memorize these essential slash commands to navigate Claude Code like a pro.

bash
/help     - Show all available commands
/clear    - Clear conversation history
/compact  - Summarize and compress context
/status   - Show current session status
/config   - View/edit configuration
/undo     - Undo last file change
/diff     - Show pending changes
commandsreferenceshortcuts
mcp/tip-004
HOT

>Custom MCP Server for Database Queries

Build a custom MCP server to let Claude Code query your database directly. This enables intelligent data exploration without manually writing SQL queries.

typescript
// mcp-server/database.ts
import { Server } from "@modelcontextprotocol/sdk/server";

const server = new Server({
  name: "database-mcp",
  version: "1.0.0",
});

server.tool("query_database", {
  description: "Run a read-only SQL query",
  parameters: {
    query: { type: "string", description: "SQL query to run" }
  },
  handler: async ({ query }) => {
    // Validate query is read-only
    if (!query.trim().toLowerCase().startsWith("select")) {
      throw new Error("Only SELECT queries allowed");
    }
    return await db.query(query);
  }
});
MCPdatabasetoolscustom-server
prompting/tip-010

>Memory Files for Long Projects

Create a memory.md file to track project state, decisions, and TODO items across sessions. Reference it in your CLAUDE.md so Claude always knows the current status.

markdown
# memory.md

## Current Sprint
- [x] Setup authentication
- [ ] Add user profiles
- [ ] Implement dashboard

## Decisions Made
- Using Postgres for database
- JWT tokens for auth
- Tailwind for styling

## Blockers
- Waiting on API keys from client
memoryproject-managementcontext
coding/tip-015

>Test-First Development

Ask Claude to write tests before implementing features. This leads to better code design and catches bugs early.

markdown
# Great prompt for TDD
"Before implementing the user registration feature:
1. Write unit tests for the registration logic
2. Write integration tests for the API endpoint
3. Then implement the feature to make tests pass"
testingTDDbest-practices
workflows/tip-002
HOT

>Infinite Agentic Loop for Parallel Generation

Use Claude Code's programmable nature to create infinite agentic loops that generate multiple variations in parallel. With just two prompts, you can spawn multiple agents working simultaneously.

bash
# Use the /project:infinite slash command
/project:infinite specs/my_spec.md output_dir 5

# This deploys 5 parallel agents to generate
# 5 unique iterations simultaneously
agentsparallelautomation
workflows/tip-008

>Use Task Agents for Parallel Work

Claude Code can spawn sub-agents to work on independent tasks in parallel. This dramatically speeds up multi-file changes and is one of the most powerful features for complex refactoring.

markdown
# In your conversation
"Update all API routes to use the new auth middleware.
You can work on multiple routes in parallel using task agents."

# Claude will spawn agents for independent route updates
agentsparallelperformance
setup/tip-007

>Quick Install with npx

No need to install Claude Code globally. Run it directly with npx for the latest version every time.

bash
# Run Claude Code without installing
npx @anthropic-ai/claude-code

# Or install globally for faster startup
npm install -g @anthropic-ai/claude-code
installationnpxgetting-started
productivity/tip-011

>Vim Mode Navigation

Enable vim keybindings in Claude Code for faster navigation. Perfect for developers who live in the terminal.

bash
# In your shell config (.zshrc or .bashrc)
export CLAUDE_EDITOR=vim

# Or configure in settings
claude config set editor vim
vimkeyboardnavigation
setup/tip-013

>API Key Management

Set your Anthropic API key as an environment variable for seamless authentication. Never hardcode keys in your projects!

bash
# Add to your shell profile
export ANTHROPIC_API_KEY="sk-ant-..."

# Or use a .env file (add to .gitignore!)
echo "ANTHROPIC_API_KEY=sk-ant-..." >> .env
echo ".env" >> .gitignore
api-keysecurityenvironment