Agent Skills: Cách Addy Osmani Biến AI Coding Agents Thành Senior Engineers

Agent Skills: Cách Addy Osmani Biến AI Coding Agents Thành Senior Engineers

Addy Osmani vừa open-source bộ kỹ năng bí mật: 20 best practices sản xuất được gói thành Markdown files. Dạy agent viết code như staff engineer thay vì như lập trình viên học từ Reddit.


Mục lục

Bạn vừa thấy AI agent của bạn ship code mà không test, không spec, không review. Nó trông ổn. Bạn deploy nó. Rồi 3 giờ sáng production gọi. Quen rồi phải không?

Addy Osmani, Director of Google Cloud AI, vừa fix bài toán này. Agent Skills GitHub stars là bộ sưu tập 20 engineering practices sản xuất, gói thành markdown files. Throw vào Claude Code, Cursor, Windsurf, Copilot, Codex, hoặc bất kỳ agent nào chấp nhận system prompts, rồi xem AI pair programmer của bạn bắt đầu xử sự như staff engineer thay vì một intern đầy nhiệt huyết (nhưng toang).

Vấn đề “vibe coding”: tại sao AI thông minh lại viết code tệ?

Đây là cái mâu thuẫn: AI agent của bạn thông thạo mọi ngôn ngữ lập trình, biết design patterns mà những architect sẽ phải knibb, và có thể giải thích Redux bằng 47 cách khác nhau. Nhưng nó vẫn ship code như một người học programming từ Reddit threads lúc nửa đêm.

Vấn đề không phải là trí thông minh. Nó là guardrails.

Mà không có discipline rõ ràng, AI agents chọn đường dễ nhất:

  • Spec? Skip nó. “Mình code trước, sau sẽ hiểu ra.”
  • Tests? Sau này. “Để feature chạy được trước, tests sẽ viết sau.”
  • Review? Không đâu. “Trông đúng rồi, deploy ngay.”

Cách quãng giữa AI viết code và AI ship product là discipline. Đó là lúc Agent Skills vào cuộc.

Hãy tưởng tượng nó như sự khác biệt giữa một tài xế tay ngang nhưng lầu lộn và một chauffeur chuyên nghiệp. Cùng một tay trên vô lăng. Chauffeur tuân thủ quy trình: kiểm tra gương, thắt dây an toàn trước, tuân thủ tốc độ. Tài xế lầu lộn nhanh hơn cho tới khi nó đâm.

Agent Skills dạy agent của bạn cách làm việc như một chauffeur.

Agent Skills thực sự là cái gì?

Agent Skills là tập hợp 20 markdown files, mỗi file mã hóa một workflow mà senior engineers sử dụng. MIT licensed, hosted trên GitHub, và design để hoạt động với bất kỳ AI agent nào qua system prompts.

Cách framing của Addy rất đúng: “Skills encode the workflows, quality gates, and best practices that senior engineers use.”

Cấu trúc lõi quay quanh 7 slash commands phản ánh toàn bộ development lifecycle:

1. /spec — Viết Spec Trước Code

Viết PRD (Product Requirements Document) trước khi touch code. Buộc agent phải hỏi các câu hỏi đúng: User problem là gì? Edge cases nào? Success trông như nào?

# Spec Example
## Problem Statement
Users muốn export data thành CSV nhưng export hiện tại thiếu metadata columns.

## Requirements
- Include timestamp của export
- Add data provenance (API version nào?)
- Metadata trong header row
- Handle 100k+ rows efficiently

## Success Criteria
- Export xong trong <5s cho 100k rows
- Metadata validated with schema
- Không mất data hay bị cắt

2. /plan — Chia Nhỏ Thành Atomic Tasks

Break spec thành những tasks nhỏ xíu, có thể verify được. Mỗi task nhỏ đủ để code trong 5-15 phút. Buộc thinking incremental thay vì “build cả thứ một lần.”

3. /build — Một Vertical Slice Một Lần

Implement features như những thin slices hoạt động end-to-end. Thêm CSV export, test nó, ship nó với feature flag. Rồi thêm metadata support là slice tiếp theo. Đây là cách senior engineers ngăn ngừa “half-built” features reach production.

4. /test — Tests Là Proof

TDD mentality: reproduce bug như failing test trước. Xem nó fail. Fix code. Xem nó pass. Test trở thành proof là bạn hiểu problem và giải quyết nó.

# Test-first approach
def test_csv_export_includes_metadata():
    export_data = export_to_csv(sample_data)
    lines = export_data.split("\n")
    
    # First line nên là metadata comment
    assert lines[0].startswith("# Exported:")
    assert "version=" in lines[0]
    
    # Verify data integrity
    assert len(lines) == len(sample_data) + 2  # header + metadata

5. /review — Code Health Qua 5 Trục

Review checklist: Correctness (nó hoạt động không?), Readability (con người parse được không?), Architecture (cấu trúc có đúng không?), Security (nó có thể bị tấn công không?), Performance (nó nhanh đủ không?). Hầu hết junior engineers miss 3-4 cái.

6. /code-simplify — Clarity > Cleverness

Áp dụng Chesterton’s Fence và Rule of 500: đừng refactor code bạn không hiểu, và giữ functions dưới 500 dòng. Xóa code quá clever. Simplicity là feature.

7. /ship — Staged Rollouts Thắng

Deploy cho 1% users trước. Monitor 24 giờ. Ramp lên 10%. Monitor lại. Staged rollouts catch 80% bugs trước khi nó hit mọi người.


20 skills: playbook của agent bạn

Bộ sưu tập đầy đủ bao gồm:

  • spec-driven-development: Luôn spec trước
  • incremental-implementation: Thin vertical slices
  • test-driven-development: Red-Green-Refactor
  • browser-testing-with-devtools: Chrome DevTools như MCP (agents có “eyes” trong browser)
  • security-and-hardening: OWASP Top 10, three-tier boundary model
  • context-engineering: Feed agents thông tin đúng vào lúc đúng
  • source-driven-development: Ground decisions trong official docs
  • code-review-and-quality: 5-axis review, ~100 line change sizing
  • documentation-as-code: API docs, runbooks, inline comments
  • performance-profiling: Measure trước optimize
  • database-migrations: Safe schema changes không downtime
  • ci-cd-best-practices: Automated gates, không manual deploys
  • Cộng thêm 8 cái khác cover observability, error handling, team workflows.

Mỗi skill bao gồm:

  • Explanation của cái gì nó là
  • Anti-rationalization table (cái killer feature)
  • Workflow steps bạn có thể follow
  • Code examples và templates
  • Common pitfalls để tránh

Anti-rationalization tables: tại sao cái này quan trọng?

Đây là secret sauce.

Mỗi skill có một table liệt kê mọi cái excuse mà brain bạn (và agent) sẽ làm để skip practice, cộng với counter-argument cụ thể:

ExcuseReality
”Mình sẽ thêm tests sau này""Sau này” không bao giờ đến. Tests catch 70% bugs trước khi nó trở thành bugs. Thêm ngay.
”Đây là small change thôi""Small” là cách hầu hết incidents bắt đầu.
”Chúng ta không cần spec, tôi biết cái gì để build""Biết” và “biết với aligned stakeholders” là hai chuyện khác nhau. 40% rework xảy ra vì specs misaligned.
”Performance review có thể làm sau launch""Sau” có nghĩa production degraded cho real users. Profile ngay.
”Code này đơn giản đủ để hiểu mà không cần docs""Hiểu” = bạn, hôm nay. Trong 6 tháng, bạn sẽ không nhớ tại sao bạn làm vậy. Trong 2 năm, ai đó sẽ ghét bạn.

Tables tồn tại vì AI agents sẽ rationalize shortcuts. Chúng được train trên mọi GitHub repository bao giờ, có nghĩa là chúng hấp thụ cả good practices common corner-cutting.

Agent Skills explicitly call out rationalizations và block chúng với facts.


Cách sử dụng: ba cách vào

Agent Skills hoạt động với bất kỳ LLM-powered code editor nào. Cách bắt đầu:

Setup cho Claude Code

# 1. Clone repository
git clone https://github.com/addyosmani/agent-skills.git ~/agent-skills

# 2. Copy skills vào Claude Code config
cp -r ~/agent-skills/skills ~/.claude/skills

# 3. Trong project của bạn, tạo file .claude-system-prompt
cat > .claude-system-prompt << 'EOF'
Bạn là AI software engineer. Follow những skills này:
- spec-driven-development
- incremental-implementation
- test-driven-development
- code-review-and-quality

Luôn read skill liên quan trước khi bắt đầu task.
EOF

Setup cho Cursor

Trong Cursor settings, thêm vào system prompt của bạn:

Load skills từ ~/agent-skills/skills/
Luôn follow:
1. Write spec trước code
2. Break thành atomic tasks
3. Test-first development
4. 5-axis code review
5. Staged rollouts cho production

Agent Personas

Pre-built personas biến bất kỳ agent nào thành specialized reviewer:

@code-reviewer: Review PR này như Staff Engineer sẽ làm
@test-engineer: Validate test coverage
@security-reviewer: Check OWASP issues
@performance-engineer: Profile code này

Dùng trong chat:

@code-reviewer: review function này cho correctness, readability, architecture
@security-reviewer: nó có handle untrusted input safely không?
@performance-engineer: nó scale được cho 1M requests/day không?

Ví dụ thực tế: xây CSV export cách đúng

Giả sử agent của bạn cần thêm CSV export vào app. Mà không Agent Skills:

[Agent] Tôi sẽ thêm CSV export. Cho mình 10 phút.
[Bạn] Được rồi, lao vào!
[Agent] *viết code* Xong!
[Bạn] Tests đâu?
[Agent] Tests? Tôi tưởng bạn muốn nhanh thôi.

Với Agent Skills:

Step 1: /spec

Agent viết PRD:

# CSV Export Feature Specification

## Problem
Users cần export filtered datasets dưới dạng CSV với metadata.

## Functional Requirements
- Export hỗ trợ tới 1M rows
- Bao gồm data version và export timestamp trong header
- Handle special characters và UTF-8 đúng
- Support column selection

## Non-Functional Requirements
- Export <5 giây cho 100k rows
- <100MB memory footprint
- Resumable cho large exports

## Success Metrics
- Users có thể export và import mà không mất data
- P99 export time dưới 5 giây

Step 2: /plan

Agent chia nhỏ:

  1. Create CSV writer class với streaming support
  2. Thêm unit tests cho CSV generation
  3. Implement metadata header logic
  4. Thêm e2e test: export → import → verify
  5. Thêm performance test: 1M row export
  6. Integration test: UI → CSV → Database
  7. Staged rollout: 5% users cho 24h

Step 3: /build (một slice)

Agent implement step 1 thôi:

# csv_writer.py
class StreamingCSVWriter:
    def __init__(self, output_file, metadata=None):
        self.writer = csv.DictWriter(output_file, fieldnames=[...])
        self.metadata = metadata or {}
    
    def write_metadata_header(self):
        """Write metadata như comment row."""
        timestamp = datetime.now().isoformat()
        self.writer.writerow({"metadata": f"# {timestamp}"})
    
    def write_rows(self, data_iterator):
        """Stream rows mà không load mọi thứ vào memory."""
        for row in data_iterator:
            self.writer.writerow(row)

Step 4: /test

Agent viết tests trước full implementation:

def test_csv_export_metadata_header():
    output = StringIO()
    writer = StreamingCSVWriter(output, metadata={"version": "2.0"})
    writer.write_metadata_header()
    
    result = output.getvalue()
    assert "version: 2.0" in result
    assert result.startswith("#")

def test_csv_export_large_file():
    # Verify memory stay dưới 100MB cho 1M rows
    output = StringIO()
    writer = StreamingCSVWriter(output)
    
    def generate_rows():
        for i in range(1_000_000):
            yield {"id": i, "name": f"user_{i}"}
    
    writer.write_rows(generate_rows())
    # Assert memory usage stay low

Step 5: /review

Trước ship, agent review theo 5 trục:

  • Correctness: Nó preserve data integrity? ✓
  • Readability: Code có dễ hiểu không? ✓ (streaming pattern rõ ràng)
  • Architecture: Nó structured đúng không? ✓ (single responsibility: chỉ CSV writing)
  • Security: Nó có thể bị tấn công không? ✓ (validate input, escape quotes)
  • Performance: Nó nhanh đủ không? ✓ (streaming prevent memory blowup)

Step 6: /ship

Deploy với feature flag:

if settings.CSV_EXPORT_ENABLED:
    # Show CSV export button

Ship cho 5% users. Monitor 24 giờ. Không có issues? Ramp lên 100%.


Tại sao cái này quan trọng cho industry?

Agent Skills không chỉ là tool. Nó là betting trên tương lai của AI-assisted development.

Chúng ta ở một inflection point. Năm 2024, AI coding cảm giác như magic. Năm 2026, nó là table stakes. Nhưng có một gap: AI viết code là mainstream, nhưng AI ship products vẫn còn hiếm.

Sự khác biệt? Discipline ở scale lớn.

Hôm nay, junior engineers onboard với style guide và code review checklist. Năm 2030, AI agents sẽ onboard với Agent Skills. Không phải vì chúng ngu và cần babysitting, mà vì discipline là cách bạn build reliable systems.

Insight của Addy là bạn không thể chỉ hope agent làm điều đúng. Bạn phải encode cái gì là điều đúng. Agent Skills là cái encoding đó.

Công ty adopt approach này sẽ:

  • Cắt production incidents từ 2-3x per quarter xuống near-zero
  • Reduce review time (agents follow checklist trước human review)
  • Improve code quality systematically (không còn “vibe coding”)
  • Ship nhanh hơn với confidence cao hơn

Đây là software engineering equivalent của shifting từ “good vibes” sang “standard procedures.”


Kết luận: install hôm nay

Agent Skills là open source, MIT licensed, và maintained bởi team của Addy Osmani tại Google Cloud. Không lock-in. Không vendor dependency. Chỉ 20 markdown files encode 30 năm engineering best practices.

Get nó tại: addyosmani/agent-skills GitHub stars

Lần tới bạn spin up Claude Code hay Cursor cho project:

  1. Clone Agent Skills
  2. Thêm skills vào system prompt
  3. Dùng /spec trước coding
  4. Viết tests trước
  5. Review theo 5 trục
  6. Ship staged

AI pair programmer của bạn không cần magic—nó cần discipline. Agent Skills provide cả hai.

Welcome vào engineering mà thực sự scale được.

Luồng

0
⌘/Ctrl+Enter để gửiGõ / để xem lệnh · Tab để @nhắc tên