Basic Commands
What you'll learn in this chapter: frequently used prompt patterns for file operations, code analysis, debugging, and Git integration
Prerequisites
You should have completed First Run and be comfortable with the basic interface.
Principles of Effective Promptsβ
How to give Claude Code instructions that work well:
β
Good: "Read src/auth/login.js and explain the password hashing logic"
β
Good: "Look at the README in the current directory and add the missing installation steps"
β Bad: "Fix the code" (too vague)
β Bad: "Write good code" (no criteria)
The key combination is a specific file name + a clear task + the result you want.
1. Reading and Analyzing Filesβ
Understanding File Contentsβ
> Read utils/helpers.js and explain what each function does
> Analyze the Props types in src/components/Button.tsx
> Find hardcoded values in config/database.js that should be moved to environment variables
Understanding a Whole Projectβ
> Look at this project's folder structure and explain the overall architecture
> Look at package.json and tell me what tech stack this project uses
> Read README.md and summarize the key points
2. Writing Codeβ
Creating New Filesβ
> Create a file called utils/validation.js.
Include validation functions for email, phone number, and password (8+ characters, must include a special character).
> Create components/Modal.jsx.
props: isOpen, onClose, title, children
Style it with Tailwind CSS
Adding Features to Existing Codeβ
> Add a user search feature to UserService.js.
Search by name or email, case-insensitive.
> Add pagination parameters to api/routes/products.js.
Use the format ?page=1&limit=20.
3. Debuggingβ
Analyzing and Fixing Errorsβ
> Run npm run build, check for errors, and fix them
> I got this error in the terminal: [paste the error message] β explain the cause and how to fix it
> Run all the tests in the tests/ folder and fix the failing ones
Performance Issuesβ
> The UserList component seems to re-render too often. Find the cause and optimize it
> This SQL query is slow: [paste the query] β suggest ways to optimize it
4. Refactoringβ
Improving Code Qualityβ
> utils.js is too big. Split it into separate files by feature
> Refactor this function to be more readable, keeping the behavior identical
> Convert the Promise-based code to async/await
Unifying Code Styleβ
> Update the entire controllers/ folder to match the project's .eslintrc rules
> Replace var with const/let across all components
5. Writing Testsβ
> Write Jest unit tests for each function in UserService.js
> Check the current test coverage and add tests for missing edge cases
> E2E test: write the login β dashboard navigation β logout flow with Playwright
6. Documentationβ
> Add JSDoc comments to all public functions
> Read the list of API endpoints and add an API documentation section to the README
> Update CHANGELOG.md based on the recent commit messages
7. Git Operationsβ
Claude Code can run git commands too:
> Check git status and summarize the modified files
> Review the changes, write an appropriate commit message, and commit
> Analyze the diff between the current branch and main, and draft a PR description
Frequently Used Slash Commandsβ
/model # Check the current model
/model claude-opus-4-6 # Switch to Opus (complex tasks)
/model claude-haiku-4-5-20251001 # Switch to Haiku (fast tasks)
/cost # This session's cost
/clear # Reset the conversation (start with fresh context)
/status # Check current settings
/help # Full help
Real-World Workflow Examplesβ
"Add a Feature" Workflowβ
1. > Get familiar with this project's structure (understand)
2. > Plan how to implement a user profile editing feature (plan)
3. > Implement it according to the plan (execute)
4. > Write tests (verify)
5. > Commit the changes (wrap up)
"Fix a Bug" Workflowβ
1. > Run npm test and show me the failing tests
2. > Analyze [the failing test file] and find the cause
3. > Fix it
4. > Run npm test again to confirm
Key Takeawaysβ
- A specific file name + a clear task is the effective combination
- Work in stages: read files β analyze β modify β verify
- Pick the right model for the job with
/model(cost optimization) - Claude Code can run terminal commands directly β git, npm, python, and more
Get weekly Claude Code tips by email
Real usage insights, delivered free. Subscribe β
Level 1 Complete!β
Congratulations! You've finished all of Level 1 β Getting Started.
μ΄ μ±ν°λ₯Ό μλ£νμ ¨λμ?
νμ΅ μ§λλ₯Ό 체ν¬νμ¬ λμ λ‘λλ§΅ λ¬μ±λ₯ μ λμ¬λ³΄μΈμ.