backend-skill: Skill for Claude Code

.claude/skills/proj-common/SKILL.md

proj-common is a skill for Claude Code from zhangloveyan/backend-skill. It costs 35 tokens per session (1,566 once invoked), scanned A, original, MIT.

A reference for shared project coding rules and common utility patterns, including response objects, error codes, exception handling, transactions, caching, concurrency control, and logging.

In plain words
What is it for?
Use it when adding or changing code that returns results, handles errors, uses database transactions or caches, controls concurrent work, or writes logs.
Why use it?
It helps developers apply the same conventions across the project instead of making separate decisions in each feature.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is zhangloveyan/backend-skill's own configuration. It tells Claude Code how to work on backend-skill itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything backend-skill configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/zhangloveyan/backend-skill/main/.claude/skills/proj-common/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/zhangloveyan/backend-skill

Made for: Claude Code.

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 proj-common

README.md
[![agentmods](https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-common/github.svg)](https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-common)
Your own site
<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.

agentmods 80×15 button for proj-common

Your own site · 80×15
<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>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,566 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.00035 $0.01566
Opus 5.5 $0.00014 $0.00626
Sonnet 5.5 $0.00007 $0.00313
Haiku 4.5 $0.00003 $0.00157

Measured 23d ago against content hash d14778a616fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

.claude/skills/proj-common/SKILL.md · 266 lines

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());
}

Read the full file on GitHub · 266 lines

Files

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.

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. 23d ago Changed d14778a616fb
  2. 2mo ago First seen · 266 lines · 35 tokens per session scan A 06bd9856e249

Subscribe to this mod's changes

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.

Related

proj-common compared with skills from other repositories

proj-common next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
proj-commonzhangloveyan/backend-skillSkill10323d agoMITA35Claude Code
mem0-oss-to-platformmem0ai/mem0Skill68k2d agoApache-2.0A217Claude Code, Codex
azure-mgmt-botservice-dotnetmicrosoft/skillsSkill3.2kyesterdayMITA78Claude Code
fastapi-router-pymicrosoft/skillsSkill3.2kyesterdayMITA46Claude Code
dev-runtimelangwatch/langwatchSkill5.0kyesterdayApache-2.0A172Claude Code
api-designericrisco/rsc-harnessSkill5032d agoMITA105Claude Code, Codex
migrate-segw-to-raparc-mcp/arc-1Skill252yesterdayMITA106Claude Code