bp-coding-best-practices

bp-coding-best-practices is a skill for Claude Code, Codex from davidYichengWei/agentic-engineering-framework. It costs 45 tokens per session (1,213 once invoked), scanned A, original, MIT.

A practical guide to writing and reviewing readable, maintainable code. It covers naming, function structure, control flow, comments, and safe handling of resources.

In plain words
What is it for?
Use it when writing or reviewing code to check names, function responsibilities, early exits, ownership, cleanup, and other everyday coding choices.
Why use it?
It helps prevent confusing names, deeply nested logic, accidental changes, and resources that are not properly returned or cleaned up.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or reviewing code to check names, function responsibilities, early exits, ownership, cleanup, and other everyday coding choices.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add davidYichengWei/agentic-engineering-framework --skill bp-coding-best-practices
Clone the repo
git clone --depth 1 https://github.com/davidYichengWei/agentic-engineering-framework

Made for: Claude Code, Codex.

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 bp-coding-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices/github.svg)](https://agentmods.dev/skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices)
Your own site
<a href="https://agentmods.dev/skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices"><img src="https://agentmods.dev/badge/skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices/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 bp-coding-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices"><img src="https://agentmods.dev/badge/skills/davidyichengwei/agentic-engineering-framework/bp-coding-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,213 The whole file, excluding the scripts and references it only reads on demand.
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.00045 $0.01213
Opus 5.5 $0.00018 $0.00485
Sonnet 5.5 $0.00009 $0.00243
Haiku 4.5 $0.00005 $0.00121

Measured 1mo ago against content hash 0387e364e3f1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bp-coding-best-practices 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 1mo 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.

skills/bp-coding-best-practices/SKILL.md · 128 lines

How it starts

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

通用编码最佳实践

设计原则(SOLID、设计模式):参见 bp-component-design Skill 特定语言/模块规范:参见相应的 standards skills


命名

原则 说明
自解释 retryCount 而非 n
无魔法数字 const int SECONDS_IN_DAY = 86400;
布尔命名 isValid, hasAccess(问题形式)
作用域匹配 小作用域可短(i),大作用域要描述性

函数设计

原则 说明
单一职责 一个函数做一件事;名字需要 "And" 说明做太多了
参数精简 超过 3-4 个参数 → 考虑结构体封装
const 正确 不修改的参数标 const,防止意外修改

控制流

Guard Clause:失败情况先处理并返回,主逻辑保持左对齐

Early Return:显式采用 early return 编程范式,尽量将可 early return 的检查前置。

// ❌ 深层嵌套
if (order != nullptr) {
    if (order->isValid()) {
        if (order->hasItems()) {
            // main logic
        }
    }
}

// ✅ Guard Clause
if (order == nullptr) return;
if (!order->isValid()) return;
if (!order->hasItems()) return;
// main logic (not nested)

资源安全

原则 说明
RAII 资源生命周期绑定对象生命周期,避免手动清理分散在多条路径
所有权显式 区分 owner 与 borrower,避免隐式转移所有权
窄作用域 变量声明靠近首次使用,减少悬空与误用概率

跨语言场景统一要求:新增分支/返回路径时,必须检查资源契约是否闭环(释放类资源 + 触发类资源)。

新增返回路径的契约检查

当新增 return、early exit 或新分支时,必须逐一检查函数入口处获取的所有"契约性资源"。

契约性资源:函数持有但不拥有、需要在特定时机交还/触发的资源:

  • Closure/Callback(需要 Run)
  • 锁(需要 Unlock)
  • 引用计数(需要 Release)
  • 事务上下文(需要 Commit/Rollback/清理)
  • 幂等标记/Nonce(需要 Complete)
  • 注册到外部管理器的对象(需要 Remove/Unregister)

检查方法:

  1. 识别:在函数开头找所有"获取但需要交还"的东西
  2. 对照:找一个功能相似的现有返回路径,逐行对比它处理了哪些资源
  3. 分类:这个新路径是成功、失败、还是新的第三种状态?现有 ownership 注释是否覆盖?
❌ 反例 ✅ 正例
新分支只清理了数据结构,忘了 callback 的执行契约 对照已有的 early return 路径,发现它调用了 callback->Run(),新路径也需要
假设"返回成功后调用方会处理 closure" 检查调用方逻辑,确认 closure 执行责任的真实归属
只关注"要释放什么",忽略"要触发什么" 同时检查释放类资源(锁、内存)和触发类资源(回调、事件)

注释

场景 做法
何时写 仅当意图不明显时;复杂算法;公共 API
写什么 Why(为什么这样做),不是 What(做了什么)
TODO 包含上下文和负责人
// ❌ 复述代码
// Increment i by 1
++i;

// ✅ 解释意图
// Skip index 0 because it is the sentinel slot.
for (size_t i = 1; i < slots.size(); ++i) { ... }

Read the full file on GitHub · 128 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 128 lines · 45 tokens per session scan A 0387e364e3f1

Subscribe to this mod's changes

bp-coding-best-practices is a skill published in the GitHub repository davidYichengWei/agentic-engineering-framework (159 stars, last pushed 7mo ago), licensed MIT. It adds 45 tokens to every session and 1,213 once invoked, about $0.0002 per session on Opus 5.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 skills, from other repositories

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

openclaw/clawhub · 17 tokens

omh-code-review

This is an OMH code-review workflow skill, projected for Agent Skills hosts (Claude Code, Codex, Cursor, opencode, OpenClaw, pi).

rlaope/oh-my-hermes · 48 tokens

revdiff-plan

Review the last Codex assistant message (plan, analysis, or proposal) with inline annotations in a TUI overlay. Extracts the most recent response from Codex rollout files and opens it in revdiff for review and annotation. Activates on "revdiff-plan", "review plan with revdiff", "annotate plan", "review last response"…

umputun/revdiff · 84 tokens

re0-merge

Review and land an external contribution the way this suite does: gate it against the thesis, land it with the author's credit intact, complete a new skill rather than merging it raw, then approve, credit, and explain before closing. Use when reviewing a pull request, as any collaborator or maintainer, not only the…

LilMGenius/paperthin · 70 tokens

explore-unknowns

Guide the user through a quadrant walk that maps the unknowns of a task — open by listing the known knowns, then work through known unknowns, unknown knowns, and unknown unknowns one stage at a time, ending with a complete four-quadrant map in the user's hands. Use when a request is ambiguous or underspecified, the…

dzhng/skills · 162 tokens

asplos-writing-style

Use when drafting or revising ASPLOS prose — engineering the first two pages that rapid review actually reads, stating the cross-layer insight as one quotable sentence, structuring per-layer mechanism sections, writing bounded claims, and fitting everything into 11 self-contained pages that include figures and…

brycewang-stanford/Awesome-Journal-Skills · 65 tokens