backend-design

backend-design is a skill for Claude Code, Codex, Cursor from glyahh/ai-generate-code. It costs 80 tokens per session (2,758 once invoked), scanned A, original, MIT.

A set of rules for writing and changing Java backend code in a specific project. It describes the project's code layers, response format, validation, error handling, and files that must not be changed.

In plain words
What is it for?
Use it when modifying, writing, restructuring, or refactoring the project's Java backend, database queries, build settings, or configuration files.
Why use it?
It gives developers one consistent way to modify the backend and helps avoid changes that conflict with the project's existing structure.

Skill for Claude CodeCodexCursor

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.

agentmods
npx agentmods add skills/glyahh/ai-generate-code/backend-design
Any agent
npx skills add glyahh/ai-generate-code --skill backend-design
Clone the repo
git clone --depth 1 https://github.com/glyahh/ai-generate-code

Made for: Claude Code, Codex, Cursor.

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 backend-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/glyahh/ai-generate-code/backend-design.svg)](https://agentmods.dev/skills/glyahh/ai-generate-code/backend-design)
Your own site
<a href="https://agentmods.dev/skills/glyahh/ai-generate-code/backend-design"><img src="https://agentmods.dev/badge/skills/glyahh/ai-generate-code/backend-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,758 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00080 $0.02758
Opus 5 $0.00040 $0.01379
Sonnet 5 $0.00016 $0.00552
Haiku 4.5 $0.00008 $0.00276

Measured 5d ago against content hash f45b00b05476, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

backend-design 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 5d 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.

.cursor/skills/backend-design/SKILL.md · 129 lines

How it starts

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

项目上下文与总原则

  • 遵循本项目既有分层架构:controller → service 接口 → serviceImpl → mapper / entity / DTO / VO,以及 core 下的「门面 + 执行器 + 解析器/模板」模式(参考 AiCodeGeneratorFacadeCodeParserExecutorCodeFileSaverExecutor)。
  • 所有 Web 接口统一返回 BaseResponse<T>,优先通过 ResultUtils.success / ResultUtils.error 构建响应;需要自定义提示时可以使用 new BaseResponse<>(code, data, message)
  • 参数校验、业务前置校验、权限校验统一使用 ThrowUtils.throwIf(...) 搭配 ErrorCode / MyException,不要在 Controller 中随意使用 if (...) return 之类的早退返回。
  • 依赖注入优先使用构造器注入 + Lombok:在 controllerserviceImpl 中使用 @RequiredArgsConstructor,同时配合 @Slf4j 打日志。
  • 全局异常通过 GlobalExceptionHandler 兜底,业务代码中抛出 MyException 或通过 ThrowUtils.throwIf 抛出,不在控制层/服务层到处写 try-catch 吃掉异常。
  • 统一使用 Hutool 工具类,如 StrUtil 做字符串判空,BeanUtil 做对象属性拷贝。
  • 绝对不要修改前端目录:禁止改动 ai-generate-code-frontend/** 下的任何文件,仅操作 Java 后端、SQL、Maven、YAML 等后端相关内容。

统一响应与异常处理风格

  • 所有对外接口(@RestController 下的方法)返回类型统一为 BaseResponse<T>
    • 正常成功:return ResultUtils.success(data);
    • 需要自定义提示:return new BaseResponse<>(20000, data, "自定义提示");
    • 特殊业务分支可以按现有风格使用 new BaseResponse<>(code, data, message),但保持与项目已有语义一致(例如管理员已存在等场景)。
  • 参数 & 状态校验:
    • 统一使用 ThrowUtils.throwIf(condition, ErrorCode.PARAMS_ERROR, "具体错误信息");
    • 登录态校验:ThrowUtils.throwIf(user == null || user.getId() == null, ErrorCode.NOT_LOGIN_ERROR, "用户未登录或会话失效");
    • 资源不存在:ThrowUtils.throwIf(entity == null, ErrorCode.NOT_FOUND_ERROR, "xxx 不存在");
    • 权限不足:ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR, "无权限/只能操作自己的资源");
    • 通用系统错误:使用 ErrorCode.SYSTEM_ERRORErrorCode.OPERATION_ERROR,语义同项目现有代码。
  • GlobalExceptionHandler 行为:
    • MyException:记录错误日志,包装为 ResultUtils.error(e.getCode(), e.getMessage());
    • 其他 RuntimeException:记录堆栈,包装为 ResultUtils.error(ErrorCode.SYSTEM_ERROR, "系统错误");
    • 编写新的异常/错误处理逻辑时,保持与此模式兼容,不破坏现有异常分层。

针对「修改」场景的行为规范

当用户指令中包含**「修改」**字样时,执行以下策略:

  1. 最小修改原则
    • 只在必要的最小范围内修改代码,尽量局部变更,避免重排大段结构。
    • 保持方法签名、入参与返回类型不变,除非用户明确要求调整接口。
  2. 保持现有风格与语义
    • 继续使用 ThrowUtils.throwIf 做参数与权限校验,沿用现有错误码与错误信息风格。
    • 控制器里依旧通过 ResultUtils.success 返回统一响应。
    • 日志继续采用当前格式:log.info("xxx, param={}", param);log.error("xxx, appId={}, userId={}", appId, userId, e);
  3. 保留原有实现思路
    • 若只做 Bug 修复或小优化,直接在原逻辑上微调即可。
    • 若必须大幅重构单个方法,也要优先采用「提取新私有方法 + 旧方法委托调用新方法」的方式,保持原方法作为入口存在,以便回滚。

Read the full file on GitHub · 129 lines

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. 5d ago First seen · 129 lines · 80 tokens per session scan A f45b00b05476

Subscribe to this mod's changes

backend-design is a skill published in the GitHub repository glyahh/ai-generate-code (10 stars, last pushed 29d ago), licensed MIT. It adds 80 tokens to every session and 2,758 once invoked, about $0.0004 per session on Opus 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-31.