mcpbeat Sign in

Fboss Code Standards Agent Skill

FBOSS coding standards and patterns. Auto-loaded when writing code in fboss/ to catch architecture violations, SAI/SDK misuse, thrift_cow pitfalls, platform config errors, and testing gaps. For explicit multi-reviewer review, use /fboss-review instead.

12k tokens
context cost
the whole folder, loaded on every use
8
files
instructions only
0
copies elsewhere
how many repositories repackaged it
983
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/facebook/fboss --skill fboss-code-standards

What comes with it

41 130 bytes besides the instruction
references/agent-patterns.md
references/contributing.md
references/general-patterns.md
references/platform-config-patterns.md
references/sai-sdk-patterns.md
references/testing-patterns.md
references/thrift-cow-fsdb-patterns.md

The instruction itself

5 sections, as written by the author

FBOSS Code Standards

Overview

Passive coding guidance for FBOSS. Applied automatically while writing or modifying code under fboss/.

Scope

Currently fboss/ only. TODO: extend to configerator/source/neteng/fboss, neteng/netcastle, neteng/fboss.

Quick Checklist

| Area | Pattern | Check |

|------|---------|-------|

| Agent | Mono/multi-switch duality | State changes must work in both modes |

| Agent | SW/HW build boundary | Production HW-agent executables do not depend on SW-agent implementation libraries |

| Agent | Warmboot serialization | New SwitchState fields must serialize/deserialize |

| SAI | SaiApiTable registration | New SAI attributes must be registered |

| SAI | 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 |

| General | Log IDs + names | Include both numeric ID and name in log messages |

| Agent | Delta processing order | Remove → Change → Add; document in comments |

| Agent | Validator extraction | Extract complex validation into dedicated classes |

| Agent | Gate validations with flags | New enforcement behind FLAGS for gradual rollout |

| Testing | Test transient states | Test intermediate invalid states, not just final |

| Testing | Consolidate test helpers | Move shared helpers to base classes |

| Testing | Validation UTs | Pure validation → unit tests, not just HW tests |

| Testing | No setup changes to existing tests | Create new tests instead; setup changes break warmboot roundtrip CI |

| Testing | Program routes via routeUpdater | Use routeUpdater.program() (SwSwitchRouteUpdateWrapper); never hand-build routes and add to FIB; keep enable_nexthop_id_manager on so every route gets a nexthop ID |

| Agent | Read nexthops via ID-aware helpers | State/FIB-side code → FibHelpers getNextHops(state,…) etc.; RIB-internal code → *FromRib(manager,…); never getNextHopSet() (inline nexthops are being removed) |

When to Load References

| Topic | Action |

|-------|--------|

| Team coding conventions (C++ style, control flow, naming) | Read references/general-patterns.md |

| Agent code (SwSwitch, HwSwitch, mono/multi-switch, warmboot) | Read references/agent-patterns.md |

| SAI/SDK layer (SaiApi, SaiStore, SaiManager, vendor SDK) | Read references/sai-sdk-patterns.md |

| FSDB or thrift_cow (subscriptions, COW nodes, PatchBuilder) | Read references/thrift-cow-fsdb-patterns.md |

| Platform services or config (sensor_service, fan_service, JSON configs) | Read references/platform-config-patterns.md |

| Tests (agent HW tests, multinode tests, naming, fixtures) | Read references/testing-patterns.md |

| Adding new patterns | Read references/contributing.md |

Other skills for the same job

different authors, same section of the catalogue
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
Github Release Management
by ComeOnOliver
×3

Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management

10k tokens
Migrate To Shoehorn
by mxyhi
×2

Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.

965 tokens
Bun Development
by ComeOnOliver
×2

Modern JavaScript/TypeScript development with Bun runtime. Covers package management, bundling, testing, and migration from Node.js. Use when working with Bun, optimizing JS/TS development speed, or migrating from Node.js to Bun.

8k tokens
Framework Migration Deps Upgrade
by ComeOnOliver
×2

You are a dependency management expert specializing in safe, incremental upgrades of project dependencies. Plan and execute dependency updates with minimal risk, proper testing, and clear migration pa

8k tokens
Debugging Strategies
by ComeOnOliver
×2

Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.

6k tokens
Backend Dev Guidelines
by ComeOnOliver
×2

Opinionated backend development standards for Node.js + Express + TypeScript microservices. Covers layered architecture, BaseController pattern, dependency injection, Prisma repositories, Zod validation, unifiedConfig, Sentry error tracking, async safety, and testing discipline.

36k tokens
Javascript Typescript Jest
by github
vendor ×1

Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.

558 tokens

How to use it

Copy the folder

Take facebook/fboss-code-standards from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.