xiaozhi-client: Instructions file for GitHub Copilot

.github/copilot-instructions.md

xiaozhi-client copilot-instructions.md is an instructions file for GitHub Copilot from shenjingnan/xiaozhi-client. It costs 1,632 tokens per session, scanned A, original, MIT.

A set of Chinese-language rules for reviewing code with GitHub Copilot, an AI coding assistant. It defines which security, performance, logic, architecture, typing, API, error-handling, and testing problems deserve comments.

In plain words
What is it for?
Use it to review TypeScript projects, MCP implementations, modular code, asynchronous code, integration tests, and end-to-end tests, with review comments written in Chinese.
Why use it?
It gives code reviews a consistent focus and avoids spending review time on formatting or personal style preferences. Comments should explain the problem, suggest a fix, and describe its impact.

Instructions file for GitHub Copilot

Written for GitHub Copilot: a Copilot instructions file.

This is shenjingnan/xiaozhi-client's own configuration. It tells GitHub Copilot how to work on xiaozhi-client 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 xiaozhi-client configures →

Reuse

Borrowing it

Nothing to install: this file belongs to shenjingnan/xiaozhi-client. 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/shenjingnan/xiaozhi-client/main/.github/copilot-instructions.md
Clone the repo
git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client

Made for: GitHub Copilot.

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 xiaozhi-client copilot-instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/shenjingnan/xiaozhi-client/copilot-instructions/github.svg)](https://agentmods.dev/instructions/shenjingnan/xiaozhi-client/copilot-instructions)
Your own site
<a href="https://agentmods.dev/instructions/shenjingnan/xiaozhi-client/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/shenjingnan/xiaozhi-client/copilot-instructions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for xiaozhi-client copilot-instructions.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/shenjingnan/xiaozhi-client/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/shenjingnan/xiaozhi-client/copilot-instructions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,632 This file is loaded in full into every session.
When invoked 1,632 The same file — it is already loaded in full.
Security scan A 0 findings. 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.01632 $0.01632
Opus 5 $0.00816 $0.00816
Sonnet 5 $0.00326 $0.00326
Haiku 4.5 $0.00163 $0.00163

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

Security

Grade A, and why

xiaozhi-client copilot-instructions.md scanned grade A with 0 findings 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 9d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/copilot-instructions.md · 194 lines

How it starts

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

GitHub Copilot Code Review 指导

基础规则

  1. Code Review 评论内容请使用中文
  2. 专注于提供有价值、可操作的建议,避免指出显而易见的问题

CR 优先级框架

🔴 高优先级(必须评论)

  • 安全问题:输入验证、SQL 注入、XSS、权限控制等
  • 性能问题:算法复杂度过高、内存泄漏、不必要的循环等
  • 关键逻辑错误:业务逻辑缺陷、边界条件处理不当
  • 架构一致性:违反项目架构模式、模块职责不清
  • TypeScript 类型安全:类型滥用、any 类型的不当使用

🟡 中优先级(建议评论)

  • API 设计:接口一致性、参数设计、返回值结构
  • 错误处理:异常处理不完整、错误信息不清晰
  • 代码可读性:复杂的业务逻辑需要更好的注释或重构
  • 测试质量:测试覆盖率不足、测试用例设计不合理

🟢 低优先级(避免评论)

  • 格式问题:缩进、空格、换行等(应由自动化工具处理)
  • 命名风格:除非严重影响理解
  • 个人编码偏好:不影响功能实现的习惯性写法

项目特定指导

MCP 协议实现

  • 关注 MCP 消息处理的正确性和完整性
  • 检查传输适配器的错误处理和重连机制
  • 验证工具调用和资源管理的生命周期

TypeScript 最佳实践

  • 优先使用具体的类型而非 any
  • 鼓励使用类型推导和泛型
  • 检查接口设计的一致性和向后兼容性

模块化架构

  • 验证模块间的依赖关系是否合理
  • 检查单一职责原则的遵循
  • 确保依赖注入容器的正确使用

测试策略

  • 重点检查集成测试和端到端测试
  • 验证异步代码的正确测试
  • 关注测试的可维护性和可读性

评论质量标准

✅ 好的评论应该

  1. 解释原因:说明为什么需要这个改动
  2. 提供方案:给出具体的修改建议
  3. 考虑影响:说明改动可能对其他部分的影响
  4. 示例代码:在需要时提供代码示例

❌ 避免的评论类型

  1. 仅指出问题:"这里有问题"、"这样不好"
  2. 模糊建议:"建议重构"、"优化一下"
  3. 过度建议:针对边缘案例的过度设计
  4. 风格偏好:个人习惯相关的评论

评审结论指引

✅ 评审通过

如果代码没有明显问题,符合项目要求,在 PR 中显著地用中文评论:

## ✅ 代码评审通过,允许合并

代码改动符合项目要求,可以合并。

评审通过的标准

  • 代码功能正确,无明显 bug
  • 符合项目的代码风格和质量要求
  • 无高优先级或中优先级的安全问题
  • 错误处理完善
  • 测试覆盖合理

技术债务关注点

可维护性

  • 代码重复
  • 过长的函数或类
  • 深层嵌套的复杂逻辑

可扩展性

  • 硬编码的配置和常量
  • 缺乏抽象的重复代码
  • 紧耦合的组件设计

可测试性

  • 难以测试的代码结构
  • 过多的外部依赖
  • 缺乏依赖注入

具体示例

好的评论示例

🔴 **安全问题**:这个函数直接使用用户输入构建 SQL 查询,存在 SQL 注入风险。

建议:使用参数化查询或 ORM 的查询构建器来避免 SQL 注入。

```typescript
// 当前代码(不安全)
const query = `SELECT * FROM users WHERE name = '${userName}'`;

// 建议改为
const query = 'SELECT * FROM users WHERE name = ?';
db.query(query, [userName]);

### 应该避免的评论

❌ "这个函数太长了"(没有具体建议) ❌ "变量名应该用 camelCase"(自动化工具应处理) ❌ "建议用 async/await"(没有说明具体收益)


## 上下文理解

1. **理解改动目的**:在评论前先理解这个 PR 的目标
2. **考虑整体影响**:不要只关注局部代码片段
3. **平衡建议**:在完美主义和实用性之间找到平衡
4. **尊重设计决策**:除非有明确问题,否则尊重现有的架构选择

## CR 范围控制

### 聚焦 PR 本身改动

- **专注于 PR 改动范围**:只分析本次 PR 修改的代码,不要扩大审查范围到未改动的代码
- **只分析改动本身**:评估改动代码本身是否有需要改进的地方
- **关注必要的潜在问题**:识别真正影响功能和安全的问题,避免过度延伸
- **不审查历史代码**:不要借机审查 PR 范围之外的代码,即使发现问题也只提醒不强制要求修复

Read the full file on GitHub · 194 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. 9d ago First seen · 194 lines · 1,632 tokens per session scan A 71803dc8a22e

Subscribe to this mod's changes

xiaozhi-client copilot-instructions.md is an instructions file published in the GitHub repository shenjingnan/xiaozhi-client (337 stars, last pushed 5d ago), licensed MIT. It adds 1,632 tokens to every session, about $0.0082 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

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