audit-context
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseaudit-context
audit-context
Diagnose a nao context. Find gaps, MECE violations, failure root causes, and bloat. Output is a short in-conversation report ending in a prioritized plan. Diagnose only — never fix. Route fixes to / / .
write-context-rulesadd-semantic-layercreate-context-testsRun any time: right after , mid-build, before a release, or when the agent's behavior gets surprising.
setup-context诊断nao context。找出缺口、MECE违规问题、失败根源以及冗余内容。输出为简短的对话式报告,结尾附上优先级计划。仅诊断——绝不修复。修复操作请转至 / / 。
write-context-rulesadd-semantic-layercreate-context-tests可在任意时间运行:完成后、构建过程中、发布前,或当Agent行为出现异常时。
setup-contextSix checks (run in order)
六项检查(按顺序执行)
1. Synced context
1. 已同步上下文
Read . What's wired in (warehouse, repos, Notion, semantic layer, MCPs)? What's missing (dbt repo, ETL configs, BI repo, internal docs)? Has run — are , , , populated?
nao_config.yamlnao syncdatabases/repos/docs/semantics/Scope check: <100 tables is the hard ceiling, ≤20 is the target. Better 12 well-documented tables than 80 half-documented ones. Flag oversized scope explicitly — it's the biggest predictor of reliability failure.
读取。已接入哪些组件(数据仓库、代码库、Notion、语义层、MCPs)?缺少哪些(dbt代码库、ETL配置、BI代码库、内部文档)?是否运行过——、、、目录是否已填充?
nao_config.yamlnao syncdatabases/repos/docs/semantics/范围检查:少于100张表是硬性上限,≤20张是目标。12张文档完善的表比80张半文档化的表更好。需明确标记超出范围的情况——这是可靠性失败的最大预测因素。
2. RULES.md
vs target structure
RULES.md2. RULES.md
与目标结构对比
RULES.mdSix standard sections (from ): Business overview, Data architecture, Core data models (Most Used + Tables detail), Key Metrics Reference, Date filtering, Analysis Process. Per section, mark present / missing / thin. Flag placeholders, markers, and metric entries with no source-of-truth pointer.
write-context-rulesTODO:write-context-rulesTODO:3. Context coverage (per table)
3. 上下文覆盖(按表统计)
For every table in : is it in ? Does it have a block? Is there dbt context ()? Any extra ?
databases/## Most Used Tables## Tables detailrepos/<dbt>/models/**/schema.yml.mdThen per-table gaps: undocumented columns the agent will reference, calculated fields with no explanation, foreign keys with no relation, common WHERE filters not mentioned anywhere. A table with no docs anywhere is a high-priority finding.
针对中的每张表:是否在中?是否有块?是否存在dbt上下文()?是否有额外的文档?
databases/## Most Used Tables## Tables detailrepos/<dbt>/models/**/schema.yml.md然后检查表级缺口:Agent会引用但未文档化的列、无解释的计算字段、无关联说明的外键、未提及的常见WHERE过滤器。完全无文档的表是高优先级发现项。
4. Data model consistency (MECE)
4. 数据模型一致性(MECE原则)
- Mutually exclusive? Two tables computing the same metric differently (worst issue — the agent picks one unpredictably).
- Collectively exhaustive? Asked metrics that no in-scope table can answer.
- Duplicated columns? Same logical field under different names (/
user_id/customer_id).account_id - Ambiguous columns? without unit,
amountwithout enum values.status
- **互斥性?**两张表以不同方式计算同一指标(最严重的问题——Agent会不可预测地选择其中一个)。
- **穷尽性?**存在无法通过范围内表格回答的指标请求。
- **重复列?**同一逻辑字段使用不同名称(/
user_id/customer_id)。account_id - **歧义列?**无单位的、无枚举值的
amount。status
5. Test coverage
5. 测试覆盖
If is empty → recommend . Otherwise read (most recent run) and categorize each failure:
tests/create-context-teststests/outputs/| Category | Looks like | Fix |
|---|---|---|
| Data model | Wrong column / wrong table | Add column descriptions; clarify granularity |
| Date selection | Wrong period / week start | Add DO/DON'T SQL in |
| Test issue | Test SQL itself is wrong | Fix the test, not the context |
| Interpretation | Reasonable but different reading | Add to naming conventions or |
| Metric definition | Wrong formula / source | Tighten |
Propose the smallest rule change per failure. Sort by impact (tests affected).
如果目录为空→建议使用。否则读取(最新运行结果)并对每个失败案例分类:
tests/create-context-teststests/outputs/| 类别 | 表现特征 | 修复方案 |
|---|---|---|
| 数据模型 | 错误列/错误表 | 添加列描述;明确粒度 |
| 日期选择 | 错误周期/错误周起始 | 在 |
| 测试问题 | 测试SQL本身有误 | 修复测试,而非上下文 |
| 解读差异 | 合理但不同的解读 | 添加到命名约定或 |
| 指标定义 | 错误公式/错误来源 | 细化 |
针对每个失败案例提出最小化的规则修改建议。按影响范围(受影响的测试数量)排序。
6. Token optimization
6. Token优化
- Files >40KB (flag).
- blocks exceeding the 10-column cap.
## Tables detail - Duplication between and
RULES.md.databases/<table>.md - In-scope tables with no mention in any test or recent question (trim candidates).
- Raw / staging tables that snuck into scope.
If is bloated, suggest moving per-table detail to and keeping only the one-line pointer in . For multi-domain bloat, propose a per-domain file map referenced from . Show the proposed structure before moving anything.
RULES.mddatabases/<table>.md## Most Used TablesRULES.md- 大于40KB的文件(标记)。
- 块超过10列上限。
## Tables detail - 与
RULES.md之间的重复内容。databases/<table>.md - 范围内但未在任何测试或近期问题中提及的表(可考虑移除)。
- 混入范围的原始/临时表。
如果冗余,建议将表级详情移至,并在中仅保留一行指向链接。对于多领域冗余问题,建议从引用按领域划分的文件映射。在移动任何内容前先展示拟议的结构。
RULES.mddatabases/<table>.md## Most Used TablesRULES.mdOutput (in conversation, not a file)
输出形式(对话中,而非文件)
Lead with a one-paragraph summary: sync state | scope wideness (N tables vs ≤100 ceiling) | rules quality (N/6 sections substantive) | test coverage (N tests, X% passing).
Then deep-dive only the sections with findings. Skip clean ones. Format hints:
- Synced / RULES.md / token bloat → bulleted gaps.
- Context coverage → table: .
Table | RULES.md | dbt docs | Extra .md | Gap - MECE → bullets.
- Test failures → table: .
Test | Category | Proposed fix
End with a prioritized plan (easiest-win → biggest-work), each item naming the skill that does the work:
undefined以一段总结开头:同步状态 | 范围宽度(N张表 vs ≤100上限) | 规则质量(6个章节中有N个内容充实) | 测试覆盖(N个测试,X%通过率)。
然后仅深入分析有发现的章节。跳过无问题的章节。格式提示:
- 同步情况 / RULES.md / Token冗余 → 项目符号列出缺口。
- 上下文覆盖 → 表格:。
表名 | RULES.md | dbt文档 | 额外.md | 缺口 - MECE问题 → 项目符号。
- 测试失败 → 表格:。
测试项 | 类别 | 拟议修复方案
结尾附上优先级计划(易实现→工作量大),每个条目注明执行该工作的技能:
undefinedPlan
计划
- (easy / 5 min) ... → write-context-rules
- (small / 30 min) ... → create-context-tests
- (medium / 1-2 hr) ... → audit-context (rerun after)
- (large / multi-session) ... → add-semantic-layer
undefined- (简单 / 5分钟) ... → write-context-rules
- (小型 / 30分钟) ... → create-context-tests
- (中型 / 1-2小时) ... → audit-context(修复后重新运行)
- (大型 / 多会话) ... → add-semantic-layer
undefinedGuardrails
约束规则
- Apply one change at a time. Re-run tests between fixes.
- Tests are the source of truth. If the user says "it's working," ask for the latest pass rate first.
- Don't move or split files without confirmation. Show the file map first.
- Don't fix in this skill — diagnose only.
- 一次仅应用一项更改。修复之间重新运行测试。
- 测试是事实来源。如果用户说“运行正常”,先询问最新通过率。
- 未经确认请勿移动或拆分文件。先展示文件映射。
- 本技能仅诊断,不修复。