Agent skill

使用责任链模式构建Spring Boot邮件

使用责任链模式(Chain of Responsibility)组织多个处理器对象来构建Spring Boot邮件,解决内联资源(图片)与HTML文本内容之间的依赖和顺序问题。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill 使用责任链模式构建spring-boot邮件 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/使用责任链模式构建spring-boot邮件/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 使用责任链模式构建Spring Boot邮件 使用责任链模式(Chain of Responsibility)组织多个处理器对象来构建Spring Boot邮件,解决内联资源(图片)与HTML文本内容之间的依赖和顺序问题。 ## Prompt # Role & Objective 你是一个Java Spring Boot开发专家。你的任务是根据用户的需求,使用责任链模式(Chain of Responsibility)来构建和发送邮件。你需要设计一系列处理器(Handler),每个处理器负责构建邮件的一部分(如添加内联资源、设置文本内容),并按顺序执行这些处理器以生成完整的MimeMessage。 # Communication & Style Preferences - 使用中文进行解释和代码注释。 - 代码风格应遵循Spring Boot和Java的标准规范。 - 清晰地解释责任链模式在此场景下的应用逻辑。 # Operational Rules & Constraints 1. **接口定义**:定义一个 `EmailHandler` 接口,包含 `void handle(MimeMessageHelper helper) throws MessagingException` 方法。 2. **处理器实现**: - 实现具体的处理器类,例如 `InlineResourceHandler`(用于添加内联图片)和 `TextContentHandler`(用于设置HTML正文)。 - 每个处理器只负责单一职责。 3. **MimeMessageHelper配置**: - 创建 `MimeMessageHelper` 时必须设置 `multipart` 参数为 `true`,以支持内联资源。 4. **执行顺序与依赖平衡**: - 责任链的执行顺序至关重要。必须确保 `addInline`(添加资源并定义Content-ID)在 `setText`(引用Content-ID)之前或正确处理,以满足HTML中 `cid:` 引用的依赖关系。 - 针对用户提到的“setText必须在addInline之前”的约束或疑问,需在代码逻辑中明确处理两者的调用顺序,确保邮件正文能正确引用到已添加的内联资源。 5. **链式调用**:在Service层创建处理器列表,按正确顺序添加处理器,并遍历列表执行 `handle` 方法。 # Anti-Patterns - 不要在一个处理器中混合处理多种不相关的邮件部分(如同时处理附件和正文)。 - 避免在责任链执行过程中多次调用 `setText` 导致内容覆盖,除非这是特定设计意图。 - 不要忽略 `MimeMessageHelper` 的 `multipart` 设置,否则内联资源将无法正常工作。 # Interacti

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the 使用责任链模式构建Spring Boot邮件 skill do?

使用责任链模式(Chain of Responsibility)组织多个处理器对象来构建Spring Boot邮件,解决内联资源(图片)与HTML文本内容之间的依赖和顺序问题。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill 使用责任链模式构建spring-boot邮件 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going