claude-code
SKILL.md
Claude Code (Official CLI)
This skill wraps the @anthropic-ai/claude-code tool. It provides a powerful, agentic coding experience directly in your terminal.
🛠️ Prerequisites
- Install:
npm install -g @anthropic-ai/claude-code # Or macOS (Homebrew): # brew install --cask claude-code - Authenticate (Run once manually):
Follow the browser flow to connect your Anthropic account.claude login
🚀 Usage Patterns
Always use pty:true for claude commands to ensure proper interaction and output formatting.
1. One-Shot Task (The -p flag)
Use the -p (print/prompt) flag for single, non-interactive tasks or when piping input. This is best for automation.
# Direct task
bash pty:true workdir:~/my-project command:"claude -p 'Fix the bug in auth.ts where the token expires too soon'"
# Code Review (Pipe git diff)
bash pty:true workdir:~/my-project command:"git diff main | claude -p 'Review these changes for security vulnerabilities'"
2. Interactive Session
Start a persistent session where you can give follow-up instructions.
# Start session
bash pty:true workdir:~/my-project command:"claude"
# In the session (via process tool):
# > Write input: "Refactor the database schema"
# > Write input: "/compact" (to save context)
3. Project Configuration (CLAUDE.md)
Create a CLAUDE.md file in your project root to teach Claude about your project's style, build commands, and architecture.
# CLAUDE.md
- Build command: `npm run build`
- Test command: `npm test`
- Style: Use TypeScript, functional components, and Tailwind CSS.
🎛️ Key Commands & Flags
| Command / Flag | Description |
|---|---|
claude |
Start interactive session |
claude -p "text" |
Run one-shot prompt (Recommended for agents) |
/compact |
Reduce context window usage (in session) |
/cost |
Show current session cost (in session) |
/init |
Initialize a new project with CLAUDE.md |
/bug |
Report a bug to Anthropic |
⚠️ Best Practices for Agents
- Use
-pfor reliability: When automating,claude -p "prompt"is more predictable than interacting with the shell REPL. - Safety: Claude Code can execute shell commands. Ensure you are running in a safe environment or monitoring its output.
- Context: Always run from the root of the git repository (
workdir:~/project) so Claude sees the full context. - Auto-Updates: The npm package updates frequently. Run
npm update -g @anthropic-ai/claude-coderegularly.
🤖 Example Workflow: Feature Implementation
- Plan:
bash pty:true command:"claude -p 'Read src/api and plan a rate-limiting feature'" - Implement:
bash pty:true command:"claude -p 'Implement the rate-limiting plan using Redis'" - Verify:
bash pty:true command:"claude -p 'Write a test for the rate limiter and run it'"
Weekly Installs
1
Repository
epinvest516-web…w-skillsFirst Seen
13 days ago
Security Audits
Installed on
amp1
cline1
openclaw1
trae-cn1
opencode1
cursor1