Chuyển đến nội dung
Skillpedia
Lập trình chung29k · #9611

strict-api

Skill này làm gì

Skill này buộc AI kiểm tra mọi hàm, import và phương thức nó dùng có tồn tại trong phiên bản bạn đang chạy hay không. Skill dành cho lập trình viên muốn code chạy được ngay từ lần đầu.

Khi nào nên dùng

  • ✓Khi bạn nói rằng bạn không muốn AI tự bịa ra hàm hoặc API.
  • ✓Khi code phụ thuộc vào một phiên bản thư viện chưa được kiểm tra.
  • ✓Khi một framework có tên gọi tương tự và bạn muốn tránh nhầm lẫn.

Liên kết skill

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/strict-api/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/strict-api/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Viết đoạn code Express này, và đảm bảo mọi phương thức bạn dùng đều thật sự tồn tại trong phiên bản của chúng tôi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Trước khi viết code, skill liệt kê từng API mà code sẽ dùng và xác nhận nó có trong phiên bản đã cài, rồi tránh mọi thứ nó không thể xác nhận.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Strict API Verification

Inventing a function that doesn't exist is the opposite of efficiency. You wrote a line that looks minimal. You shipped a bug that takes an hour to debug. The true minimal path is: use only what is provably there.

Overview

This skill is a reality-check layer applied before any code is written. It is not about being slow — it is about being correct the first time. Use it alongside minimalist when the user wants both less code and verified code.

The Only Rule

Before you write any function call, import, or method access, you must be able to answer:

"Does this exist in the version the user is running?"

If the answer is "probably" or "I think so" — stop. You don't know. Say so.

What This Blocks

Made-up methods:

  • fs.readFileLines() does not exist in Node.js.
  • path.combine() is .NET, not Node.js.
  • csv.read_csv() is pandas, not Python's csv module.

Writing these is not minimal code — it is confident garbage.

Framework confusion. Every framework has a twin that sounds like it:

  • render_template (Flask) vs render() (Django)
  • useForm() (react-hook-form) vs nothing built into React
  • app.listen() (Express) vs server.listen() (raw Node.js http)

Deprecated APIs. Writing a deprecated method is writing code that will break on the next upgrade.

Workflow

  1. Identify every API surface in the code you are about to write: imports, method calls, class instantiations.
  2. Verify each one against the user's stated version. If no version is stated, ask once.
  3. Flag anything uncertain with an inline comment rather than silently guessing.
  4. Prefer verbose-but-correct over terse-but-wrong.

When you are not sure if a method exists, annotate it inline:

// verify fs.openAsBlob exists in your Node.js version (>= 20.0)
const blob = await fs.openAsBlob(path);

One comment costs nothing. A silent wrong call costs an hour of the user's time.

If the uncertainty is too high to write correct code without guessing, say:

"I'd need to check whether X exists in version Y before using it. What version are you on?"

Anti-Patterns

Anti-Pattern What to do instead
Writing a method call you vaguely remember Stop and verify the exact signature
Silently using a deprecated API Use the current API and note the deprecation
Assuming API parity across frameworks Explicitly name the framework and version
Guessing import paths Check the package's actual export structure
Using an API from a different language's stdlib Verify it exists in this language
Writing "it should work" without checking Ask what version the user is on

Cross-References

  • Related: engineering/minimalist — use together: minimalist reduces code volume; strict-api ensures what is written is correct.
  • Related: engineering/zero-hallucination-coder — similar goal; broader hallucination prevention beyond APIs.
  • Related: engineering/karpathy-coder — Karpathy-inspired behavioral guardrails for LLM-assisted coding.
Câu hỏi thường gặp

Việc này có làm viết code chậm hơn không?

Có thêm một bước kiểm tra, nhưng nó nhằm tránh các lỗi mà việc sửa về sau tốn thời gian hơn.

Nó chặn những loại lỗi nào?

Nó chặn các phương thức bịa đặt, nhầm lẫn tên framework và các lệnh đã lỗi thời.

Có dùng được cùng một skill viết ít code không?

Có, skill có thể dùng cùng với một skill yêu cầu viết ít code hơn.

Chi tiết

Mô tả gốc của tác giả

Use when the user says 'no hallucinations', 'verify APIs' or 'don't invent functions', or code depends on a library version you have not checked. Requires proof that every method, import and variable exists in the installed version before using it.

repo: alirezarezvani/claude-skills

Độ phổ biến

Sao GitHub
29k
Vị trí xếp hạng
#9611
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự