Phụ lục — Prompt, xử lí lỗi và rubric dự án

Google Antigravity · NIE · cập nhật 02/10/2026

1. Lý thuyết và mục tiêu

Prompt hiệu quả mô tả bối cảnh, mục tiêu, giới hạn, dữ liệu và tiêu chí; ngắn rõ hơn một danh sách mệnh lệnh mâu thuẫn. Khi lỗi, thu bước tái hiện, thông báo, phiên bản và thay đổi gần nhất rồi chọn phép kiểm tra để phân biệt nguyên nhân. Không lặp prompt “hãy cố hơn” mà bỏ dữ kiện. Rubric đánh giá chức năng, kiểm tra, chất lượng mã, quản lí dữ liệu/quyền và bàn giao; đây là thang học tập, không tự ghi điểm vào Moodle.

  • Mẫu prompt: hiện tại, mong muốn, phạm vi, tiêu chí, bằng chứng.
  • Lỗi cần bước tái hiện và giả thuyết có thể phân biệt.
  • Rubric tham khảo: chức năng 40, kiểm tra 25, mã 15, dữ liệu/quyền 10, bàn giao 10.

2. Quy trình thực hành

  1. Viết prompt từ một lỗi thật trong dự án mẫu.
  2. Yêu cầu kiểm tra có thể bác bỏ giả thuyết, tránh sửa ngẫu nhiên.
  3. Đánh giá bằng rubric và bằng chứng, ghi phần chưa đạt.

3. Ví dụ và cách giải quyết

Tình huống: Dự án được 32/40 chức năng, 20/25 kiểm tra, 12/15 mã, 8/10 dữ liệu/quyền, 8/10 bàn giao. Tổng điểm?

  1. Cộng 32+20+12+8+8=80.
  2. Đây là 80/100 theo rubric học tập đã cho.
  3. Không nói Moodle đã ghi 80 điểm nếu chưa có hoạt động chấm điểm tương ứng và kết quả được lưu.

4. Lỗi thường gặp

Không nhập thông báo điểm giả vào trang lý thuyết hoặc dùng rubric thay bằng chứng đánh giá.

5. Tự kiểm tra

Đây là câu hỏi tự học có đáp án, không tự cộng điểm LMS.

Tổng trọng số rubric là bao nhiêu?

Xem đáp án

100.

Mở đáp án trên trang có tự cộng điểm Moodle không?

Xem đáp án

Không.

Mã mẫu: test_examples.py

Sao chép đúng tên file và thử trong thư mục thực hành. Mã HTML mở bằng trình duyệt; Python chạy bằng Python 3. SDK cần cài google-antigravity và xác thực theo tài liệu Google; ví dụ SDK chỉ được kiểm tra cú pháp, chưa chạy API thực.

import tempfile
import unittest
from pathlib import Path
from file_organizer import plan
from dashboard_data import normalize

class LessonExamples(unittest.TestCase):
    def test_plan_does_not_move_or_create(self):
        with tempfile.TemporaryDirectory() as folder:
            root=Path(folder);source=root/'bài.PDF';source.write_bytes(b'example')
            result=plan(root)
            self.assertEqual(result[0]['status'],'planned')
            self.assertEqual(Path(result[0]['destination']),root/'pdf'/'bài.PDF')
            self.assertEqual(source.read_bytes(),b'example');self.assertFalse((root/'pdf').exists())
    def test_conflict_preserves_both_files(self):
        with tempfile.TemporaryDirectory() as folder:
            root=Path(folder);(root/'pdf').mkdir();a=root/'a.pdf';b=root/'pdf'/'a.pdf'
            a.write_text('first');b.write_text('second');self.assertEqual(plan(root)[0]['status'],'conflict')
            self.assertEqual(a.read_text(),'first');self.assertEqual(b.read_text(),'second')
    def test_extensionless_file_and_hidden_file(self):
        with tempfile.TemporaryDirectory() as folder:
            root=Path(folder);(root/'README').write_text('demo');(root/'.env').write_text('not a real secret')
            result=plan(root);self.assertEqual(len(result),1)
            self.assertEqual(Path(result[0]['destination']).parent.name,'no-extension')
    def test_fixture_keeps_timestamp_and_negative_temperature(self):
        data={'city':' Mẫu ','temperature_c':-2,'source':'fixture','observed_at':'2026-10-02T09:00:00+07:00'}
        out=normalize(data);self.assertEqual(out['temperature_c'],-2);self.assertTrue(out['is_fixture'])
        self.assertTrue(out['observed_at'].endswith('+07:00'))
    def test_missing_invalid_temperature_rejected(self):
        for value in [None,'28',True,float('nan'),float('inf')]:
            with self.subTest(value=value),self.assertRaises(ValueError):
                normalize({'city':'Mẫu','temperature_c':value,'source':'fixture','observed_at':'2026-10-02T09:00:00+07:00'})
    def test_timezone_and_news_validation(self):
        base={'city':'Mẫu','temperature_c':28,'source':'fixture','observed_at':'2026-10-02T09:00:00'}
        with self.assertRaises(ValueError):normalize(base)
        base['observed_at']='2026-10-02T09:00:00+07:00';base['news']=['']
        with self.assertRaises(ValueError):normalize(base)
if __name__=='__main__':unittest.main()

Đặt test_examples.py cùng file_organizer.py và dashboard_data.py; chạy python -m unittest discover -p test_examples.py -v. Có 6 ca kiểm tra dữ liệu và tính không làm thay đổi file.

6. Tài liệu đối chiếu

Tài liệu Google Antigravity chính thức — getting-started. Đối chiếu ngày 02/10/2026. Quy trình thực hành và bài tập do NIE biên soạn; các khả năng phụ thuộc giao diện, phiên bản và tài khoản.

Mục lục khóa học · Về khóa học