backend-skill: Skill for Claude Code

.claude/skills/proj-gen-test/SKILL.md

proj-gen-test is a skill for Claude Code from zhangloveyan/backend-skill. It costs 32 tokens per session (806 once invoked), scanned A, original, MIT.

A guide for generating unit and integration test code for service and controller layers. Unit tests check one part of a program, while integration tests check how multiple parts work together.

In plain words
What is it for?
Use it to create tests for service-layer and controller-layer code and to increase test coverage.
Why use it?
It reduces the effort needed to add tests and improve test coverage, meaning how much of the code is exercised by tests.

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-gen-test/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-gen-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-gen-test/github.svg)](https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-gen-test)
Your own site
<a href="https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-gen-test"><img src="https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-gen-test/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-gen-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-gen-test"><img src="https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-gen-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 806 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.00032 $0.00806
Opus 5.5 $0.00013 $0.00322
Sonnet 5.5 $0.00006 $0.00161
Haiku 4.5 $0.00003 $0.00081

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

Security

Grade A, and why

proj-gen-test 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 2mo 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-gen-test/SKILL.md · 129 lines

What it actually says

生成测试代码

适用场景

  • 为 Service 层生成单元测试
  • 为 Controller 层生成单元测试
  • 为完整流程生成集成测试
  • 提高测试覆盖率

测试类型选择

类型 场景 特点
单元测试 测试单个方法逻辑 快速、Mock 依赖
集成测试 测试完整流程 真实数据库、慢

建议: 核心业务逻辑用单元测试,关键流程用集成测试。


测试框架

框架 用途
JUnit 5 测试框架
Mockito Mock 框架
AssertJ 断言库
SpringBootTest 集成测试

前置检查

生成测试前,先确认任务文档:

  • 全流程任务文档存在
  • “代码审查”已完成
  • 将“生成测试”状态标记为进行中

生成测试前,检查目标模块的 pom.xml 是否包含测试依赖:

<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-junit-jupiter</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <scope>test</scope>
</dependency>

如缺失,自动添加到 pom.xml 的 <dependencies> 中,然后再生成测试代码。


测试模板


测试命名规范

方法名_场景_预期结果

示例:
- create_Success
- create_DuplicateName_ThrowException
- getDetail_Found
- getDetail_NotFound_ThrowException
- update_Success
- delete_NotFound_ThrowException

测试原则

  1. 单一职责 - 每个测试只测一个场景
  2. 独立性 - 测试之间互不依赖
  3. 可重复 - 多次运行结果一致
  4. 自验证 - 测试自动判断通过/失败
  5. 及时性 - 与代码同步编写

测试覆盖要求

层级 覆盖要求
Service 核心业务逻辑 100%
Controller 主要接口 80%
Utils 工具方法 100%

同步任务文档

  • 产物清单记录测试代码路径或测试报告路径
  • 流程状态总览标记“生成测试”为已完成
  • 更新下一步指令为“运行测试并记录结果”

注意事项

  1. Mock 外部依赖 - 数据库、Redis、第三方接口
  2. 测试边界条件 - null、空集合、边界值
  3. 测试异常场景 - 业务异常、系统异常
  4. 保持测试简洁 - 避免测试代码过于复杂

相关模板

Files

What ships with it

3 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. 2mo ago First seen · 129 lines · 32 tokens per session scan A 751bba7cd525

Subscribe to this mod's changes

proj-gen-test is a skill published in the GitHub repository zhangloveyan/backend-skill (103 stars, last pushed 23d ago), licensed MIT. It adds 32 tokens to every session and 806 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-gen-test compared with skills from other repositories

proj-gen-test next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
proj-gen-testzhangloveyan/backend-skillSkill10323d agoMITA32Claude Code
test-masterJeffallan/claude-skillsSkill12k7d agoMITA104Claude Code
migrate-xunit-to-xunit-v3dotnet/skillsSkill5.8kyesterdayMITA149Claude Code
go-testingGentleman-Programming/gentle-aiSkill8.4kyesterdayMITA26Claude Code, Codex
principle-test-behavior-not-implementationmichael-denyer/pstack-claudeSkill4.1kyesterdayMITA50Claude Code
dart-testdartsim/dartSkill1.2kyesterdayBSD-2-ClauseA18Claude Code, Codex
test-generatorrshankras/claude-code-apple-skillsSkill8642d agoMITA33Claude Code