Claude/Code/How To/Use Essential Commands
Properties
- tags
- Diataxis/How To
How To Use Essential Claude Code Commands
Goal
Preconditions
Procedure
1. Set Up Project Rules with
claude.md- Run
/initand confirm creation ofclaude.md. - Edit the file with rules such as:
Write secure, best-practice Python code
Generate & run tests for each function; iterate until tests pass
Delete test scripts after success
Commit after every new function
- Commit
claude.mdto the repo so Claude Code enforces the rules automatically.
- Run
2. Add Custom User Commands
3. Run One-Shot File-Scoped Queries with
-p4. Extract Context from Images
5. Control Output & Encourage Deep Reasoning
6. Access Additional Working Directories with
--add-dir- Add additional working directories for Claude to access (validates each path exists as a directory):bash
claude --add-dir ../apps ../lib - Useful for monorepos or when working with related projects that need to be accessible in the same session
- Reference: CLI flags documentation
- Add additional working directories for Claude to access (validates each path exists as a directory):
Troubleshooting
References