← kial.ai
Free · Bookmark This

The Claude Code cheat sheet.

Every command, pattern, and trick — one page.

Slash Commands
/helpShow all available commands
/add-dir [path]Add a directory to context
/compactSummarise conversation, free context
/clearFresh start (keeps file context)
/modelSwitch model mid-session
/costShow current token cost
/reviewReview recent changes
/initGenerate AGENTS.md for current project
/bugReport a bug to Anthropic
Context Management
Keep sessions focused — one feature or bug at a time
Use /compact before context fills, not after
/add-dir only what's relevant — less is more
Start new sessions for unrelated tasks
Reference specific files and line numbers
Long context = degraded quality. Treat it like RAM.
Prompt Patterns That Work
Plan First
Before writing any code, describe your approach in 3-5 bullet points. Wait for my approval before proceeding.
Fix With Context
In [filename], the function [name] is throwing [exact error]. Here is the stack trace: [paste]. Fix it without changing the function signature.
Feature With Constraints
Add [feature] to [file]. Requirements: [list]. Do not modify [other file]. Follow the existing pattern in [example file].
Refactor Safely
Refactor [function/file] to [goal]. Do not change any public interfaces or break existing tests. Show me the diff before applying.
Git Workflow
git add -A && claude -p "write a conventional commit message for these staged changes"
claude "implement [feature], then stage all changes and write a commit message"
Common Mistakes
Too broad: "fix my app" — give a specific target
No errors: paste the actual error, not a description
No AGENTS.md: the biggest leverage point beginners skip
Long sessions: context degrades — use /compact
Blind trust: always read the diff before accepting
AGENTS.md Quick Template
# AGENTS.md

## Project Overview
[One paragraph describing what this project does]

## Tech Stack
- Language: [e.g. TypeScript / Python]
- Framework: [e.g. Next.js 14 / FastAPI]
- Database: [e.g. PostgreSQL via Prisma]

## Commands
- Dev: `npm run dev`
- Test: `npm test`
- Lint: `npm run lint`

## Rules
- NEVER commit directly to main
- ALWAYS run tests before marking a task done
- NEVER use `any` type in TypeScript
- Keep functions under 50 lines
→ Browse 10 full AGENTS.md templates