claude-code-best-practice-zh: Instructions file for Claude Code

CLAUDE.md

claude-code-best-practice-zh CLAUDE.md is an instructions file for Claude Code from BuaaJoseph/claude-code-best-practice-zh. It costs 1,827 tokens per session, scanned B, original, MIT.

A Chinese-language guide to configuring Claude Code in a repository, with examples of commands, helper agents, skills, and a weather workflow.

In plain words
What is it for?
Use it as a reference when creating or reviewing Claude Code commands, agents, skills, hooks, and their configuration files.
Why use it?
It gives contributors a shared explanation of how the repository is organised and how its Claude Code parts work together.

Instructions file for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

This is BuaaJoseph/claude-code-best-practice-zh's own configuration. It tells Claude Code how to work on claude-code-best-practice-zh itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-code-best-practice-zh configures →

Reuse

Borrowing it

Nothing to install: this file belongs to BuaaJoseph/claude-code-best-practice-zh. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/BuaaJoseph/claude-code-best-practice-zh/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/BuaaJoseph/claude-code-best-practice-zh

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for claude-code-best-practice-zh CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/buaajoseph/claude-code-best-practice-zh/claude-md.svg)](https://agentmods.dev/instructions/buaajoseph/claude-code-best-practice-zh/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/buaajoseph/claude-code-best-practice-zh/claude-md"><img src="https://agentmods.dev/badge/instructions/buaajoseph/claude-code-best-practice-zh/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,827 This file is loaded in full into every session.
When invoked 1,827 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01827 $0.01827
Opus 5 $0.00914 $0.00914
Sonnet 5 $0.00365 $0.00365
Haiku 4.5 $0.00183 $0.00183

Measured 7d ago against content hash a6fa39f46153, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade B, and why

claude-code-best-practice-zh CLAUDE.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

5. `~/.claude/settings.json`:全局个人默认
CLAUDE.md · 114 lines

How it starts

The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

此文件在为代码仓库中的代码工作时为 Claude Code(claude.ai/code)提供指导。

仓库概述

这是 Claude Code 配置的最佳实践仓库,展示技能、子代理、钩子和命令的模式。它作为参考实现,而不是应用程序代码库。

关键组件

天气系统(示例工作流)

通过 命令 → 代理 → 技能 架构展示两种不同技能模式的演示:

  • /weather-orchestrator 命令(.claude/commands/weather-orchestrator.md):入口点 — 询问用户 C/F,调用代理,然后调用 SVG 技能
  • weather-agent 代理(.claude/agents/weather-agent.md):使用其预加载的 weather-fetcher 技能获取温度(代理技能模式)
  • weather-fetcher 技能(.claude/skills/weather-fetcher/SKILL.md):预加载到代理中 — 从 Open-Meteo 获取温度的说明
  • weather-svg-creator 技能(.claude/skills/weather-svg-creator/SKILL.md):技能 — 创建 SVG 天气卡片,写入 orchestration-workflow/weather.svgorchestration-workflow/output.md

两种技能模式:通过 skills: 字段预加载的代理技能 vs 通过 Skill 工具调用的技能。参见 orchestration-workflow/orchestration-workflow.md 获取完整流程图。

技能定义结构

.claude/skills/<name>/SKILL.md 中的技能使用 YAML frontmatter:

  • name:显示名称和 /斜杠命令(默认为目录名)
  • description:何时调用(推荐用于自动发现)
  • argument-hint:自动补全提示(如 [issue-number]
  • disable-model-invocation:设为 true 防止自动调用
  • user-invocable:设为 false/ 菜单中隐藏(仅后台知识)
  • allowed-tools:技能活跃时无需权限提示即可使用的工具
  • model:技能活跃时使用的模型
  • context:设为 fork 在独立的子代理上下文中运行
  • agentcontext: fork 的子代理类型(默认:general-purpose
  • hooks:作用域限于此技能的生命周期钩子

演示系统

参见 .claude/rules/presentation.md — 所有演示工作都委托给 presentation-curator 代理。

钩子系统

.claude/hooks/ 中的跨平台声音通知系统:

  • scripts/hooks.py:Claude Code 钩子事件的主要处理器
  • config/hooks-config.json:团队共享配置
  • config/hooks-config.local.json:个人覆盖(git 忽略)
  • sounds/:按钩子事件组织的音频文件(通过 ElevenLabs TTS 生成)

.claude/settings.json 中配置的钩子事件:PreToolUse、PostToolUse、UserPromptSubmit、Notification、Stop、SubagentStart、SubagentStop、PreCompact、SessionStart、SessionEnd、Setup、PermissionRequest、TeammateIdle、TaskCompleted、ConfigChange。

特殊处理:git 提交触发 pretooluse-git-committing 声音。

关键模式

子代理编排

子代理 无法 通过 bash 命令调用其他子代理。使用 Agent 工具(在 v2.1.63 中从 Task 重命名;Task(...) 仍然作为别名工作):

Agent(subagent_type="agent-name", description="...", prompt="...", model="haiku")

在子代理定义中明确工具使用。避免使用可能被误解为 bash 命令的模糊术语如"launch"。

Read the full file on GitHub · 114 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 114 lines · 1,827 tokens per session scan B a6fa39f46153

Subscribe to this mod's changes

claude-code-best-practice-zh CLAUDE.md is an instructions file published in the GitHub repository BuaaJoseph/claude-code-best-practice-zh (2 stars, last pushed 4mo ago), licensed MIT. It adds 1,827 tokens to every session, about $0.0091 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens