Hands-On Claude Code Tutorial: Project Setup & Essential Commands (Part 1)
This first part of our Claude Code tutorial series covers project environment initialization, key interactive and CLI commands for Claude Code, the Ant...
Welcome to the first part of our hands-on tutorial series on AI project development with Claude Code! In this series, we’ll use the open-source chinese-poetry-api-main project as a practical example to explore how to leverage Claude Code for efficient coding, project analysis, and environment setup.
Claude Code: Interactive Slash Commands
Claude Code offers a set of interactive slash commands that help control sessions, manage context, and execute tasks directly within a conversation. For example, the /init command initializes Claude Code in your project and generates a CLAUDE.md configuration file—essential for setting up your project environment. Other key commands include /tasks (to list background tasks like sub-agents), /diff (to show uncommitted code changes), and /code-review (to perform multi-dimensional code reviews for errors and improvements).
Claude Code: CLI Startup Commands
Beyond interactive sessions, Claude Code provides CLI startup commands for more control over how sessions are launched. The claude command starts a new interactive session, while claude -c resumes the most recent uncompleted conversation. To restore a specific historical session, use claude -r "session-name" (e.g., claude -r "auth-refactor"). Keeping your tool up-to-date is easy with claude update.
Ant: Official API Client Commands
Ant is the official CLI client for the Claude API, designed for resource operations. Its command structure follows ant . For model management, ant models list shows all available Claude models, and ant messages create is the core command for sending messages to Claude (e.g., ant messages create --model claude-opus-4-8 --max-tokens 1024 --message '{role: user, content: "Hello, Claude"}'). Common parameters like --format (for output format) and --debug (for HTTP request/response logs) enhance usability.
Practical Tips for Effective Use
To get the most out of these tools, remember to use the --help flag for any command (e.g., claude --help or ant messages create --help) when in doubt. You can combine parameters—like claude -c -p "check for type errors"—to resume the latest session and run a non-interactive check. Pipe operations are also supported: for example, cat logs.txt | claude -p "explain these logs" lets you analyze log files directly.
Analyzing Projects with Claude Code
The recommended way to analyze a project is to start an interactive Claude Code session in the project’s root directory. Using natural language questions, you can quickly get insights: ask about the tech stack, directory responsibilities, how to run tests, or even find specific code (like user authentication handling).
Sources
- CSDN Blog: peraglobal, "Hands-On AI Project Development with Claude Code (Part 1): Project Environment Initialization" (URL: https://blog.csdn.net/peraglobal/article/details/164184151)