一键导入
creating-repository
Scaffolds a Repository protocol and implementation with network or database layer. Use when creating a new Repository.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffolds a Repository protocol and implementation with network or database layer. Use when creating a new Repository.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | creating-repository |
| description | Scaffolds a Repository protocol and implementation with network or database layer. Use when creating a new Repository. |
Scaffolds a Repository following Clean Architecture with protocol in Domain and implementation in Data.
| File | Location | Purpose |
|---|---|---|
{Entity}RepositoryProtocol.swift | ShopHelp/Domain/Abstractions/ | Repository contract |
{Entity}RepositoryImpl.swift | ShopHelp/Data/Repositories/ | Implementation |
{Action}{Entity}Request.swift | ShopHelp/Data/Network/APIRequest/ | API request model |
{Entity}Response.swift | ShopHelp/Data/Network/APIResponse/ | API response model |
//
// {Entity}RepositoryProtocol.swift
// ShopHelp
//
// Created by Man Tran on DD/MM/YY.
//
protocol {Entity}RepositoryProtocol {
func fetch{Entity}(id: String) async throws -> {Entity}Domain
func save{Entity}(_ entity: {Entity}Domain) async throws
}
//
// {Entity}RepositoryImpl.swift
// ShopHelp
//
// Created by Man Tran on DD/MM/YY.
//
final class {Entity}RepositoryImpl: {Entity}RepositoryProtocol {
private let networking: AppGatewayNetworkingProtocol
init(networking: AppGatewayNetworkingProtocol) {
self.networking = networking
}
func fetch{Entity}(id: String) async throws -> {Entity}Domain {
let request = Get{Entity}Request(id: id)
let response: {Entity}Response = try await networking.request(request)
return response.toDomain()
}
func save{Entity}(_ entity: {Entity}Domain) async throws {
let request = Save{Entity}Request(entity: entity)
try await networking.request(request)
}
}
//
// Get{Entity}Request.swift
// ShopHelp
//
// Created by Man Tran on DD/MM/YY.
//
import Networking
struct Get{Entity}Request: APIRequest {
typealias Response = {Entity}Response
let id: String
var path: String { "/api/v1/entities/\(id)" }
var method: HTTPMethod { .get }
}
//
// {Entity}Response.swift
// ShopHelp
//
// Created by Man Tran on DD/MM/YY.
//
struct {Entity}Response: Decodable {
let id: String
let name: String
func toDomain() -> {Entity}Domain {
{Entity}Domain(
id: id,
name: name
)
}
}
Choose the correct gateway based on the feature area:
| Gateway | Use For |
|---|---|
AppGatewayNetworkingProtocol | Products, product details, reviews |
OrderGatewayNetworkingProtocol | Cart, checkout operations |
FrontGatewayNetworkingProtocol | Order details, login |
TrackingGatewayNetworkingProtocol | Analytics events |
AIGatewayNetworkingProtocol | Chat, AI features |
RemoteConfigsGatewayNetworkingProtocol | Feature flags |
NotificationGatewayNetworkingProtocol | Push notifications |
toDomain().ShopHelp/Domain/Entities/.Register in RepositoriesAssembly.swift (or equivalent):
container.register({Entity}RepositoryProtocol.self) { resolver in
let networking = resolver.resolve(AppGatewayNetworkingProtocol.self)!
return {Entity}RepositoryImpl(networking: networking)
}.inObjectScope(.container)
For repositories backed by local DB (GRDB):
final class {Entity}LocalRepositoryImpl: {Entity}RepositoryProtocol {
private let database: MainDatabaseProtocol
init(database: MainDatabaseProtocol) {
self.database = database
}
func fetch{Entity}(id: String) async throws -> {Entity}Domain {
let record = try await database.read { db in
try {Entity}Record.fetchOne(db, key: id)
}
return record?.toDomain()
}
}
Domain/Abstractions/ with async throws methodsData/Repositories/ as final classtoDomain() mappingSee docs/PATTERNS.md for the canonical Repository pattern.
See ShopHelp/Data/Repositories/ for existing implementations.
See docs/ARCHITECTURE.md for gateway documentation.
Standard editorial template for any standalone HTML output (reports, RCAs, dashboards, diagrams, slides, recaps). Use EVERY time you generate an HTML file so output follows one consistent house style instead of ad-hoc theming.
Findings-first review agent for code changes. Use when the user asks to review a branch, PR, diff, commit range, or recent changes and wants prioritized, actionable issues instead of implementation work.
Scan and clean stale Claude Code sessions from the shared store at ~/.local/share/claude/projects (used by all .claude / .claude-accountN dirs via symlink). Removes session JSONLs older than N days, orphan subagent dirs, and reports reclaimable space.
Triage ShopHelp XCTest/Swift Testing failures before proposing fixes.
Manage Jira issues through jhelp shell functions (jv, jm, jd, jc, jforward, etc.). Use when the user wants to view, transition, assign, comment on, edit, search, or create Jira work items; when they provide a bare issue number, Jira issue key, or Jira URL; or when the task involves the current git branch ticket.
Create git commits. Use when user says "commit", "commit this", "commit changes", "split commit", "split commit change", "split the changes".