Borrowing it
Nothing to install: this file belongs to zhangloveyan/backend-skill. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/zhangloveyan/backend-skill/main/.claude/skills/proj-common/SKILL.mdgit clone --depth 1 https://github.com/zhangloveyan/backend-skillWrote 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.
[](https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-common)<a href="https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-common"><img src="https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-common/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.
<a href="https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-common"><img src="https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-common.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00035 | $0.01566 |
| Opus 5.5 | $0.00014 | $0.00626 |
| Sonnet 5.5 | $0.00007 | $0.00313 |
| Haiku 4.5 | $0.00003 | $0.00157 |
Grade A, and why
proj-common 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 23d 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.
How it starts
The opening of the file, as written. The whole thing — 266 lines — stays where its author put it; the contents beside it link to each section on GitHub.
公共类与通用规范
任务文档同步
- 如引用本规范中的限制或约束,将关键约束记录到任务文档“上下文快照”
1. 公共类清单
| 类 | 包路径 | 用途 |
|---|---|---|
| R | common.core | 统一响应类 |
| ErrorCode | common.core | 错误码枚举 |
| PageResult | common.core | 分页结果 |
| BusinessException | common.exception | 业务异常 |
| GlobalExceptionHandler | common.exception | 全局异常处理 |
| Constants | common.constant | 全局常量 |
| RedisKeys | common.constant | Redis Key 常量 |
| RedisUtils | common.utils | Redis 工具类 |
| AssertUtils | common.utils | 断言工具类 |
| LoginUserHolder | common.security | 登录用户上下文 |
2. 快速使用
返回响应
return R.success(); // 成功,无数据
return R.success(data); // 成功,有数据
return R.fail(ErrorCode.NOT_FOUND); // 失败
抛出异常
throw new BusinessException(ErrorCode.NOT_FOUND);
throw new BusinessException(ErrorCode.PARAM_ERROR, "用户名不能为空");
断言校验
AssertUtils.notNull(user, ErrorCode.NOT_FOUND);
AssertUtils.isTrue(condition, ErrorCode.PARAM_ERROR, "条件不满足");
获取登录用户
Long userId = LoginUserHolder.getUserId();
LoginUser loginUser = LoginUserHolder.get();
3. 事务规范
使用场景
| 场景 | 是否需要事务 |
|---|---|
| 单表写操作 | 否(MyBatis-Plus 自动处理) |
| 多表写操作 | 是 |
| 先查后改 | 是(需保证一致性时) |
| 纯查询 | 否 |
标准用法
// 写操作
@Transactional(rollbackFor = Exception.class)
public void bindUserRole(Long userId, List<Long> roleIds) {
// 多表操作
}
// 只读事务(查询多表需一致性快照)
@Transactional(readOnly = true)
public UserDetailResponse getDetail(Long id) {
// 多表查询
}
禁止事项
- 禁止在 Controller 层使用
@Transactional - 禁止事务方法内调用同类的另一个事务方法(事务失效)
- 禁止事务内进行 RPC/HTTP 调用
- 禁止大事务(事务方法超过 20 行需拆分)
4. 缓存规范
Key 命名
{项目}:{模块}:{业务}:{标识}
示例:toy:user:info:123、toy:order:detail:456
过期时间
| 数据类型 | 过期时间 | 常量 |
|---|---|---|
| 热点数据 | 1小时 | Constants.CACHE_1_HOUR |
| 普通数据 | 24小时 | Constants.CACHE_1_DAY |
| 配置数据 | 7天 | Constants.CACHE_7_DAY |
| 验证码 | 5分钟 | Constants.CACHE_5_MIN |
缓存策略
// 查询:先缓存后数据库
public User getById(Long id) {
String key = RedisKeys.USER_INFO + id;
User user = redisUtils.get(key, User.class);
if (user == null) {
user = userMapper.selectById(id);
if (user != null) {
redisUtils.set(key, user, Constants.CACHE_1_HOUR);
}
}
return user;
}
// 更新:先数据库后删缓存
public void update(User user) {
userMapper.updateById(user);
redisUtils.delete(RedisKeys.USER_INFO + user.getId());
}
What ships with it
6 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.
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.
- 23d ago Changed d14778a616fb
- 2mo ago First seen · 266 lines · 35 tokens per session scan A 06bd9856e249
proj-common is a skill published in the GitHub repository zhangloveyan/backend-skill (103 stars, last pushed 23d ago), licensed MIT. It adds 35 tokens to every session and 1,566 once invoked, about $0.0001 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.
proj-common compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| proj-commonzhangloveyan/backend-skill | Skill | 103 | 23d ago | MIT | A | 35 | Claude Code |
| mem0-oss-to-platformmem0ai/mem0 | Skill | 68k | 2d ago | Apache-2.0 | A | 217 | Claude Code, Codex |
| azure-mgmt-botservice-dotnetmicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 78 | Claude Code |
| fastapi-router-pymicrosoft/skills | Skill | 3.2k | yesterday | MIT | A | 46 | Claude Code |
| dev-runtimelangwatch/langwatch | Skill | 5.0k | yesterday | Apache-2.0 | A | 172 | Claude Code |
| api-designericrisco/rsc-harness | Skill | 503 | 2d ago | MIT | A | 105 | Claude Code, Codex |
| migrate-segw-to-raparc-mcp/arc-1 | Skill | 252 | yesterday | MIT | A | 106 | Claude Code |