improve-claude-md
Skill này làm gì
Skill này dạy agent cách cải thiện file CLAUDE.md, tệp chỉ dẫn cho trợ lý lập trình. Skill gói các hướng dẫn riêng cho từng tác vụ vào khối có điều kiện để trợ lý chú ý đến phần quan trọng với mỗi tác vụ.
Khi nào nên dùng
- ✓Khi người dùng có file CLAUDE.md mà trợ lý dường như bỏ qua.
- ✓Khi file chỉ dẫn của dự án đã dài và trộn lẫn hướng dẫn chung với hướng dẫn riêng cho tác vụ.
- ✓Khi người dùng yêu cầu viết lại chỉ dẫn cho trợ lý để nó được tuân thủ tốt hơn.
Liên kết skill
https://github.com/humanlayer/skills/blob/main/plugins/improve-claude-md/skills/improve-claude-md/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Cải thiện file CLAUDE.md của tôi để Claude tuân theo các quy tắc kiểm thử khi tôi viết test.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent giữ ngữ cảnh cốt lõi của dự án dưới dạng văn bản thuần, và chuyển các hướng dẫn riêng cho tác vụ vào khối được đánh dấu bằng điều kiện. Điều này cho trợ lý tín hiệu rõ ràng về lúc mỗi khối áp dụng.
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.
When the user provides a CLAUDE.md file (or asks you to improve one), rewrite it following the principles and structure below.
Core Problem
Claude Code injects a system reminder with every CLAUDE.md that says:
"this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task."
This means Claude will ignore parts of your CLAUDE.md it deems irrelevant. The more content that isn't applicable to the current task, the more likely Claude is to ignore everything — including the parts that matter.
Solution: <important if="condition"> Blocks
Wrap conditionally-relevant sections of the CLAUDE.md in <important if="condition"> XML tags. This exploits the same XML tag pattern used in Claude Code's own system prompt, giving the model an explicit relevance signal that cuts through the "may or may not be relevant" framing.
Principles
1. Foundational context stays bare, domain guidance gets wrapped
Not everything should be in an <important if> block. Context that is relevant to virtually every task — project identity, project map, tech stack — should be left as plain markdown at the top of the file. This is onboarding context the agent always needs.
Domain-specific guidance that only matters for certain tasks — testing patterns, API conventions, state management, i18n — gets wrapped in <important if> blocks with targeted conditions.
The rule of thumb: if it's relevant to 90%+ of tasks, leave it bare. If it's relevant to a specific kind of work, wrap it.
2. Conditions must be specific and targeted
Bad — overly broad conditions that match everything:
<important if="you are writing or modifying any code">
- Use absolute imports
- Use functional components
- Use camelCase filenames
</important>
Good — each rule has its own narrow trigger:
<important if="you are adding or modifying imports">
- Use `@/` absolute imports (see tsconfig.json for path aliases)
- Avoid default exports except in route files
</important>
<important if="you are creating new components">
- Use functional components with explicit prop interfaces
</important>
<important if="you are creating new files or directories">
- Use camelCase for file and directory names
</important>
3. Keep it short, use progressive disclosure sparingly
Do not shard into separate files that require the agent to make tool calls to discover, unless the extra context is incredibly verbose or complex.
The whole point of <important if> blocks is that everything is inline but conditionally weighted — the agent sees it all but only attends to what matches.
Prefer to keep the file concise.
4. Less is more
- Frontier models can reliably follow a few hundred. Claude Code's system prompt and tools already use ~50 of those. Your CLAUDE.md should be as lean as possible.
- Cut any instruction that a linter, formatter, or pre-commit hook can enforce
- Cut any instruction the agent can discover from existing code patterns. LLMs are in-context learners — if your codebase consistently uses a pattern, the agent will follow it after a few searches.
- Cut code snippets. They go stale and bloat the file. Use file path references instead (e.g., "see
src/utils/example.tsfor the pattern").
5. Keep all commands
Do not drop commands from the original file. The commands table is foundational reference — the agent needs to know what's available even if some commands are used less frequently.
Output Structure
When rewriting a CLAUDE.md, produce this structure:
# CLAUDE.md
[one-line project identity — what it is, what it's built with]
## Project map
[directory listing with brief descriptions]
<important if="you need to run commands to build, test, lint, or generate code">
[commands table — all commands from the original]
</important>
<important if="<specific trigger for rule 1>">
[rule 1]
</important>
<important if="<specific trigger for rule 2>">
[rule 2]
</important>
... more rules, each with their own block ...
<important if="<specific trigger for domain area 1>">
[guidance]
</important>
... more domain sections ...
How to Apply
When given an existing CLAUDE.md to improve:
- Identify the project identity — extract a single sentence describing what this is. Leave it bare at the top.
- Extract the directory map — keep it bare (no
<important if>wrapper). This is foundational context. - Extract the tech stack — if present, k
Câu hỏi thường gặp
Khối important-if là gì?
Đó là thẻ kiểu XML có điều kiện, cho trợ lý biết lúc nào hướng dẫn được áp dụng.
Có nên bọc toàn bộ file không?
Không. Skill nói ngữ cảnh nền, như định danh dự án và ngăn xếp công nghệ, giữ là markdown thuần.
Vì sao file cần điều này?
Skill giải thích rằng trợ lý có thể bỏ qua ngữ cảnh mà nó cho là không liên quan, nên văn bản dài không liên quan có thể che mất điều quan trọng.
Chi tiết
Mô tả gốc của tác giả
improve a CLAUDE.md file using <important if> blocks to improve instruction adherence
repo: humanlayer/skills
Độ phổ biến
- Sao GitHub
- 5.5k
- Vị trí xếp hạng
- #14776
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
build-iterated-agentic-loop
5.5kGiúp agent của bạn biến một tác vụ lập trình lặp lại thành skill của repo cùng workflow GitHub Actions chạy theo lịch, có file bộ nhớ và một PR mở mỗi vòng.
design-control-loop
5.5kGiúp agent của bạn phỏng vấn bạn và thiết kế vòng điều khiển đưa codebase tới mục tiêu qua các thay đổi nhỏ, dễ xem xét, rồi xây dựng nó thành workflow theo lịch.
rpi
5.5kGiúp agent của bạn nghiên cứu một thay đổi, làm việc qua thiết kế và triển khai theo các giai đoạn rõ ràng, với tài liệu cho từng bước để bạn xem xét.
visual-pr
5.5kGiúp agent của bạn viết hoặc cập nhật mô tả pull request, giải thích vì sao có thay đổi và nó được xây dựng thế nào, theo mẫu rõ ràng và một sơ đồ tóm tắt ngắn.
Skill tương tự
writing-skills
311kDạy agent của bạn viết skill mới và kiểm thử từng skill trước, kiểm tra xem skill có thực sự thay đổi cách agent hành xử hay không.
writing-for-agents
310kGiải thích cách viết hướng dẫn rõ ràng cho agent AI, gồm skill, tệp AGENTS.md và CLAUDE.md, để agent cư xử nhất quán.
bengali-nlp
280kGiúp agent của bạn xử lý văn bản tiếng Bengali, hỗ trợ hiểu ngôn ngữ này, chuẩn hóa văn bản và xử lý các đặc điểm riêng của nó.