everything-claude-code-zh / rules
Cursor rule2k starsChanged 9 months agoMITView on GitHub
扩展通用规则的 Swift 模式
Trending
More talk lately.thin dataabout the whole repository
Who's talking about xu-xiang/everything-claude-code-zh
The biggest 1 of 1 mention linking to the repository that our crawl found. Each line is their own headline.
In this repository114 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- examples/CLAUDE.mdCLAUDE.md
- .cursor/rules/common-agents.mdCursor rule
- .cursor/rules/common-coding-style.mdCursor rule
- .cursor/rules/common-development-workflow.mdCursor rule
- .cursor/rules/common-git-workflow.mdCursor rule
- .cursor/rules/common-hooks.mdCursor rule
- .cursor/rules/common-patterns.mdCursor rule
- .cursor/rules/common-performance.mdCursor rule
- .cursor/rules/common-security.mdCursor rule
- .cursor/rules/common-testing.mdCursor rule
- .cursor/rules/golang-coding-style.mdCursor rule
- .cursor/rules/golang-hooks.mdCursor rule
- .cursor/rules/golang-patterns.mdCursor rule
- .cursor/rules/golang-security.mdCursor rule
- .cursor/rules/golang-testing.mdCursor rule
- .cursor/rules/python-coding-style.mdCursor rule
- .cursor/rules/python-hooks.mdCursor rule
- .cursor/rules/python-patterns.mdCursor rule
- .cursor/rules/python-security.mdCursor rule
- .cursor/rules/python-testing.mdCursor rule
- .cursor/rules/swift-coding-style.mdCursor rule
- .cursor/rules/swift-hooks.mdCursor rule
- .cursor/rules/swift-security.mdCursor rule
- .cursor/rules/swift-testing.mdCursor rule
- .cursor/rules/typescript-coding-style.mdCursor rule
- .cursor/rules/typescript-hooks.mdCursor rule
- .cursor/rules/typescript-patterns.mdCursor rule
- .cursor/rules/typescript-security.mdCursor rule
- .cursor/rules/typescript-testing.mdCursor rule
- api-designSkill
- article-writingSkill
- backend-patternsSkill
- coding-standardsSkill
- content-engineSkill
- e2e-testingSkill
- eval-harnessSkill
- frontend-patternsSkill
- frontend-slidesSkill
- investor-materialsSkill
- investor-outreachSkill
- market-researchSkill
- security-reviewSkill
- strategic-compactSkill
- tdd-workflowSkill
- verification-loopSkill
- oneskillSkill
- article-writingSkill
- content-engineSkill
- frontend-slidesSkill
- investor-materialsSkill
- investor-outreachSkill
- market-researchSkill
- api-designSkill
- article-writingSkill
- autonomous-loopsSkill
- backend-patternsSkill
- The first 60 shown.
The file
Files
Swift 模式(Swift Patterns)
本文件扩展了通用模式规则,增加了 Swift 特有的内容。
面向协议设计(Protocol-Oriented Design)
定义小而集中的协议(protocols)。使用协议扩展(protocol extensions)来提供共享的默认值:
protocol Repository: Sendable {
associatedtype Item: Identifiable & Sendable
func find(by id: Item.ID) async throws -> Item?
func save(_ item: Item) async throws
}值类型(Value Types)
- 使用结构体(structs)作为数据传输对象和模型
- 使用带有关联值(associated values)的枚举(enums)来建模不同的状态:
enum LoadState<T: Sendable>: Sendable {
case idle
case loading
case loaded(T)
case failed(Error)
}Actor 模式(Actor Pattern)
使用 Actor 来处理共享的可变状态,而不是使用锁(locks)或调度队列(dispatch queues):
actor Cache<Key: Hashable & Sendable, Value: Sendable> {
private var storage: [Key: Value] = [:]
func get(_ key: Key) -> Value? { storage[key] }
func set(_ key: Key, value: Value) { storage[key] = value }
}依赖注入(Dependency Injection)
通过默认参数注入协议——生产环境使用默认值,测试环境注入 Mock 对象:
struct UserService {
private let repository: any UserRepository
init(repository: any UserRepository = DefaultUserRepository()) {
self.repository = repository
}
}参考资料(References)
参考技能:swift-actor-persistence 了解基于 Actor 的持久化模式。
参考技能:swift-protocol-di-testing 了解基于协议的依赖注入(DI)和测试。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

