Loading
Loading
Claude Code is a professional CLI that turns Claude into a real coding assistant that works directly in your terminal and interacts with your actual project files.
The difference between Claude.ai and Claude Code:
| | Claude.ai | Claude Code | |--|-----------|------------| | File access | Manual upload | Read/write directly | | Run commands | No | Runs terminal commands | | Context | Conversation only | Entire project | | Usage | Browser | Terminal | | Best for | General questions | Actual development |
node --version)# Global installation
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
# Or using Bun (faster)
bun install -g @anthropic-ai/claude-code
# Configure API key
claude
# On first run you'll be asked for:
# 1. API key (from console.anthropic.com)
# 2. Default model (Sonnet recommended)
# 3. Theme preference
# Start an interactive session in the current project
claude
# Direct question (without interactive session)
claude "What is the purpose of this function?"
# Run a specific task
claude "Add error handling to all async functions in src/"
# Review a specific file
claude "Review this file and tell me the issues" < src/api/route.ts
CLAUDE.md is a file you place in your project root. Claude Code reads it automatically every session:
# Project Name
## Technologies
- Next.js 15 + TypeScript
- Supabase (auth + database)
- TailwindCSS
## Code Rules
- Use async/await not .then()
- All API routes must verify authentication
- Follow naming: camelCase for variables, PascalCase for components
## Never Do
- Don't delete files without confirmation
- Don't modify .env files
- Don't change database schema without review
| Shortcut | Function |
|---------|---------|
| Ctrl+C | Stop current response |
| Ctrl+L | Clear screen |
| ↑↓ | Navigate previous commands |
| /help | Show all commands |
| /exit | Exit |
#!/bin/bash
# سكريبت إعداد Claude Code لمشروع جديد
# احفظه كـ setup-claude.sh وشغّله مرة واحدة
set -e
echo "🤖 إعداد Claude Code للمشروع..."
# 1. التحقق من التثبيت
if ! command -v claude &> /dev/null; then
echo "📦 تثبيت Claude Code..."
npm install -g @anthropic-ai/claude-code
fi
echo "✅ Claude Code v$(claude --version) مثبّت"
# 2. إنشاء CLAUDE.md
cat > CLAUDE.md << 'EOF'
# مشروع NexaLearn AI Academy
## Stack التقني
- Next.js 15 (App Router) + TypeScript strict
- Supabase (auth + PostgreSQL + Storage)
- TailwindCSS + shadcn/ui
- @react-pdf/renderer للشهادات
## قواعد لا تكسرها
- كل الـ API routes تتحقق من authentication
- استخدم Server Components بالـ default
- error handling في كل fetch/await
- لا تعدّل ملفات .env أبداً
## هيكل المجلدات
src/
├── app/[locale]/ # Pages (bilingual AR/EN)
├── app/api/ # API Routes
├── components/ # Reusable components
├── data/ # Static data files
├── lib/ # Utilities & helpers
└── types/ # TypeScript types
## Style Guide
- PascalCase: Components, Types, Interfaces
- camelCase: variables, functions, hooks
- kebab-case: files, folders, IDs
- SCREAMING_SNAKE: constants
## لغة الكود
- Comments: بالعربية للسياق العام
- Code: بالإنجليزية (variable names, etc.)
- Error messages: بالعربية للمستخدم
EOF
echo "✅ تم إنشاء CLAUDE.md"
# 3. إنشاء .claudeignore (ملفات Claude لا يحتاجها)
cat > .claudeignore << 'EOF'
node_modules/
.next/
.git/
*.log
*.lock
dist/
build/
coverage/
public/automation/workflows-json/
EOF
echo "✅ تم إنشاء .claudeignore"
# 4. إنشاء سكريبت مساعد للمهام الشائعة
cat > scripts/claude-tasks.sh << 'EOF'
#!/bin/bash
# مهام Claude Code المشتركة
case "$1" in
review)
claude "راجع الكود في ${2:-src/} وأخبرني بأي مشاكل أمان أو أداء"
;;
types)
claude "تحقق من TypeScript types وأخبرني بأي أخطاء محتملة في src/"
;;
tests)
claude "اكتب unit tests لـ ${2:-src/lib/} باستخدام Jest"
;;
docs)
claude "أضف JSDoc documentation لجميع functions المُصدَّرة في ${2:-src/lib/}"
;;
*)
echo "الاستخدام: ./claude-tasks.sh [review|types|tests|docs] [مسار اختياري]"
;;
esac
EOF
chmod +x scripts/claude-tasks.sh
echo "✅ تم إنشاء scripts/claude-tasks.sh"
echo ""
echo "🎉 Claude Code جاهز! الأوامر المتاحة:"
echo " claude # جلسة تفاعلية"
echo " ./scripts/claude-tasks.sh review # مراجعة الكود"
echo " ./scripts/claude-tasks.sh types # فحص TypeScript"