Claude Code: 15 Useful Daily Commands

By Ricardo Gutierrez · · 19 min read

In this article

  1. Slash commands nativos
  2. Ejecutar comandos del sistema
  3. Crear comandos personalizados
  4. Atajos de teclado
  5. Flags de línea de comandos
  6. Encadenar comandos
  7. 10 trucos de productividad
  8. FAQ

Quick summary

The 15 most useful Claude Code commands: slash commands, shortcuts, agents, MCP and tricks to be more productive in the terminal.

Built-in slash commands

Claude Code (Anthropic) includes slash commands you can execute at any time. They're not prompts: they're system commands that control the session.

Team experience: At IAcademy we've accumulated over 1,000 hours using Claude Code across 15 real projects. We've generated over 30,000 lines of code, created 22 specialized agents and built a complete cyber intelligence platform with 62 API endpoints. What we share here comes from direct experience, including the mistakes.
/help      # Show complete help
/clear     # Clear conversation (new context)
/compact   # Compress context (saves tokens)
/cost      # Show how much you've spent in the session
/memory    # View/edit persistent memory
/model     # Switch model (Opus, Sonnet, Haiku)
/fast      # Toggle fast mode (same model, faster output)
/plan      # Planning mode (design before executing)
/review    # Review pending changes
/init      # Generate an initial CLAUDE.md for your project
/login     # Authenticate with your Anthropic account
/logout    # Log out
/doctor    # Diagnose configuration problems
/permissions # Manage tool permissions

Each slash command has a specific purpose. The most important for daily use are /compact, /clear, /cost and /model.

The 3 most useful

/compact: when the session gets long, compresses context without losing what matters. Use this before it fills up. Compression reduces context to approximately 20% of its original size, keeping key decisions and relevant code.

/clear: start from scratch. Useful when you completely switch tasks. Doesn't lose persistent memory (CLAUDE.md), only the current conversation context.

/cost: to control spending. Especially useful with Opus, which consumes tokens 5x faster than Sonnet. An intensive Opus session can cost 5-10 USD in 2 hours.

Real data: In IAcademy's CiberContratacion project, Claude Code generated 85% of the code for a platform with 40+ pages, 6 interactive visualizations and a 24-chapter book. The trick isn't asking it to write code: it's giving it enough context to write the right code.

/model deserves special attention. Claude Code lets you switch models during the session:

The optimal strategy: start with Sonnet, switch to Opus when you need deep reasoning, and use Haiku for simple maintenance tasks.

Execute system commands

With the ! prefix you can execute any terminal command without leaving Claude Code:

! git status          # Ver estado del repo
! npm test            # Ejecutar tests
! docker ps           # Ver contenedores
! ls -la src/         # Listar archivos
! cat package.json    # Ver un archivo
! python script.py    # Ejecutar script
! curl -s api.com/v1  # Hacer petición HTTP
! wc -l src/**/*.py   # Count lines of code

The result appears directly in the conversation. Claude Code sees it and can act accordingly. This is especially powerful for debugging: you run a command, Claude Code reads the output and suggests the next step.

Practical debugging example with !:

# You: "Tests are failing, I don't know why"
! npm test
# Claude Code reads the error output and responds:
# "The test in auth.test.js fails on line 42.
#  The jwt.verify mock isn't configured.
#  I'll add the mock..."

The ! prefix executes the command and shows the result in the conversation context. Claude Code can then reason about the output and propose actions. More efficient than copy/pasting from another terminal.

Create custom commands

The most powerful Claude Code feature: create your own slash commands. They're saved as markdown files in .claude/commands/:

# .claude/commands/review-pr.md
Revisa el PR actual. Busca:
1. Bugs o errores lógicos
2. Vulnerabilidades de seguridad (OWASP Top 10)
3. Tests faltantes
4. Problemas de rendimiento
Formato: lista priorizada por severidad.

Now you type /review-pr in Claude Code and it executes that prompt. You can pass arguments with $ARGUMENTS:

# .claude/commands/explain.md
Explica el archivo $ARGUMENTS de forma concisa:
- Qué hace
- Dependencias principales
- Puntos de atención

# Uso: /explain src/api/auth.py

Custom commands are Claude Code's most underrated feature. They turn repetitive prompts into reusable functions. Here are some commonly used examples:

# .claude/commands/commit.md
Analiza los cambios staged (git diff --cached).
Genera un commit message siguiendo Conventional Commits:
- tipo(scope): descripción breve
- Cuerpo con contexto si es necesario
Ejecuta el commit.

# .claude/commands/test-coverage.md
Ejecuta los tests con cobertura.
Identifica los 5 archivos con menor cobertura.
Para cada uno, sugiere qué tests añadir.

# .claude/commands/security-check.md
Revisa el código del directorio $ARGUMENTS buscando:
1. Secrets hardcodeados (API keys, tokens, passwords)
2. SQL injection
3. XSS vulnerabilities
4. Dependencias con CVEs conocidos
Ejecuta: npm audit o pip audit según el proyecto.

# .claude/commands/daily-standup.md
Resume el trabajo del último día:
1. git log --since="yesterday" --oneline
2. Issues asignados a mí en GitHub
3. PRs pendientes de review
Formato: bullet points para standup meeting.
/review-pr Revisar PR actual /explain Explicar archivo /seo-article Generar artículo SEO
Custom commands: reusable prompts as functions

Command organization. As you create more commands, organize them by domain. You can create subdirectories inside .claude/commands/:

.claude/commands/
├── dev/
│   ├── commit.md
│   ├── test-coverage.md
│   └── refactor.md
├── security/
│   ├── security-check.md
│   └── dependency-audit.md
├── content/
│   ├── seo-article.md
│   └── social-post.md
└── ops/
    ├── daily-standup.md
    └── deploy-check.md

Keyboard shortcuts

Claude Code responds to several keyboard shortcuts that speed up workflow:

Ctrl+C     # Cancel current operation (without exiting)
Ctrl+D     # Exit Claude Code
Esc        # Cancel current prompt editing
Tab        # Autocomplete file paths in prompt
Shift+Tab  # Reverse autocomplete
Up/Down    # Navigate previous prompt history
Ctrl+L     # Clear screen (visual /clear equivalent)

The most important is Ctrl+C. If Claude Code is running a long task (refactoring 50 files) and you want to stop it, Ctrl+C cancels the current operation without losing the session context. Different from Ctrl+D, which closes the session entirely.

Prompt history. Up/Down arrows navigate your previous prompts in the session. Especially useful when iterating on a prompt: run it, see the result, press Up, modify it and run again.

Command line flags

Claude Code accepts flags at startup that change its behavior. The most useful:

# Ejecutar un prompt sin sesión interactiva
claude --print "genera un .gitignore para Python"

# Continuar la última sesión
claude --resume

# Iniciar con un prompt específico
claude "analiza este repo y dame un resumen"

# Pasar un archivo como contexto
cat error.log | claude "explica estos errores"

# Especificar el modelo desde el inicio
claude --model opus "diseña la arquitectura de este servicio"

# Modo no interactivo con output a archivo
claude --print "genera el schema SQL" > schema.sql

# Usar un directorio diferente
claude --cwd /path/to/project "ejecuta los tests"

# Activar modo verbose para debugging
claude --verbose

The most underrated flag: --print. Runs a prompt and returns only the output, without interactive interface. Perfect for scripts, CI/CD pipelines and automation. Example usage in a bash script:

#!/bin/bash
# Script: daily-report.sh
REPORT=$(claude --print "resume los commits de hoy: $(git log --since=today --oneline)")
echo "$REPORT" | slack-post --channel #dev-updates

Chaining commands

An advanced technique: chain multiple actions in a single prompt. Claude Code understands sequential instructions:

# Encadenamiento simple
"Lee src/api/auth.py, identifica vulnerabilidades de seguridad,
crea un issue en GitHub con las findings, y envía un resumen a Slack"

# Con condiciones
"Ejecuta npm test. Si algún test falla, identifica la causa raíz,
propón un fix y crea un PR con el cambio. Si todos pasan, haz merge"

# Con iteración
"Para cada archivo .py en src/workers/, añade docstrings a las
funciones públicas que no tengan. Usa Google style docstrings"

The key to effective chaining is being specific at each step. Claude Code executes steps sequentially, using each step's result as input for the next. If a step fails, it stops and explains why.

Combining ! with prompts:

# Primero ejecutas un comando para obtener contexto
! git diff --stat HEAD~5
# Luego pides a Claude Code que actúe sobre ese contexto
"Resume los cambios de los últimos 5 commits y genera un changelog"

This "context first, action second" technique is the most effective way to work with Claude Code. The ! command gives you real data, and the prompt turns that data into action.

10 productivity tricks

  1. Direct prompt from terminal: claude "what does this file do?" src/main.py — responds without opening interactive session.
  2. File piping: cat error.log | claude "explain these errors" — passes content directly.
  3. Headless mode: claude --print "generate a .gitignore for Python" — output without interface, ideal for scripts.
  4. Resume session: claude --resume — continues the last session with all context.
  5. Multiple files: mention paths in your prompt and Claude Code reads them automatically. No copy/paste needed.
  6. Compact before saturation: when you notice responses losing context or repeating, run /compact. Don't wait for the session to fill completely.
  7. Model per task: use /model haiku for quick tasks (formatting, simple questions), /model sonnet for normal development, and /model opus only for complex reasoning (architecture, difficult debugging).
  8. CLAUDE.md as permanent context: everything Claude Code needs to know about your project should be in CLAUDE.md. Conventions, structure, dependencies, architecture decisions. So you don't repeat it every session.
  9. Custom commands for repetitive tasks: if you do something more than 3 times, create a custom command. The 5-minute investment creating the .md pays for itself in the first week.
  10. Built-in git: Claude Code knows git. Instead of leaving the terminal to commit, push or create branches, ask it. "Commit the changes with a descriptive message and push to origin".

The most important trick

It's not a command, it's a habit: give context before asking. "Refactor auth.py" is a bad prompt. "We're migrating from JWT to OAuth2. Refactor auth.py to use the new AuthProvider (defined in src/providers/auth.py) and make sure the 3 endpoints in /api/v1/auth/ keep working" is a good prompt. The difference in output quality is enormous.

For the complete guide on what is Claude Code and how to install it, we have dedicated articles. If you want to connect with external tools, read the MCP guide.

FAQ

Do custom commands work in any project?

Depends on where you save them. If you put them in .claude/commands/ inside the project, they only work in that project. If you put them in ~/.claude/commands/ (your home), they work in all projects. Project-specific commands (like /review-pr with team rules) go in the project. Generic ones (like /explain) go in home.

How much does a typical Claude Code session cost?

With Sonnet (default model), a 1-hour session with moderate activity costs between 0.50 and 2 USD. With Opus, multiply by 5. The /cost command gives you real-time spending. The Pro plan (20 USD/month) includes a generous daily limit.

Can I use Claude Code without internet?

No. Claude Code needs internet to communicate with Anthropic's models. Models run on Anthropic's servers, not locally. If you need offline AI, alternatives like Ollama + a local model are the option.

What if Claude Code modifies something it shouldn't?

Claude Code asks for confirmation before executing destructive actions (deleting files, pushing, modifying configuration). Also, if you use Git, you can always git diff to see what changed and git checkout . to revert. The advice: commit before asking it for large tasks.

Master Claude Code

Module 03 (free) covers installation, commands, hooks and your first working agent.

Access Module 03 free