在 FBOSS 代码开发中自动检查规范、架构误用与测试遗漏。
整体看这是一个仅提供代码规范提示的 prompt-only 技能,且为开源 GitHub 来源,没有密钥、无固定远程端点,也不涉及直接执行代码或明显数据外发,风险较低。需要留意的是它会读取当前代码上下文以给出建议,因此在本地代码审查场景下属常规 caution。
未声明任何密钥、token 或环境变量需求;从材料看不涉及凭证收集、存储或转发。
未列出远程端点 host,也未描述会将用户数据发送到外部服务;当前没有明确外发路径。
属于 prompt-only 技能,不显示会在本机起进程或执行任意代码;其作用是提供编码规范与审查提示,属于常规本地辅助能力。
作用范围限定在 fboss/ 代码目录的写作与修改建议,意味着可能读取本地代码上下文;这属于代码审查工具的常规数据访问范围。
来源为 GitHub 且仓库开源可审计,材料未见闭源或失维迹象;虽然星标为 0、维护状态未知,但未出现具体供应链红旗。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "fboss-code-standards" 技能: 1. 下载 https://raw.githubusercontent.com/facebook/fboss/main/fboss/skills/fboss-code-standards/SKILL.md 2. 保存为 ~/.claude/skills/fboss-code-standards/SKILL.md 3. 装好后重载技能,告诉我可以用了
请按 fboss-code-standards 审查这段位于 fboss/ 的代码改动,重点检查架构违规、SAI/SDK 调用误用、thrift_cow 风险、平台配置问题,以及缺失的测试,并给出修改建议。
一份针对 FBOSS 规范的审查结果,列出问题、风险原因和可执行的修复建议。
我正在修改 FBOSS 的平台配置文件,请依据 fboss-code-standards 检查是否存在配置不一致、模式误用或可能影响部署与运行的问题,并指出需要补充的验证步骤。
指出配置层面的潜在错误,并提供校验、测试或回滚建议。
下面是一段新增的 FBOSS 功能代码,请根据 fboss-code-standards 判断现有测试是否充分;如果不足,请列出应补充的单元测试、集成测试或边界场景。
给出测试覆盖评估,并明确建议新增哪些测试场景与断言。
Passive coding guidance for FBOSS. Applied automatically while writing or modifying code under fboss/.
Currently fboss/ only. TODO: extend to configerator/source/neteng/fboss, neteng/netcastle, neteng/fboss.
| Area | Pattern | Check |
|---|---|---|
| Agent | Mono/multi-switch duality | State changes must work in both modes |
| Agent | Warmboot serialization | New SwitchState fields must serialize/deserialize |
| SAI | SaiApiTable registration | New SAI attributes must be registered |
| SAI |
对 FBOSS 代码变更进行多维并行审查,输出可靠性、架构与测试问题建议。
Debug FBOSS AgentHwTest failures - build, run, analyze logs, crash debug, vendor diag shell, hypothesis-driven debugging. Use when running sai_agent_hw_test or multi_switch_agent_hw_test and investigating test failures.
| SaiStore consistency |
| SAI objects must be tracked, no orphans |
| FSDB | State/Stats duality | Always handle both trees |
| FSDB | extern template | New ThriftStructNode instantiations need extern template |
| thrift_cow | COW modification | Use modify(), never mutate shared nodes |
| Platform | JSON + Thrift sync | Config changes update both schemas |
| Testing | Naming convention | Follow AgentHw<Feature>Test pattern |
| Testing | NSDB impact | Core FSDB changes must run NSDB tests |
| General | Follow local patterns | Be consistent with existing code in the directory |
| Testing | No GTEST_SKIP | Use ProductionFeatures filtering, never GTEST_SKIP() |
| Testing | DSF counters | Check reassembly errors on fabric ports, not discards |
| Agent | Non-coalescing behavioral deltas | Mark delta-significant updates non-coalescing |
| Agent | Rolled-out flag cleanup | Remove feature flags that are fully rolled out |
| Agent | Early return on empty deltas | Check for empty deltas and return early |
| Agent | No hardcoded ASIC types | Use feature/property lookups, not ASIC name checks |
| SAI | Explicit cancellation | Distinguish reconnectable errors from shutdown signals |
| General | No private fn defaults | Don't default parameters all callers override |
| General | Explicit state flags | Pass all enable/disable flags, no direction assumptions |
| General | Verify before deleting | Provide evidence files are unused before deleting |
| General | CHECK over assert | Use CHECK for production invariants, not assert() |
| General | emplace over operator[] | Use emplace/insert for map insertions |
| General | ASIC feature gating | Gate HW-specific constraints with ASIC features |
| General | Concise method naming | Don't include class name in method name |
| General | Explicit operator precedence | Parenthesize compound boolean/comparison expressions |
| General | Inline trivial comparisons | Don't wrap one-line checks in helper methods |
| General | Fix lint before landing | Run arc f and arc lint before submitting |
| Testing | Targeted unit tests | New modules need dedicated unit tests, not just HW tests |
| Agent | Documentation-value methods | Keep per-ASIC limit methods as architecture docs |
| General | Rate-limit verbose logging | Use XLOG_EVERY_MS, never log at line rate |
| General | Perspective-aware naming | Use fromX/toX instead of ambiguous Rx/Tx |
| General | Update OSS build files | Update CMake alongside BUCK when adding/moving files |
| Testing | Deep comparison over size checks | Compare content, not just collection size |
| Testing | Verify negative cases | Explicitly check absence, not just no-throw |
| Testing | Test overflow and error paths | Cover resource exhaustion, not just happy path |
| Testing | Optimize test execution time | Use smallest packet sizes, avoid unnecessary waits |
| Agent | ODS counters for debugging | Add ODS counters for drop/error events, not just logs |
| Agent | Validate external config limits | Reject unreasonable externally configurable values |
| Agent | Populate warmboot cache first | Fill all caches from warmboot state before processing |
| General | Empty vector over optional<vector> | Use empty vector, not optional<vector> |
| General | Map-based config | Use map lookups, not if-else chains for platform values |
…