بنقرة واحدة
taotao-cloud-project
**`.claude/skills/ttc-crud-generator/SKILL.md`** Use when this capability is needed.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
**`.claude/skills/ttc-crud-generator/SKILL.md`** Use when this capability is needed.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Morning update routine: merge Renovate PRs, rebase local work, apply chezmoi changes Use when this capability is needed.
Use when the user wants to set, change, or clear git commit co-authors for pair or mob programming.
Use when the user asks to install, add, or set up a package, tool, CLI, or application
Use when the user wants to fetch and contextualize a GitHub repository for future reference.
Use when writing or reviewing GitHub-flavored Markdown (README, issues, PRs, docs)
Copy content to my clipboard using `pbcopy`. Use when this capability is needed.
| name | taotao-cloud-project |
| description | **`.claude/skills/ttc-crud-generator/SKILL.md`** Use when this capability is needed. |
.claude/skills/ttc-crud-generator/SKILL.md
---
name: crud-generator
description: 自动生成标准 CRUD 代码(Controller, Service, Repository, DTO, Mapper)
triggers:
- "生成CRUD"
- "创建增删改查"
- "新建模块"
---
# CRUD 代码生成器
## 触发条件
用户输入包含 "生成CRUD" 或 "创建增删改查" 等关键词时自动触发。
## 工作流程
### 1. 收集信息
询问用户:
- 实体名称(如 User, Product)
- 字段列表(名称 + 类型)
- 是否需要分页
- 是否需要软删除
### 2. 生成文件
按照标准包结构生成:
src/main/java/com/company/project/
├── entity/{Entity}.java
├── dto/{Entity}Request.java
├── dto/{Entity}Response.java
├── controller/{Entity}Controller.java
├── service/{Entity}Service.java
├── service/impl/{Entity}ServiceImpl.java
├── repository/{Entity}Repository.java
└── mapper/{Entity}Mapper.java
text
### 3. 代码模板示例
#### Entity 模板
```java
@Entity
@Table(name = "{{tableName}}")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class {{Entity}} {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
{% for field in fields %}
@Column(name = "{{field.name}}", nullable = false)
private {{field.type}} {{field.name}};
{% endfor %}
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime updatedAt;
}
4. 生成数据库迁移
自动创建 Flyway 迁移脚本:
sql
-- V{{timestamp}}__create_{{tableName}}_table.sql
CREATE TABLE {{tableName}} (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
{% for field in fields %}
{{field.name}} {{field.sqlType}} NOT NULL,
{% endfor %}
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
---
> Source: [shuigedeng/taotao-cloud-project](https://github.com/shuigedeng/taotao-cloud-project) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-30 -->