Claude Code Spec Workflow: Hướng Dẫn Thực Hành Spec-Driven Development

Claude Code Spec Workflow: Hướng Dẫn Thực Hành Spec-Driven Development

Giới Thiệu

Trong thế giới phát triển phần mềm hiện đại, việc kết hợp AI vào quy trình coding đang trở thành xu hướng không thể tránh khỏi. Tuy nhiên, phương pháp “vibe coding” – viết code dựa trên cảm hứng và prompt ngẫu nhiên – thường dẫn đến kết quả không nhất quán và thiếu cấu trúc. Claude Code Spec Workflow ra đời như một giải pháp để biến việc phát triển phần mềm với AI trở nên có hệ thống và chuyên nghiệp hơn.

1. Spec-Driven Development Là Gì?

Định Nghĩa

Spec-Driven Development (SDD) là một phương pháp phát triển phần mềm mà trong đó specification (đặc tả) trở thành trung tâm của toàn bộ quy trình engineering – từ planning và design đến implementation, testing và documentation. SDD nhấn mạnh việc viết specifications rõ ràng và có cấu trúc trước khi bắt đầu implementation.

Nguyên Lý Cốt Lõi

Thay vì “vibe coding” – phương pháp mô tả mục tiêu và nhận về một khối code có vẻ đúng nhưng thường không hoạt động chính xác, SDD đối xử với coding agents như những pair programmers nghiêm túc. Chúng xuất sắc trong pattern recognition nhưng vẫn cần hướng dẫn rõ ràng và không mơ hồ.

Quy Trình 4 Giai Đoạn

SDD hoạt động qua 4 giai đoạn với các checkpoint rõ ràng:

1. Specify (Đặc Tả): Tạo ra contract về cách code nên hoạt động, trở thành source of truth cho tools và AI agents.

2. Plan (Lập Kế Hoạch): AI agent phân tích spec và tạo ra kế hoạch chi tiết về architecture, constraints và cách tiếp cận.

3. Tasks (Nhiệm Vụ): Chia nhỏ spec và plan thành các công việc cụ thể, có thể review được, mỗi task giải quyết một phần cụ thể của puzzle.

4. Implement (Triển Khai): AI agent thực hiện từng task một cách có hệ thống, với developer review những thay đổi tập trung thay vì những code dump hàng nghìn dòng.

Ưu Điểm Của SDD

  • Giảm đoán mò: Spec rõ ràng giúp giảm thiểu sự bất ngờ và đảm bảo chất lượng code
  • Dễ thay đổi hướng: Chỉ cần update spec, regenerate plan và để AI agent xử lý phần còn lại
  • Phù hợp với dự án phức tạp: Đặc biệt hữu ích cho greenfield projects và feature work trong hệ thống hiện có

2. Claude Code Spec Workflow – Tổng Quan

Giới Thiệu Tool

Claude Code Spec Workflow là một toolkit tự động hóa được phát triển bởi Pimzino, cung cấp quy trình spec-driven development có cấu trúc cho Claude Code. Tool này transform các ý tưởng feature thành implementation hoàn chỉnh thông qua quy trình: Requirements → Design → Tasks → Implementation.

Các Tính Năng Chính

🎯 Quy Trình Phát Triển Có Cấu Trúc

  • Requirements Generation: Tạo user stories và acceptance criteria sử dụng định dạng EARS (WHEN/IF/THEN statements)
  • Design Creation: Tạo technical architecture và design với Mermaid diagrams để visualization
  • Task Breakdown: Chia design thành các atomic coding tasks tập trung vào test-driven development
  • Systematic Implementation: Thực hiện tasks một cách có hệ thống với validation dựa trên requirements

🛠 7 Slash Commands Chính

  • /spec-create <name> <description> – Tạo specification mới cho feature
  • /spec-requirements – Generate requirements document
  • /spec-design – Tạo design document
  • /spec-tasks – Generate implementation tasks
  • /spec-execute <task-number> – Execute specific tasks
  • /spec-status – Check status của specification hiện tại
  • /spec-list – List tất cả specifications

🏗 Cấu Trúc Project Tự Động

Sau khi setup, tool tự động tạo:

  • 📁 .claude/ directory: Chứa commands, templates, specs, và config files
  • 📝 7 slash commands: Để thực hiện complete workflow
  • 📋 Document templates: Đảm bảo formatting nhất quán
  • ⚙️ Configuration files: Cho workflow automation
  • 📖 CLAUDE.md: Với comprehensive workflow instructions

✨ Tính Năng Nâng Cao

  • Triple optimization commands: get-steering-context, get-spec-context, và get-template-context
  • Smart document handling: Bug documents sử dụng direct reading, templates sử dụng bulk loading
  • Session-based caching: Intelligent file change detection và cache invalidation
  • Real-time web dashboard: Monitor specs, tasks, và progress với live updates
  • Bug workflow system: Complete bug reporting và resolution tracking

3. Hướng Dẫn Cài Đặt và Sử Dụng

Yêu Cầu Hệ Thống

  • Node.js: 16.0.0 hoặc cao hơn
  • Claude Code: Đã cài đặt và configure
  • Bất kỳ project directory nào

Cài Đặt Claude Code (Prerequisite)

bash
# Install Claude Code
npm install -g @anthropic-ai/claude-code

# Verify installation
claude doctor

# Navigate to your project
cd your-awesome-project

# Start Claude Code (first time login required)
claude

Cài Đặt Claude Code Spec Workflow

Phương Pháp 1: Cài Đặt Nhanh (Khuyến Nghị)

bash
# Cài đặt trong current directory
npx @pimzino/claude-code-spec-workflow

# Cài đặt trong directory cụ thể  
npx @pimzino/claude-code-spec-workflow --project /path/to/project

# Force overwrite existing files
npx @pimzino/claude-code-spec-workflow --force

# Skip confirmation prompts
npx @pimzino/claude-code-spec-workflow --yes

# Test setup
npx @pimzino/claude-code-spec-workflow test

Phương Pháp 2: Global Installation

bash
# Install globally
npm install -g @pimzino/claude-code-spec-workflow

# Use anywhere
claude-spec-setup

Phương Pháp 3: Development Dependency

bash
# Install as dev dependency
npm install --save-dev @pimzino/claude-code-spec-workflow

# Run via package.json script
npx claude-spec-setup

Cấu Trúc Được Tạo Ra

your-project/
├── .claude/
│   ├── commands/
│   │   ├── spec-create.md
│   │   ├── spec-requirements.md  
│   │   ├── spec-design.md
│   │   ├── spec-tasks.md
│   │   ├── spec-execute.md
│   │   ├── spec-status.md
│   │   └── spec-list.md
│   ├── templates/
│   │   ├── requirements-template.md
│   │   ├── design-template.md
│   │   └── tasks-template.md
│   ├── specs/
│   │   └── (your specs will be created here)
│   └── spec-config.json
└── CLAUDE.md (created/updated)

4. Hướng Dẫn Sử Dụng Chi Tiết

Workflow Cơ Bản

Bước 1: Khởi Tạo Claude Code

bash
cd my-awesome-project
claude

Bước 2: Tạo Specification Mới

bash
# Trong Claude Code terminal
/spec-create user-dashboard "User profile management system"

Bước 3: Generate Requirements

bash
/spec-requirements

Output: User stories với EARS format (WHEN/IF/THEN statements) đảm bảo comprehensive requirement coverage.

Bước 4: Tạo Design Document

bash
/spec-design

Output: Technical architecture với Mermaid diagrams, plans components, interfaces, và data models.

Bước 5: Generate Implementation Tasks

bash
/spec-tasks

Output: Atomic coding tasks với focus vào test-driven development, references specific requirements.

Bước 6: Execute Tasks

bash
/spec-execute 1

Executes tasks systematically với validation against requirements, ensures quality và consistency.

Bước 7: Monitor Progress

bash
# Check current status
/spec-status

# List all specifications  
/spec-list

Web Dashboard (Tính Năng Nâng Cao)

bash
# Basic dashboard
npx -p @pimzino/claude-code-spec-workflow claude-spec-dashboard

# Dashboard with tunnel (share externally) 
npx -p @pimzino/claude-code-spec-workflow claude-spec-dashboard --tunnel

# Full tunnel configuration
npx -p @pimzino/claude-code-spec-workflow claude-spec-dashboard \
  --tunnel \
  --tunnel-password mySecret123 \
  --tunnel-provider cloudflare \
  --port 3000 \
  --open

5. Ví Dụ Thực Hành: Phát Triển Game Asteroids

Mô Tả Dự Án

Một developer đã sử dụng claude-code-spec-workflow để tạo một game 2D đơn giản where player controls spaceship để tránh falling asteroids. Score được tính dựa trên survival time.

Quy Trình Thực Hiện

bash
# 1. Tạo specification
/spec-create asteroids-game "A simple 2D action game where the player controls a spaceship to avoid falling asteroids. The score is based on survival time."

# 2. Generate 3 types of specs
- Requirements document (요구사항 정의서)
- Design document (설계서)  
- Task list (타스크 리스트)

# 3. Implementation using SDD methodology

Kết Quả

Developer đã thành công tạo ra một asteroids avoidance game hoàn chỉnh sử dụng:

  • LLM: Claude Sonnet 4
  • Frontend: HTML, CSS, JavaScript
  • Development Tools: Claude Code, claude-code-spec-workflow

Kỹ Thuật Sử Dụng

Trong video demonstration, developer đã sử dụng:

  • /spec-status để check workflow status
  • /spec-list để view tất cả specifications
  • /spec-create để tạo các specs với detailed content
  • Cuối cùng là gameplay video của completed game

6. Troubleshooting và Best Practices

Common Issues

❓ Command Not Found After NPX

bash
# Make sure you're using correct package name
npx @pimzino/claude-code-spec-workflow

❓ Setup Fails với Permission Errors

bash
# Try with different directory permissions
npx @pimzino/claude-code-spec-workflow --project ~/my-project

❓ Claude Code Not Detected

bash
# Install Claude Code first
npm install -g @anthropic-ai/claude-code

# Show verbose output
DEBUG=* npx @pimzino/claude-code-spec-workflow

# Check package version
npx @pimzino/claude-code-spec-workflow --version

Best Practices

1. Project Setup

bash
# Setup multiple projects efficiently
for dir in project1 project2 project3; do
  npx @pimzino/claude-code-spec-workflow --project $dir --yes
done

2. Testing Setup

bash
# Test setup trong temporary directory
npx @pimzino/claude-code-spec-workflow test

3. Workflow Efficiency

  • Auto-detects project type: Node.js, Python, Java, etc.
  • Beautiful CLI: Với progress indicators
  • Validation: Claude Code installation check
  • Safety: Preserves existing CLAUDE.md content

7. So Sánh Với Các Công Cụ Khác

Claude Code Spec Workflow vs GitHub Spec-Kit

  • GitHub Spec-Kit: Toolkit chính thức từ GitHub cho SDD với support cho multiple AI agents (GitHub Copilot, Claude Code, Gemini CLI)
  • Claude Code Spec Workflow: Chuyên biệt cho Claude Code với workflow tự động hóa và dashboard

Ưu Điểm Của Claude Code Spec Workflow

  • Dễ cài đặt: One-command setup
  • Tự động hóa cao: 7 slash commands có sẵn
  • Dashboard tích hợp: Real-time monitoring
  • TypeScript implementation: Comprehensive error handling

8. Tương Lai và Phát Triển

Xu Hướng SDD

Spec-driven development đang trở thành popular trong developer community như một cách để build software với structure hơn và ít “vibes” hơn. Nó đặc biệt phù hợp với greenfield projects và mid-to-large-sized features.

Limitations

  • UI-heavy work: Non-visual spec không hữu ích cho UI work
  • Small features: Tạo full-blown spec có thể overkill cho small features hoặc bug fixes
  • Overengineering risk: Có thể dẫn đến solutions phức tạp hơn cần thiết

Future of SDD

“Specs are the new code” – Sean Grove từ OpenAI team cho rằng 80-90% công việc của programmers là structured communication, và specs là cách tốt nhất để communicate về software functionality.

9. Kết Luận

Claude Code Spec Workflow đại diện cho bước tiến quan trọng trong việc kết hợp AI vào quy trình phát triển phần mềm một cách có hệ thống. Tool này không chỉ đơn thuần là automation mà còn là methodology giúp developers:

Lợi Ích Chính

  1. Cấu trúc hóa quy trình: Từ vibe coding thành systematic development
  2. Tăng chất lượng code: Thông qua spec-driven approach
  3. Cải thiện collaboration: Giữa developers và AI agents
  4. Giảm rủi ro dự án: Với clear specifications và validation

Khi Nào Nên Sử Dụng

  • Greenfield projects: Starting từ zero với clear vision
  • Feature development: Trong existing complex systems
  • Team collaboration: Cần consistent development approach
  • Quality-focused projects: Khi code quality là priority

Khuyến Nghị

Claude Code Spec Workflow là tool xuất sắc cho developers muốn áp dụng SDD methodology với Claude Code. Tuy nhiên, hãy nhớ rằng tool chỉ là means, methodology và mindset mới là điều quan trọng nhất.

Hãy bắt đầu với những dự án nhỏ, làm quen với workflow, và dần mở rộng sang những dự án phức tạp hơn. Spec-driven development không phải là silver bullet, nhưng chắc chắn là một powerful approach trong arsenal của modern developers.


Demo:

Sử dụng claude cli + claude-code-spec-workflow test tạo workflow cho chức năng  user-authentication

Kết quả :
Tạo ra code và spec cho chức năng  user-authentication

————————————————————————————————————————————————————————————————————————————–

Sử dụng claude cli + claude-code-spec-workflow test 1 game đơn giản bằng html

Kết quả :

 

Claude Code và Tương Lai Lập Trình Với AI Agent

Trong vòng một năm trở lại đây, cách chúng ta viết code đã thay đổi nhanh đến mức chóng mặt. Nếu như trước kia AI chỉ dừng ở mức autocomplete vài dòng trong IDE, thì nay các công cụ như Claude Code đã tiến hóa thành những “người đồng hành” thực sự: có thể đọc hiểu toàn bộ project, viết, sửa, refactor, và thậm chí xây dựng ứng dụng từ đầu đến cuối.

Bài viết này tổng hợp những ý chính từ buổi trò chuyện giữa Alex và Boris (Anthropic) về Claude Code, đồng thời chia sẻ thêm vài góc nhìn cá nhân.

Link video: https://www.youtube.com/watch?v=iF9iV4xponk

Claude Code là gì?

Để hiểu Claude Code, hãy bắt đầu từ Claude. Đây là mô hình ngôn ngữ (LLM) do Anthropic phát triển, nổi tiếng nhờ khả năng suy luận tốt, trả lời an toàn và viết code khá mạnh. Tuy nhiên, nếu chỉ có một mô hình ngôn ngữ thì vẫn còn thiếu nhiều thứ để làm việc trong môi trường lập trình thực tế.

Ví dụ: nếu bạn thả Claude “chay” vào một dự án, nó có thể viết code hoặc trả lời câu hỏi, nhưng sẽ gặp khó khăn khi:

  • Không biết trạng thái repo hiện tại.

  • Không có quyền chỉnh sửa file.

  • Không thể chạy test hoặc commit.

  • Không tích hợp được vào workflow của team.

Đây chính là khoảng trống mà Claude Code ra đời để lấp đầy.

Claude Code = “Agentic IDE”

Anthropic gọi Claude Code là agentic IDE (một môi trường phát triển dựa trên agent). Nó giống một IDE thông minh, nhưng có khả năng tự hành động chứ không chỉ gợi ý.

Cấu trúc Claude Code gồm nhiều thành phần:

  1. Harness – Lớp điều phối giữa mô hình, ngữ cảnh project, và người dùng.

    • Harness giống như “bộ não phụ” để nối Claude với codebase.

    • Nó đảm bảo Claude có cái nhìn đầy đủ về repo, không chỉ một file rời rạc.

  2. Tools & Permissions – Cơ chế kiểm soát.

    • AI có thể thực hiện hành động thực sự: chỉnh sửa file, chạy script, cài dependency, commit.

    • Nhưng mọi hành động đều trong phạm vi cho phép, tránh “AI phá repo”.

  3. MCP Servers (Model Context Protocol) – Hệ thống plugin/API.

    • Cho phép mở rộng Claude Code ra ngoài: kết nối tới database, API, CI/CD, issue tracker (GitHub, Jira…).

    • Đây là điểm giúp Claude Code không chỉ làm code “trên máy”, mà còn tham gia vào toàn bộ pipeline.

  4. Settings, Hooks & Slash Commands – Tùy biến workflow.

    • Dev có thể định nghĩa shortcut (ví dụ: /fix-tests, /deploy) hoặc viết hook để AI làm việc theo cách riêng.

    • Tính năng này khiến Claude Code hackable, khác biệt so với nhiều công cụ AI coding “đóng hộp”.

  5. CLAUDE.md – Tài liệu hướng dẫn dành riêng cho AI.

    • Bạn có thể tạo file này trong repo để mô tả project, convention, style guide.

    • Claude sẽ đọc và hiểu ngữ cảnh như một dev mới join team.


Điểm khác biệt với AI coding khác

So với GitHub Copilot hay Cursor, Claude Code không chỉ dừng ở gợi ý code trong editor, mà là:

  • Có trí nhớ dài: hiểu và thao tác trên codebase lớn.

  • Có quyền hành động: sửa file, chạy lệnh.

  • Có khả năng mở rộng: thông qua MCP và plugins.

  • Có thể hack/tùy biến: lập trình viên điều chỉnh workflow theo ý mình.

Sự tiến hóa: từ autocomplete đến agent

Trong vòng một năm qua, AI coding đã thay đổi nhanh đến mức khó tin. Điểm đáng chú ý là sự tiến hóa không chỉ đến từ bản thân mô hình (model), mà chủ yếu nằm ở cách chúng ta đóng gói và sử dụng nó trong workflow thực tế.

  • Trước đây – thời kỳ autocomplete
    AI chỉ đóng vai trò như một “bộ gợi ý thông minh” trong IDE. GitHub Copilot (ra mắt 2021) là ví dụ điển hình: nó dự đoán vài dòng code tiếp theo, giống như autocomplete trong Gmail, nhưng dành cho lập trình viên. Rất tiện, nhưng vẫn giới hạn trong phạm vi vài dòng code.

  • Hiện tại – AI như đồng nghiệp
    Với các công cụ mới như Claude Code hay Cursor, AI không chỉ gợi ý từng dòng, mà có thể:

    • Đọc và phân tích toàn bộ repo.

    • Sửa lỗi và refactor hàng loạt file.

    • Review Pull Request (PR) và đưa ra nhận xét.

    • Hiểu ngữ cảnh project (nhờ cơ chế long context window như Claude 3.5 Sonnet với 200k tokens).

    Điều này biến AI từ một “công cụ hỗ trợ viết code” thành một trợ lý phát triển phần mềm thực thụ.

  • Tương lai gần – AI hiểu ý định (intent)
    Anthropic mô tả tầm nhìn tiếp theo: AI sẽ không chỉ viết code theo prompt, mà còn quản lý mục tiêu của lập trình viên.
    Ví dụ: bạn nói “Xây API thanh toán với Stripe”, Claude Code sẽ:

    1. Thiết kế cấu trúc.

    2. Tạo endpoint.

    3. Viết test.

    4. Deploy và thông báo kết quả.

    Ở giai đoạn này, AI giống một “agent” thực sự – tự động hóa toàn bộ chu trình dựa trên ý định của con người, thay vì chỉ thao tác cục bộ trên từng file.


Điều gì thúc đẩy sự tiến hóa này?

Theo chia sẻ từ Boris Cherny (Anthropic), chính feedback thực chiến từ dev nội bộ đã dẫn dắt sản phẩm. Anthropic không xây Claude Code trong phòng lab, mà cho chính nhân viên sử dụng hàng ngày để làm việc thật. Model và công cụ đồng tiến hóa:

  • Dev phản hồi về điểm yếu (ví dụ AI refactor chưa sạch → cải tiến).

  • Model mạnh hơn lại mở ra use case mới (ví dụ context dài → đọc cả repo).

Đây là lý do tại sao Claude Code không chỉ “mạnh về lý thuyết”, mà còn thực sự hữu dụng trong quy trình phát triển phần mềm.


Hackability là gì và vì sao quan trọng?

Một trong những điểm khác biệt khiến Claude Code nổi bật so với nhiều công cụ AI coding khác chính là tính hackability – tức khả năng tùy biến, mở rộng, và “bẻ cong” công cụ theo cách mà lập trình viên mong muốn.

Vì sao hackability quan trọng?

Trong thế giới phần mềm, mỗi đội và mỗi dự án có workflow riêng:

  • Có team ưu tiên CI/CD tự động, để code merge là deploy ngay.

  • Có team lại yêu cầu review thủ công và check kỹ lưỡng.

  • Một số lập trình viên thích command-line tool, số khác muốn UI trực quan.

Nếu một công cụ AI bị “đóng khung” theo một quy trình cứng nhắc, nó sẽ không thể đáp ứng được sự đa dạng này. Do đó, tính hackable là yếu tố then chốt giúp AI coding trở thành công cụ thực sự linh hoạt, thay vì chỉ là demo đẹp.

Hackability trong Claude Code

Claude Code được thiết kế để cực kỳ hackable với nhiều cơ chế:

  • CLAUDE.md: file cấu hình cho phép mô tả project, hướng dẫn AI hiểu ngữ cảnh (giống như README nhưng dành riêng cho AI).

  • Configurable workflows: bạn có thể cấu hình lại workflow qua settings, hooks hoặc script tùy chỉnh.

  • MCP servers (Model Context Protocol): cơ chế mở rộng theo kiểu “plugin/API”, cho phép AI tương tác với tool, service hoặc dữ liệu riêng của bạn.

  • Slash commands & sub-agents: tạo lệnh chuyên biệt (ví dụ: /generate-tests, /lint*) hoặc định nghĩa agent con để xử lý tác vụ hẹp.

Ví dụ thực tế

  • Một công ty fintech có thể viết MCP server riêng để Claude trực tiếp đọc dữ liệu từ hệ thống nội bộ, thay vì copy-paste code.

  • Một startup game có thể tạo slash command /render để AI gọi engine dựng hình trong quá trình phát triển.

  • Team backend có thể thêm CLAUDE.md để AI luôn tuân thủ chuẩn code style và kiến trúc microservices của họ.

👉 Chính vì vậy, hackability quan trọng ở chỗ: nó giúp AI không chỉ phù hợp với lập trình nói chung, mà còn thích nghi với phong cách làm việc riêng của từng lập trình viên và từng đội ngũ.


Tương lai của lập trình với AI agent

Bức tranh được Alex và Boris vẽ ra khá rõ:

  • Ngắn hạn: dev vẫn viết code thủ công, nhưng AI sẽ gánh phần “text manipulation” (refactor, đổi tên biến, viết test, v.v.).

  • Trung hạn: AI sẽ review code, đề xuất thay đổi, và có thể merge PR.

  • Dài hạn: dev chỉ cần nói “Xây API thanh toán với Stripe”, AI sẽ tự thiết kế, viết, test, deploy. Lập trình viên sẽ dần trở thành người định hướng, review và tư duy giải pháp thay vì “người gõ từng dòng code”.


Suy nghĩ cá nhân

Thật sự thì khi nhìn vào những gì Claude Code (và các agent AI khác) đang làm được, mình có cảm giác việc viết code không còn khô khan và đã trở nên dễ dàng hơn rất nhiều. Trước đây, để tạo ra một ứng dụng, chúng ta phải bỏ ra hàng tuần hay thậm chí hàng tháng để gõ từng dòng code, fix bug, rồi refactor. Nhưng giờ, AI có thể giúp sinh ra hàng nghìn dòng code chỉ trong vài phút.

Điều đó có nghĩa là: giá trị thật sự không còn nằm ở việc bạn viết được bao nhiêu dòng code, mà nằm ở việc bạn muốn xây dựng cái gì, thiết kế ra sao, và giải quyết vấn đề gì cho người dùng.

Điều này cũng kéo theo sự thay đổi lớn trong kỹ năng mà một developer cần. Thay vì chỉ tập trung vào “gõ code”, lập trình viên trong tương lai sẽ phải biết cách:

  • Đặt câu hỏi và mô tả yêu cầu rõ ràng cho AI. Đây giống như việc ra đề thi: đề càng rõ, đáp án càng đúng.

  • Hiểu và review code mà AI tạo ra, vì cuối cùng trách nhiệm với sản phẩm vẫn là của con người.

  • Kết hợp nhiều công cụ và agent để đạt được mục tiêu nhanh và hiệu quả hơn.

  • Có thể sẽ hình thành 2 nhóm nghề: người phát triển sản phẩm (product developer) và người lập trình ở mức thấp hơn (low-level developer) để xây dựng module cốt lõi.

Nếu nghĩ kỹ thì kỹ năng này khá giống với vai trò của một technical architect hơn là một coder thuần túy: định hình giải pháp, kết nối các mảnh ghép, và đảm bảo hệ thống hoạt động ổn định.

Về cơ hội và thách thức thì mình thấy rõ ràng:

  • Cơ hội: thời gian từ ý tưởng → sản phẩm rút ngắn cực kỳ nhiều. Một cá nhân giờ đây có thể làm được những thứ mà trước kia phải cần cả một team. Điều này mở ra rất nhiều cơ hội cho sáng tạo và khởi nghiệp.

  • Thách thức: nếu chỉ dừng lại ở việc “biết code”, bạn sẽ nhanh chóng bị thay thế. AI có thể viết, sửa, refactor code rất nhanh, nhưng AI chưa thể giao tiếp và thấu hiểu con người. Những kỹ năng như trao đổi với khách hàng, lắng nghe nhu cầu, đàm phán, thuyết phục, hay đơn giản là xây dựng niềm tin vẫn là phần không thể thiếu – và chỉ con người mới làm được.

Exploring Claude Code Subagents: A Demo Setup for a RAG-Based Website Project

1. Introduction

Recently, Anthropic released an incredible new feature for its product Claude: subagents — secondary agents with specific tasks for different purposes within a user’s project.

2. Main Content

a. How to Set It Up:
First, install Claude using the following command in your Terminal window:

npm i @anthropic-ai/claude-code

If Claude is already installed but it’s an older version, it won’t have the subagent feature.

to update claude, command : claude update

Launch Claude Code in your working directory, then run the command:
/agents

Press Enter, and a management screen for agents will appear, allowing you to start creating agents with specific purposes for your project.

Here, I will set it up following Claude’s recommendation.

After the setup, I have the following subagents:

I will ask Claude to help me build a website using RAG with the following prompt:

The first subagents have started working.

The setup of the RAG project has been completed.

However, I noticed that the subagent ‘production-code-reviewer (Review RAG system code)’ didn’t function after the coding was completed. It might be an issue with my prompt, so I will ask Claude to review the code for me

After the whole working process, Claude Code will deliver an excellent final product.
Link: https://github.com/mhieupham1/claudecode-subagent

3. Conclusion

Through the entire setup process and practical use in a project, it’s clear how powerful and beneficial the Sub-agents feature introduced by Anthropic for Claude Code is. It enables us to have AI “teammates” with specialized skills and roles that operate independently without interfering with each other — allowing projects to be organized, easy to understand, and efficient.

Intelligent Automation with Claude Code Hooks: A New Leap in Software Development

Claude Code has been revolutionizing how we interact with source code, but what if we could make it even smarter and more autonomous? The answer lies in Claude Code Hooks – a powerful feature that allows you to customize and extend Claude Code’s behavior by executing shell commands at specific points in its lifecycle.

In this blog post, we’ll explore Claude Code Hooks, understand how they work, and provide some practical ideas to make the most of this feature.


1. What are Claude Code Hooks and What Can We Do With Them?

Claude Code Hooks are essentially user-defined shell commands that automatically execute at various “trigger points” (hook events) during Claude Code’s operation. This provides deterministic control over Claude Code’s behavior, ensuring that certain actions are always performed without relying on the choices of the large language model (LLM).

You can configure hooks in Claude Code’s settings files (~/.claude/settings.json, .claude/settings.json, or .claude/settings.local.json).

The main types of hook events include:

  • UserPromptSubmit: Triggers immediately when a user submits a prompt (before Claude processes it). This is excellent for prompt validation, adding context, or security filtering.
  • PreToolUse: Runs before any tool is used (e.g., Edit, Bash, Git). This is a critical control point to block dangerous commands, enforce formatting rules, or check permissions.
  • PostToolUse: Activates after a tool successfully completes its operation. Useful for analyzing results, logging commands, automating code formatting, or running tests.
  • Notification: Runs when Claude Code sends a notification (e.g., when waiting for input or requesting permission). Can be used to create custom notifications (Slack, sound).
  • Stop: Triggers when Claude Code finishes its response. Used for performing final checks or generating reports.
  • SubagentStop: Triggers when a sub-agent’s task completes.

2. Experimenting and Understanding How Claude Code Hooks Work

To better understand, let’s consider a simple example: automatically formatting code after each time Claude edits a file.

Step 1: Open the Hooks Configuration In Claude Code, type /hooks to open the configuration interface.

claude code hooks

Step 2: Select the PostToolUse Hook Event We want the hook to run after Claude edits afile, so select PostToolUse.

claude code hooks

Step 3: Add a Matcher Select + Add new matcher… and enter Edit|MultiEdit|Write. This will ensure the hook only runs when Claude uses editing or file-writing tools.

claude code hooks

Step 4: Add a Hook Command Select + Add new hook and enter the following command (example for a TypeScript file):

Bash

jq -r '.tool_input.file_path' | { read file_path; if echo \"$file_path\" | grep -q '\\.ts$'; then npx prettier --write \"$file_path\"; fi; }

This command will extract the edited file path, check if it’s a .ts file, and then run npx prettier --write to format it.

Step 5: Save the Configuration Select Project settings to apply this hook your projects.
claude code hooks

Step 6: Test the Hook Ask Claude to edit a TypeScript file, and you’ll see Prettier automatically format the code once the edit is complete. If the hooks are not triggering as expected, try restarting Claude. Restarting usually helps the system recognize and apply the new configuration settings.Below is a demo video showing how it works:

3. Practical Ideas for Claude Code Hooks

 

The possibilities with Claude Code Hooks are endless. Here are some practical ideas to integrate this feature into your workflow:

 

  • Code Quality Enforcement:

    • Automated Linting and Formatting: As in the example above, run Prettier, ESLint, Black, Ruff, gofmt, etc., after every file edit. This ensures code consistency throughout the project.
    • Type Checking: Automatically run TypeScript, MyPy, or other type-checking tools after file edits to catch errors early.
    • Custom Coding Rules: Enforce team- or project-specific coding rules by running custom scripts to check structure, naming conventions, or design patterns.
  • Automated Testing:

    • Run Unit Tests: Automatically run unit tests (e.g., pytest, jest) after Claude edits files in src/ or tests/ directories.
    • Lightweight Integration/E2E Tests: For minor changes, a subset of integration tests can be triggered to ensure no regressions.
  • Optimization and Security:

    • Prevent Dangerous Commands: Use a PreToolUse hook to block dangerous shell commands like rm -rf or access to sensitive files (.env).
    • Pre-commit Checks: Similar to Git hooks, run quality checks (e.g., searching for API keys, security checks) before Claude is allowed to execute git_commit.
    • Code Optimization: Run static analysis tools to suggest or enforce performance optimizations.
  • Notifications and Logging:

    • Custom Notifications: Send notifications to Slack, Discord, or use desktop notification tools (e.g., ntfy) when Claude needs your attention, completes a long task, or encounters an error.
    • Command Logging: Log all commands Claude executes for tracking, debugging, or auditing purposes.
    • Progress Tracking: Update progress status to a file or database to monitor long-running tasks.
  • Workflow Management:

    • Automated Report Generation: After a major task is completed, automatically generate a report summarizing changes or outcomes.
    • Documentation Updates: If Claude edits specific parts of the code, a hook can trigger automatic updates of related documentation sections.
    • Flow Control: UserPromptSubmit and PreToolUse hooks can block actions if conditions are not met, forcing Claude to rethink or ask you for more information.

4. Conclusion

 

Claude Code Hooks transform Claude Code from a powerful coding assistant into a comprehensive and deterministic development partner. By defining simple yet powerful rules, you can automate mundane but crucial parts of your work, freeing up time and energy to focus on the more creative and complex aspects of software engineering.

Start experimenting with Claude Code Hooks today and discover how they can revolutionize your development process, leading to greater efficiency and better code quality!

Gemini CLI vs. Claude Code CLI: A Comprehensive Comparison for Developers

1. Introduction to the Launch of Gemini CLI

Recently, Google launched Gemini CLI – an open-source AI agent that can be directly integrated into the terminal for work. In previous articles about Claude Code CLI, we already saw its powerful features. Now, with the interesting arrival of Gemini CLI, users have even more options when choosing which agent to use. In this article, we’ll explore and compare the different criteria between Claude Code CLI and Gemini CLI to see which agent might best suit your needs.

2. Comparison Criteria Between the Two CLI Agents

a. Platform Support

  • Claude Code CLI: This tool has certain limitations when it comes to operating system support. It works well on MacOS and Ubuntu, but for Windows users, it requires extra steps such as installing an Ubuntu WSL virtual machine. Even then, there are still some restrictions and a less-than-ideal user experience.

  • Gemini CLI: Google’s new tool supports all operating systems, allowing users on any platform to set up and use it quickly and easily.

b. Open Source

  • Claude Code CLI: This is a closed-source tool, so its development is entirely controlled by Anthropic.

  • Gemini CLI: Google’s tool is open source, licensed under Apache 2.0, which enables the user community to access and collaborate on making the tool more robust and faster.

c. AI Model

  • Claude Code CLI: Utilizes powerful Anthropic models such as Claude Opus 4 and Claude Sonnet 3.7, both highly effective for coding tasks.

  • Gemini CLI: Gives access to Gemini 2.5 Pro and Gemini 2.5 Flash, each useful for different needs.

d. Context Limitations

  • Claude Code CLI: This is a paid tool. Users can access it through their Claude account with various tiers, each offering different token limits (from 250K to 1M tokens per model). Users can also use Claude’s API key to pay based on token usage.

  • Gemini CLI: Google’s tool provides a free version, which allows access to Gemini 2.5 Pro, but can quickly hit the limit and drop down to Gemini 2.5 Flash.

e. Community and Extensibility

  • Claude Code CLI: As a closed-source tool, only the developer (Anthropic) can improve and maintain it.

  • Gemini CLI: Being open source, it has a large and vibrant community contributing to its rapid improvement and greater capabilities.

3. Gemini CLI

  • Link: https://github.com/mhieupham1/Flashcard_GeminiCLI

  • Prompt Example:

    • Please make for me a website about using flashcard for learning English with HTML, CSS, Javascript, do the best for UI/UX

    • A flashcard set can archive many words, user can add more word to a new set or existed set

    • Function for folder that can add existed flashcard sets or remove it

    • Function for flashcard set that can edit transfer user to a web to practice in this flashcard set

    • Dashboard need to have more eye-catching, good layout

    • And many prompts to ask Gemini CLI to fix their own bugs

    • Make the web has layout, functions like an official website with better CSS, JS, HTML

  • Strengths:

    • Can handle large token requests and good at reading context

    • Cost: Free version can access Gemini 2.5 Pro, but may quickly hit limits and fall back to Gemini 2.5 Flash. Sometimes, after logging out and back in, it works normally again with Gemini 2.5 Flash. A pro account offers a one-month free trial, after which users can cancel or continue with the stated price.

  • Weaknesses:

    • Requires a very large number of tokens (1M tokens for pro, 11M for flash) to build the website (even when incomplete)

    • Prone to repeated error loops, wasting tokens

    • Codebase is still weak and doesn’t always fully understand user intentions or basic web concepts, so prompts need to be very detailed

4. Claude Code CLI

  • Link: https://github.com/mhieupham1/Flashcard_ClaudeCodeCLI

  • Prompt Example:

    • Please make for me a website about using flashcard for learning English with HTML, CSS, Javascript, do the best for UI/UX

    • A flashcard set can archive many words, user can add more word to a new set or existed set

    • Function for folder that can add existed flashcard sets or remove it

    • Function for flashcard set that can edit transfer user to a web to practice in this flashcard set

    • Dashboard need to have more eye-catching, good layout

  • Strengths:

    • Understands user ideas very well, outputs high-quality, efficient, and minimal code without missing features

    • Only required 30K tokens for the flashcard web demo

    • Good, user-friendly UI/UX

    • Produced the demo with a single request (using only a pro account, not the max tier)

  • Weaknesses:

    • Requires a paid account or API key (tokens = dollars), but the code quality is worth the price

5. Conclusion

With the comparison above, it’s clear that Gemini CLI is currently much stronger than Claude Code CLI. However, a deeper dive into their practical efficiency and benefits for different use cases is still needed.

a. Gemini CLI

  • Strengths:

    • Free to use with high token limits, suitable for large projects needing a large context window

    • Highly compatible across platforms and easy to set up

    • Open source, ensuring rapid improvement through community contributions

    • Fast code reading and generation

  • Weaknesses:

    • Can randomly hit usage limits, dropping from Gemini Pro 2.5 to Gemini Flash 2.5, reducing effectiveness

    • Prone to repeated errors/loops, which can be difficult to escape’

    • Codebase may not be as efficient, often needing very detailed prompts

b. Claude Code CLI:

  • Strengths:

    • High-quality, thoughtful, and efficient codebase generation

    • Highly suitable for commercial projects thanks to token optimization

  • Weaknesses:

    • Requires a paid account, with different tiers for different performance levels; top tier is expensive

    • Limited cross-platform compatibility, making it less accessible or offering a poorer experience for some users

6. Which Should You Use? Summary of Best Use Cases

When is Claude Code CLI most convenient?
Claude Code CLI is the better choice if you prioritize high-quality, efficient, and minimal code output, especially for commercial projects that require clean UI/UX and robust functionality. It is also ideal when you want to achieve your result in a single, well-phrased prompt. However, you need to be willing to pay for a subscription or API access, and set up the tool on a supported platform.

When is Gemini CLI more convenient?
Gemini CLI is perfect if you need a free, open-source tool that works across all major operating systems and is easy to install. It’s best for large projects that require handling a lot of data or context, and for those who want to benefit from fast community-driven improvements. Gemini CLI is especially suitable for personal, experimental, or learning projects, or when you need flexibility and cross-platform compatibility—even though it might sometimes require more detailed prompts or troubleshooting.

Best practice of Claude Code

In the ever-evolving landscape of software development, AI-powered tools are no longer a novelty but a necessity for staying competitive and productive. Among these, Anthropic’s Claude Code has emerged as a transformative force, empowering both seasoned developers and non-technical professionals to build, debug, and innovate faster than ever before.

This guide goes beyond the surface-level tips and delves deep into the best practices that Anthropic’s own teams have honed through their daily use of Claude Code. Whether you’re a data engineer wrestling with complex pipelines, a product designer bridging the gap between vision and reality, or a marketer looking to automate your workflows, these insights will help you unlock the full potential of this powerful AI assistant.

claude code

 

The Foundation of Success: Universal Best Practices

 

Before we explore the team-specific strategies, it’s crucial to understand the fundamental principles that underpin successful collaboration with Claude Code:

  • The Art of the Prompt: The quality of your output is directly proportional to the quality of your input. Be clear, specific, and provide as much context as possible. Think of yourself as a project manager delegating a task to a talented but literal-minded assistant.
  • Iterative Collaboration: Don’t expect a perfect solution on the first try. Treat Claude Code as an iterative partner. Start with a simple prompt, review the output, and then refine your request with additional instructions. This back-and-forth process is where the magic happens.
  • Embrace Autonomous Workflows: For many tasks, you can set Claude Code to work autonomously and check in periodically. This is especially effective for prototyping, writing tests, and other non-critical path activities. You’ll be amazed at what it can accomplish while you focus on other priorities.

 

Team-Specific Strategies for Maximum Impact

 

Data Infrastructure: Automating and Securing Your Data Pipelines

 

The Data Infrastructure team at Anthropic relies on Claude Code to manage the massive datasets that fuel their research and development. Their best practices are a masterclass in efficiency and security:

  • The Power of Claude.md: Create a comprehensive Claude.md file in your project directory. This file should act as a “user manual” for Claude, outlining your team’s specific workflows, preferred tools, and coding conventions. A well-crafted Claude.md can transform Claude from a general-purpose assistant into a specialized team member.
  • Security First: When dealing with sensitive data, always prioritize security. The Data Infrastructure team recommends using MCP servers instead of the BigQuery CLI to ensure that you have granular control over data access and permissions.
  • Knowledge Sharing is Key: Regularly hold team sessions to share and demonstrate new Claude Code workflows. This not only helps to disseminate best practices but also sparks new ideas for how to leverage the tool in innovative ways.

 

Product Development: Building a Self-Sufficient Development Loop

 

The Claude Code team is at the forefront of using their own product to build, test, and deploy new features. Their best practices are a testament to the power of “dogfooding”:

  • The “Test-First” Approach: One of the most effective ways to ensure code quality is to have Claude generate tests before it writes the actual code. This forces a clear definition of the desired functionality and makes it easier to verify the final output.
  • Task Triage: Sync vs. Async: Develop an intuition for which tasks are best suited for asynchronous work and which require your direct supervision. Prototyping a new feature? Let Claude run wild. Fixing a critical bug in your core business logic? Keep a close eye on its work.
  • Clarity is King: When working in a complex codebase with multiple components that have similar names, be extra specific in your prompts. The more context you provide, the less likely Claude is to get confused and the more you can trust it to work independently.

 

Security Engineering: Hardening Your Defenses with AI

 

The Security Engineering team at Anthropic uses Claude Code to proactively identify and mitigate security vulnerabilities. Their strategies are a blueprint for building a more secure software development lifecycle:

  • Custom Slash Commands for the Win: Don’t be afraid to create your own custom slash commands to automate repetitive security tasks. The Security Engineering team has created over 50 custom commands to streamline everything from dependency scanning to vulnerability patching.
  • Let Claude Take the Wheel: For complex security investigations, resist the urge to micromanage. Instead, provide Claude with a high-level goal and let it work autonomously. You might be surprised by the creative and effective solutions it comes up with.
  • Documentation on Autopilot: Claude Code is a powerful tool for generating and synthesizing documentation. Provide it with a few writing samples and your preferred formatting, and it can create high-quality documentation that you can use in your wikis, READMEs, and other internal resources.

 

Data Science and ML Engineering: From Raw Data to Production-Ready Dashboards

 

The Data Science and ML Engineering teams use Claude Code to bridge the gap between research and production. Their best practices are a guide for anyone looking to turn data into actionable insights:

  • The “Slot Machine” Strategy: For complex refactoring tasks, don’t be afraid to take a chance. Save your current state, let Claude work its magic, and if the result isn’t what you’re looking for, simply roll back and try again. Sometimes a fresh start is the fastest path to a solution.
  • The Power of “Simpler”: If Claude provides a solution that is overly complex or difficult to understand, don’t hesitate to ask for a simpler approach. The model is often capable of generating more elegant and efficient solutions when prompted to do so.

 

API Knowledge: Navigating the Unknowns of a Large Codebase

 

The API Knowledge team is responsible for ensuring that Claude has access to the information it needs to answer user queries accurately. Their best practices are a must-read for anyone who works in a large and complex codebase:

  • Embrace the “Beginner’s Mind”: When tackling a bug or investigating an incident in an unfamiliar part of the codebase, let Claude be your guide. It can help you ramp up quickly and make meaningful contributions without a lot of prior knowledge.
  • Start Small, Think Big: Instead of overwhelming Claude with a massive amount of information upfront, start with the bare minimum and let it ask for more context as needed. This more natural, conversational approach can often lead to better results.

 

Growth Marketing: Automating Your Way to Success

 

The Growth Marketing team uses Claude Code to automate repetitive tasks and create sophisticated, multi-step workflows. Their strategies are a goldmine for anyone looking to do more with less:

  • Identify Your Automation Opportunities: Look for tasks that are repetitive, rule-based, and involve tools that have APIs. These are the low-hanging fruit for automation with Claude Code.
  • Divide and Conquer: For complex workflows, break them down into smaller, more manageable sub-tasks and create specialized sub-agents for each one. This makes it easier to debug problems and improves the overall quality of the output.
  • Plan Before You Prompt: Before you write a single line of code, take the time to map out your entire workflow. This will help you to create a more comprehensive and effective prompt for Claude Code.

 

Product Design: From Static Mockups to Functional Prototypes

 

The Product Design team uses Claude Code to bridge the gap between design and engineering, turning static mockups into interactive prototypes with unprecedented speed. Their best practices are a game-changer for any design team:

  • Don’t Go It Alone: The initial setup for Claude Code can be a bit challenging for non-developers. Don’t be afraid to ask for help from your engineering colleagues. A little bit of upfront investment will pay huge dividends down the road.
  • The Power of the Paste: One of the most powerful features of Claude Code is the ability to paste images directly into the prompt. This allows you to turn static mockups into functional code with just a few clicks.
  • Custom Memory for the Win: Create a Claude.md file with specific instructions on how you want Claude to behave. This is especially helpful if you have little to no coding experience, as it can help to guide the model and improve the quality of its responses.

 

RL Engineering: Supercharging Your Reinforcement Learning Workflows

 

The RL Engineering team uses Claude Code for everything from writing small features to debugging complex reinforcement learning algorithms. Their strategies are a must-read for anyone working in this cutting-edge field:

  • The One-Shot Approach: For many tasks, it’s worth giving Claude a quick prompt and letting it attempt the full implementation in one shot. If it works, you’ve saved yourself a ton of time. If not, you can always switch to a more collaborative, back-and-forth approach.
  • Checkpoint Your Work: When you’re experimenting with new ideas, it’s always a good idea to commit your work frequently. This makes it easy to roll back to a known good state if things go wrong.

 

The Future is a Collaboration

 

The best practices outlined in this guide are not just a set of rules to be followed blindly. They are a starting point for your own journey of discovery with Claude Code. As you become more comfortable with the tool, you will undoubtedly develop your own unique workflows and strategies.

The key is to approach Claude Code not as a vending machine for code, but as a true collaborator. By combining your own creativity and expertise with the power of AI, you can unlock new levels of productivity, innovation, and fun in your work. So go ahead, dive in, and start building the future, together.

Combining tmux and Claude to Build an Automated AI Agent System (for Mac & Linux)

1. Introduction

With the rapid growth of AI, multi-agent systems are attracting more attention due to their ability to coordinate, split tasks, and handle complex automation. An “agent” can be an independent AI responsible for a specific role or task.

In this article, I’ll show you how to combine tmux (a powerful terminal multiplexer) with Claude (Anthropic’s AI model) to build a virtual organization. Here, AI agents can communicate, collaborate, and work together automatically via the terminal.

 

2. What is tmux?

tmux lets you split your terminal into multiple windows or sessions, each running its own process independently. Even if you disconnect, these sessions stay alive. This is super useful when you want to run several agents in parallel, each in their own terminal, without interfering with each other.

 

3. What is Claude?

Claude is an advanced language AI model developed by Anthropic. It can understand and respond to text requests, and it’s easy to integrate into automated systems—acting as a “virtual employee” taking on part of your workflow.

 

4. Why combine tmux and Claude?

Parallel & Distributed: Each agent is an independent Claude instance running in its own tmux session.

Workflow Automation: Easily simulate complex workflows between virtual departments or roles.

Easy Debug & Management: You can observe each agent’s logs in separate panes or sessions.

 

5. System Architecture

Let’s imagine a simple company structure:

PRESIDENT: Project Director (sets direction, gives instructions)

boss1: Team Leader (splits up tasks)

worker1, worker2, worker3: Team members (do the work)

Each agent has its own instruction file so it knows its role when starting up.

Agents communicate using a script:

./agent-send.sh [recipient] “[message]”

Workflow:

PRESIDENT → boss1 → workers → boss1 → PRESIDENT

 

6. Installation

Since the code is a bit long, I’ll just share the GitHub link to keep things short.

tmux:
Install guide: tmux Installing Guide

Claude:
Install guide: Claude Setup Guide

Git:
Install guide: Git Download

Clone the project:

bash
git clone https://github.com/mhieupham1/claudecliagent

 

Inside, you’ll find the main folders and files:

CLAUDE.md: Describes the agent architecture, communication, and workflows.

instructions/: Contains guidance for each role.

.claude/: JSON files to manage permissions for bash scripts.

setup.sh: Launches tmux sessions for PRESIDENT, boss1, worker1, worker2, worker3 so agents can talk to each other.

agent-send.sh: Script for sending messages between agents.

 

7. Deployment

Run the setup script:

bash
./setup.sh
This will create tmux sessions for PRESIDENT and the agents (boss1, worker1, worker2, worker3) in the background.

To access the PRESIDENT session:

bash
tmux attach-session -t president


To access the multiagent session:

bash
tmux attach-session -t multiagent


In the PRESIDENT session, run the claude command to set up the Claude CLI.

Do the same for the other agents.

Now, in the PRESIDENT window, try entering a request like:

you are president. create a todo list website now
PRESIDENT will start the to-do list. PRESIDENT will send instructions to boss1, boss1 will assign tasks to worker1, worker2, and worker3.

You can watch boss1 and the workers do their jobs, approve commands to create code files, and wait for them to finish.

Result:

8. Conclusion

Combining tmux and Claude lets you create a multi-agent AI system that simulates a real company: communicating, collaborating, and automating complex workflows. Having each agent in its own session makes it easy to manage, track progress, and debug.

This system is great for AI research, testing, or even real-world workflow automation, virtual team assistants, or teamwork simulations.

If you’re interested in developing multi-agent AI systems, try deploying this model, customize roles and workflows to your needs, and feel free to contribute or suggest improvements to the original repo!

Introducing Claude 4 and Its Capabilities

Claude 4 refers to the latest generation of AI models developed by Anthropic, a company founded by former OpenAI researchers. The most powerful model in this family as of June 2024 is Claude 3.5 Opus, often informally called “Claude 4” due to its leap in performance.

Claude Opus 4 is powerful model yet and the best coding model in the world, leading on SWE-bench (72.5%) and Terminal-bench (43.2%). It delivers sustained performance on long-running tasks that require focused effort and thousands of steps, with the ability to work continuously for several hours—dramatically outperforming all Sonnet models and significantly expanding what AI agents can accomplish.

Claude Opus 4 excels at coding and complex problem-solving, powering frontier agent products. Cursor calls it state-of-the-art for coding and a leap forward in complex codebase understanding. Replit reports improved precision and dramatic advancements for complex changes across multiple files. Block calls it the first model to boost code quality during editing and debugging in its agent, codename goose, while maintaining full performance and reliability. Rakuten validated its capabilities with a demanding open-source refactor running independently for 7 hours with sustained performance. Cognition notes Opus 4 excels at solving complex challenges that other models can’t, successfully handling critical actions that previous models have missed.

Claude Sonnet 4 significantly improves on Sonnet 3.7’s industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations. While not matching Opus 4 in most domains, it delivers an optimal mix of capability and practicality.

GitHub says Claude Sonnet 4 soars in agentic scenarios and will introduce it as the model powering the new coding agent in GitHub Copilot. Manus highlights its improvements in following complex instructions, clear reasoning, and aesthetic outputs. iGent reports Sonnet 4 excels at autonomous multi-feature app development, as well as substantially improved problem-solving and codebase navigation—reducing navigation errors from 20% to near zero. Sourcegraph says the model shows promise as a substantial leap in software development—staying on track longer, understanding problems more deeply, and providing more elegant code quality. Augment Code reports higher success rates, more surgical code edits, and more careful work through complex tasks, making it the top choice for their primary model.

These models advance our customers’ AI strategies across the board: Opus 4 pushes boundaries in coding, research, writing, and scientific discovery, while Sonnet 4 brings frontier performance to everyday use cases as an instant upgrade from Sonnet 3.7.

 

 


Key Strengths of Claude 4

 1. Superior Reasoning and Intelligence

Claude 4 ranks at the top in benchmark evaluations such as:

  • MMLU (Massive Multitask Language Understanding)

  • GSM8k (math problem solving)

  • HumanEval (coding)
    It rivals or exceeds OpenAI’s GPT-4-turbo and Google Gemini 1.5 Pro in complex reasoning, long-context understanding, and task execution.

 2. Massive Context Window (Up to 200K Tokens)

Claude 4 can read and reason over hundreds of pages at once, making it perfect for:

  • Analyzing lengthy legal or scientific documents

  • Comparing large codebases

  • Summarizing long texts or reports

 3. Advanced Coding Support

Claude 4 excels in:

  • Writing and explaining code in multiple languages (Python, JS, Java, etc.)

  • Debugging and understanding large code repositories

  • Pair programming and iterative development tasks

 4. Natural and Helpful Communication

  • Responses are clear, polite, and structured

  • Especially strong in creative writing, professional emails, and educational explanations

  • Can follow complex instructions and maintain context over long conversations


Safe and Aligned by Design

Claude is built with safety and alignment in mind:

  • It avoids generating harmful or unethical content

  • It is more cautious and transparent than most models

 


 How to Access or Use Claude 4

Claude is a cloud-based AI model, so you don’t install it like software — instead, you access it via the web or API.

1. Use Claude via Web App

 Steps:

  1. Go to: https://claude.ai

  2. Sign up or log in (you need a US/UK/Canada/EU phone number).

  3. Choose from free or paid plan (Claude 3.5 Opus is available only in Claude Pro – $20/month).

 Claude Pro Includes:

  • Claude 3.5 Opus (latest, most powerful)

  • Larger context

  • Priority access during high demand

 Currently, Claude is only available in select countries. If you’re outside the US/UK/Canada/EU, you may need to use a VPN and a virtual phone number to sign up (unofficial workaround).


2.  Use Claude via API (For Developers)

 API Access:

  1. Go to: https://console.anthropic.com

  2. Sign up and get an API key

  3. Use the API with tools like Python, cURL, or Postman

 Example (Python):

import anthropic

client = anthropic.Anthropic(api_key="your_api_key")

response = client.messages.create(
model="claude-3.5-opus-20240620",
max_tokens=1024,
messages=[
{"role": "user", "content": "Explain quantum computing in simple terms"}
]
)

print(response.content)


Can I Install Claude Locally?

No. Like ChatGPT or Gemini, Claude is not open-source or downloadable. It’s only available via:

 

Feature Claude 4 (Claude 3.5 Opus)
Developer Anthropic
Model Type Large Language Model (LLM)
Reasoning & Math Top-tier performance
Context Length Up to 200,000 tokens
Code Assistance Strong support for multiple languages
Language Style Human-like, calm, professional
Best Use Cases Analysis, writing, coding, dialogue
Access claude.ai or API

A Step-by-Step Guide to Integrating and Using Claude Code Action on GitHub

Investigate how Claude Code Action is great. Just create an issue and put  a mention to Claude  like @claude, Claude can write the code automatically

Introduction

In the current era of rapidly evolving technology, artificial intelligence (AI) 

stands out as one of the most significant and transformative breakthroughs on a global scale. Among the various AI-driven tools, Claude — particularly the Claude Action Code — represents a powerful integration that can be embedded into user’s GitHub repositories to address raised issues with remarkable accuracy and efficiency. This paper aims to explore the capabilities and applications of Claude Action Code in modern software development workflows.

Body content

Claude Code Action is a extension categorized as a “Action” and made available on the GitHub Marketplace by Anthropic. Users can search for and utilize it by following the provided setup instructions outlined in the README documentation. Below is a summary of the basic setup steps for integrating Claude Code Action into user’s GitHub repository: 

1.Create a workflow folder:

On GitHub: In user’s GitHub repository, click “Add file”:

insert the configuration into the path:“.git/workflows/[file_name].yml”. For instance: 

Next, insert the appropriate workflow configuration for this extension, depending on your intended use:

For example: 

name: Claude PR Assistant

on:

  issue_comment:

    types: [created]

  pull_request_review_comment:

    types: [created]

  issues:

    types: [opened, assigned]

  pull_request_review:

    types: [submitted]

 

jobs:

  claude-code-action:

    if: |

      (github.event_name == ‘issue_comment’ && 

contains(github.event.comment.body, ‘@claude’)) ||

      (github.event_name == ‘pull_request_review_comment’ && contains(github.event.comment.body, ‘@claude’)) ||

      (github.event_name == ‘pull_request_review’ && 

contains(github.event.review.body, ‘@claude’)) ||

      (github.event_name == ‘issues’ && contains(github.event.issue.body, ‘@claude’))

    runs-on: ubuntu-latest

    permissions:

      contents: write

      pull-requests: read

      issues: read

      id-token: write

    steps:

      – name: Checkout repository

        uses: actions/checkout@v4

        with:

          fetch-depth: 1

 

      – name: Run Claude PR Action

        uses: anthropics/claude-code-action@beta

        with:

          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

          timeout_minutes: “60”

Then, click “Commit changes” to successfully add the configuration to your repository.

On the user’s local machine: If a folder in VScode has already  been connected to the GitHub repository, the user can manually create a workflow directory and a .yml file to store the Claude configuration. Then, file can be pushed to the GitHub repository

2.API key:

  • After that, the API key should be added to the repository’s Secrets under the Setting tab, rather than being hard-coded directly into workflow file to prevent unauthorized access

 

Find Action in Secret and variables

Create a new repository secret

Add your API key to Secret’s description

Name secret as key’s name in the workflow file

✅Correct

❌Never do it

3. Using Claude Code Action

User creates a new issue within repository where Claude is intended to be used: 

The user describes the issue to be resolved – such as feature creation, bug fixing, code review, …  – in the issue’s description. You can tag “@claude” directly in the description or in a comment after the issue is created, in order trigger Claude to process the request

Ex: Ask Claude to generate complete login and registration pages based on the initial files in the repo

Claude is invoked via API to address the issue described, with the response time depending on the complexity of the request. It uses the token associated with your API key to read the issue content as well as to create or modify code within the repository

Claude’s response will appear in the comments section of the issue.

Here, Claude generates additional files, for example register.html and dashboard.html, as part of the requested implementation and show what changes are made to each file — including which parts are added, modified, or deleted.

At this point, Claude has created a separate branch in the repository containing the proposed changes. The user can then review and consider merging these updates into the main branch via a pull request.

After successfully merging into the main branch

 

Following a successful merge, the issue may be closed. At this point, Claude has been effectively utilized to generate complete, functional demo pages for user login and registration.

 

4.Result:

Registration page

Login screen

Dashboard screen

In summary, Claude Code Action proves to be a highly effective tool for streamlining development tasks, making it easier for both individuals and teams to enhance productivity.