Get in touch
or send us a question?
CONTACT

Ứng dụng Claude AI cho developer

1. Quy trình Explore – Plan – Code (Khám phá – Lên kế hoạch – Viết mã)

Quy trình này gồm bốn giai đoạn riêng biệt, mỗi giai đoạn có mục tiêu và phương pháp thực hành tốt nhất riêng:

Giai đoạn 1 – Explore (Khám phá):
Hiểu rõ bối cảnh vấn đề và cấu trúc mã hiện có mà không viết bất kỳ dòng code nào.
Mục đích của giai đoạn này là tránh việc triển khai quá sớm và đảm bảo việc phân tích được thực hiện toàn diện.

Giai đoạn 2 – Plan (Lên kế hoạch):
Xây dựng chiến lược giải pháp chi tiết dựa trên những gì đã khám phá ở giai đoạn trước.
Bản kế hoạch cần đủ cụ thể để định hướng việc triển khai, nhưng cũng linh hoạt để có thể điều chỉnh khi phát hiện thêm trong quá trình coding.

Giai đoạn 3 – Code (Viết mã):
Triển khai giải pháp từng bước một, tuân theo kế hoạch đã đề ra nhưng vẫn mở rộng không gian cho việc tinh chỉnh.
Mỗi thay đổi cần nhỏ, có thể kiểm thử, và phù hợp với chiến lược tổng thể.

Giai đoạn 4 – Commit (Hoàn thiện & cam kết):
Hoàn tất việc triển khai bằng cách kiểm thử cẩn thận, cập nhật tài liệuthực hiện các thao tác quản lý phiên bản.
Giai đoạn này đảm bảo sản phẩm đủ sẵn sàng cho môi trường thậtkiến thức được chuyển giao đầy đủ.

2. Demo làm task với bài toán: chia 2 số a và b

Explore:

You are an expert code analyst specializing in Python.

Analyze the following code for refactoring opportunities. DO NOT write any code yet.

CODE:
def divide_simple(a, b):
return a / b

CONTEXT:
– This function will be used in a production API
– It receives input from external users
– It’s part of a calculation pipeline
– Team uses Python 3.10+, pytest for testing, type hints

Analyze this code following the criteria above. Focus on:
1. What errors could occur at runtime?
2. What edge cases are not handled?
3. What would make this production-ready?
4. Prioritize issues by severity.

Plan:

You are a senior software architect creating implementation plans.

Based on the analysis from Phase 1, create a detailed refactoring plan for the divide_simple function.

[Paste the analysis summary from Phase 1 here]

Create a step-by-step plan that:
1. Addresses critical errors first (ZeroDivisionError, TypeError)
2. Adds comprehensive error handling
3. Includes proper documentation and type hints
4. Defines complete testing strategy
5. Makes the function production-ready

Team standards: Python 3.10+, type hints required, pytest for testing, Google-style docstrings

Code:

You are an expert Python developer implementing planned changes.

Implement the refactoring plan incrementally, one step at a time.

[Paste the complete plan from Phase 2 here]

Instructions:
1. Start with Phase 1, Step 1: Add Zero Division Check
2. Show the complete updated code
3. Explain the changes
4. Provide a commit message
5. Wait for my confirmation before continuing

Coding standards: Python 3.10+, type hints, Google-style docstrings, clear variable names