Swiftui View Refactor
Dimillian/Skills
Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.
Guides clean architecture design with strict 200-line file limits.
$ npx skills add majiayu000/spellbook --skill elegant-architecture -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install majiayu000/spellbook elegant-architecture --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/elegant-architecture .claude/skills/elegant-architecture && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "elegant-architecture" agent skill from https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architecture into .claude/skills/elegant-architecture/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "elegant-architecture", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architectureType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add majiayu000/spellbook --skill elegant-architecture -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install majiayu000/spellbook elegant-architecture --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/elegant-architecture .agents/skills/elegant-architecture && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "elegant-architecture" agent skill from https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architecture into .agents/skills/elegant-architecture/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "elegant-architecture", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add majiayu000/spellbook --skill elegant-architecture -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install majiayu000/spellbook elegant-architecture --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/elegant-architecture .cursor/skills/elegant-architecture && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "elegant-architecture" agent skill from https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architecture into .cursor/skills/elegant-architecture/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "elegant-architecture", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/majiayu000/spellbook.git --path skills/elegant-architecture--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add majiayu000/spellbook --skill elegant-architecture -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install majiayu000/spellbook elegant-architecture --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/elegant-architecture .gemini/skills/elegant-architecture && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "elegant-architecture" agent skill from https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architecture into .gemini/skills/elegant-architecture/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "elegant-architecture", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install majiayu000/spellbook elegant-architectureInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add majiayu000/spellbook --skill elegant-architecture -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/elegant-architecture .github/skills/elegant-architecture && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "elegant-architecture" agent skill from https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architecture into .github/skills/elegant-architecture/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "elegant-architecture", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add majiayu000/spellbook --skill elegant-architecture -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install majiayu000/spellbook elegant-architecture --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/elegant-architecture .opencode/skills/elegant-architecture && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "elegant-architecture" agent skill from https://github.com/majiayu000/spellbook/tree/main/skills/elegant-architecture into .opencode/skills/elegant-architecture/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "elegant-architecture", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
elegant-architectureGuides clean architecture design with strict 200-line file limits.
Elegant Architecture is an agent skill from majiayu000/spellbook. Guides clean architecture design with strict 200-line file limits. Use when starting new features, refactoring large files, or planning module structure. Enforces modular design and real testing.
Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Design patterns and Refactoring. The repository describes itself as: Cross-runtime skills for Claude Code, Codex, and multi-agent workflows. The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit ed52af7. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown and typescript).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Elegant Architecture loads about 1.8k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 166 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from majiayu000/spellbook at commit ed52af7, republished under its MIT licence (© majiayu000). 166 words, ~1,799 tokens.
.claude/skills/elegant-architecture/SKILL.md (or your agent's skills folder).Before writing any code:
- List all features/functionalities needed
- Estimate code volume for each module
- Identify shared components
- Map dependencies between modulesWhen estimated lines > 200:
- Convert file to folder with index
- Split by sub-functionality
- Extract shared utilities
Example transformation:# Before (user.ts - 400+ lines)
user.ts
# After (user/ folder)
user/
├── index.ts # Public exports
├── types.ts # Interfaces, types
├── validation.ts # Input validation
├── repository.ts # Data access
└── service.ts # Business logic// Define contracts before implementation
interface UserService {
create(input: CreateUserInput): Promise<User>;
findById(id: string): Promise<User | null>;
update(id: string, input: UpdateUserInput): Promise<User>;
delete(id: string): Promise<void>;
}
interface UserRepository {
save(user: User): Promise<User>;
findById(id: string): Promise<User | null>;
findByEmail(email: string): Promise<User | null>;
delete(id: string): Promise<void>;
}For each module:
1. Create type definitions
2. Implement core logic
3. Add error handling
4. Write tests
5. Verify line count < 200// ❌ Avoid: Mock everything
const mockRepo = jest.fn();
const service = new UserService(mockRepo);
// ✅ Prefer: Real implementations
const testDb = createTestDatabase();
const repo = new UserRepository(testDb);
const service = new UserService(repo);
// Test actual behavior
const user = await service.create({ email: 'test@example.com' });
const found = await service.findById(user.id);
expect(found).toEqual(user);src/
├── modules/
│ ├── auth/
│ │ ├── index.ts
│ │ ├── types.ts
│ │ ├── service.ts
│ │ └── middleware.ts
│ ├── user/
│ │ ├── index.ts
│ │ ├── types.ts
│ │ ├── service.ts
│ │ └── repository.ts
│ └── order/
│ ├── index.ts
│ ├── types.ts
│ ├── service.ts
│ └── repository.ts
├── shared/
│ ├── database/
│ ├── errors/
│ └── utils/
└── index.ts// Decouple components via constructor injection
class OrderService {
constructor(
private readonly orderRepo: OrderRepository,
private readonly userService: UserService,
private readonly paymentGateway: PaymentGateway
) {}
async createOrder(userId: string, items: OrderItem[]): Promise<Order> {
const user = await this.userService.findById(userId);
if (!user) throw new NotFoundError('User', userId);
const order = Order.create(user, items);
await this.paymentGateway.charge(user, order.total);
return this.orderRepo.save(order);
}
}
// Wire up in composition root
const orderService = new OrderService(
new PostgresOrderRepository(db),
new UserService(userRepo),
new StripePaymentGateway(stripeClient)
);// Complex object creation
class NotificationFactory {
create(type: NotificationType, data: NotificationData): Notification {
switch (type) {
case 'email':
return new EmailNotification(data, this.emailClient);
case 'sms':
return new SmsNotification(data, this.smsClient);
case 'push':
return new PushNotification(data, this.pushClient);
default:
throw new Error(`Unknown notification type: ${type}`);
}
}
}// Replaceable algorithms
interface PricingStrategy {
calculate(order: Order): Money;
}
class StandardPricing implements PricingStrategy {
calculate(order: Order): Money {
return order.items.reduce((sum, item) => sum.add(item.price), Money.zero());
}
}
class DiscountPricing implements PricingStrategy {
constructor(private readonly discount: Percentage) {}
calculate(order: Order): Money {
const standard = new StandardPricing().calculate(order);
return standard.subtract(standard.multiply(this.discount));
}
}
class OrderProcessor {
constructor(private pricing: PricingStrategy) {}
setPricing(strategy: PricingStrategy) {
this.pricing = strategy;
}
process(order: Order): ProcessedOrder {
const total = this.pricing.calculate(order);
return { ...order, total };
}
}| Indicator | Action |
|---|---|
| File > 200 lines | Split immediately |
| File > 150 lines | Plan split |
| 3+ distinct responsibilities | Split by responsibility |
| Shared types growing | Extract to types.ts |
| Utility functions accumulating | Extract to utils.ts |
1. Identify logical boundaries
2. Create folder with same name as file
3. Move related code to separate files
4. Create index.ts for public exports
5. Update imports in dependent filesmodule/
├── index.ts # Public API exports
├── types.ts # Interfaces, types, enums
├── constants.ts # Configuration, magic values
├── utils.ts # Helper functions
├── service.ts # Business logic
├── repository.ts # Data access
├── validation.ts # Input validation
└── errors.ts # Custom errors## Pre-Implementation
- [ ] Requirements analyzed
- [ ] Code volume estimated
- [ ] File structure designed
- [ ] Interfaces defined
- [ ] Dependencies mapped
## Implementation
- [ ] Each file < 200 lines
- [ ] Single responsibility per module
- [ ] Dependencies injected
- [ ] Error handling complete
- [ ] No hardcoded values
## Testing
- [ ] Real implementations used
- [ ] No mocks for core logic
- [ ] Edge cases covered
- [ ] Integration tests exist
## Review
- [ ] Architecture documented
- [ ] Public APIs clear
- [ ] No circular dependencies
- [ ] Easy to extend❌ God files (500+ lines doing everything)
❌ Mocking everything in tests
❌ Coding before planning
❌ Tight coupling between modules
❌ Hardcoded configuration
❌ Circular dependencies
❌ Unclear module boundaries© majiayu000, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/elegant-architecture of majiayu000/spellbook.
Open the folder on GitHubat commit ed52af7
Elegant Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Elegant Architecture this skillmajiayu000/spellbook | 287 | — | ~1.8k | Automated safety check: Pass | MIT | |
| Swiftui View RefactorDimillian/Skills | 4k | 5 repos | ~2k | Automated safety check: Pass | MIT | |
| RTK Rust Design Patternsrtk-ai/rtk | 83k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Architecture PatternsKartikLabhshetwar/better-shot | 2.4k | 2 repos | ~1.4k | Automated safety check: Pass | Custom licence | |
| AST Visitor Pattern for Unionsprisma/orm | 48k | — | ~830 | Automated safety check: Pass | Apache-2.0 | |
| Solidramziddin/solid-skills | 609 | — | ~2.7k | Automated safety check: Pass | None |
Dimillian/Skills
Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.
rtk-ai/rtk
Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.
KartikLabhshetwar/better-shot
Deep dive into software architecture for macOS. An agent skill from KartikLabhshetwar/better-shot.
prisma/orm
Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.
ramziddin/solid-skills
A skill your agent uses when writing code, implementing features, refactoring, planning architecture, designing systems, reviewing code, or debugging.
decebals/claude-code-java
A practical Java reference for Builder, Factory, Singleton, Strategy, Observer and other patterns, with a table matching problems to patterns.
majiayu000/spellbook
Audits and repairs how coding-agent Skills are owned, copied and exposed across runtimes, from canonical sources to quarantine and retirement.
majiayu000/spellbook
Scans a repository for real evidence and proposes, or on request writes, a small stack of root and scoped AGENTS.md files with validation commands and generated-file boundaries.
majiayu000/spellbook
Plans, produces or diagnoses evidence-backed product demo videos: script, capture plan, pacing checks and verified final media built on real product behavior.
majiayu000/spellbook
Single entry point that routes long or ambiguous agent tasks, checks live state, bounds autonomous loops and leaves a resumable handoff.
majiayu000/spellbook
Scans a repository, its lockfiles and node_modules for known malicious npm package versions and install-time indicators, using a read-only Python scanner.
majiayu000/spellbook
Product management helpers: a RICE scoring script, an interview transcript analyzer and PRD templates for prioritizing features, synthesizing research and writing requirements.
Categories
Guides clean architecture design with strict 200-line file limits. Elegant Architecture is an agent skill from majiayu000/spellbook. Guides clean architecture design with strict 200-line file limits.
Elegant Architecture fits situations like: starting new features; refactoring large files; planning module structure.
Run `npx skills add majiayu000/spellbook --skill elegant-architecture -a claude-code`. Or copy the skill folder (skills/elegant-architecture in majiayu000/spellbook) into .claude/skills/elegant-architecture in your project. Claude Code loads it when a task matches its description.
Run `npx skills add majiayu000/spellbook --skill elegant-architecture -a codex`. Or copy the skill folder (skills/elegant-architecture in majiayu000/spellbook) into .agents/skills/elegant-architecture in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add majiayu000/spellbook --skill elegant-architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/elegant-architecture, .gemini/skills/elegant-architecture, .github/skills/elegant-architecture and .opencode/skills/elegant-architecture in your project.
SKILL.md names no scripts, command-line tools or credentials: Elegant Architecture is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Elegant Architecture is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Elegant Architecture: Swiftui View Refactor (Dimillian/Skills, 4k stars), RTK Rust Design Patterns (rtk-ai/rtk, 83k stars), Architecture Patterns (KartikLabhshetwar/better-shot, 2.4k stars) and AST Visitor Pattern for Unions (prisma/orm, 48k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
majiayu000 (a GitHub user) maintains it in majiayu000/spellbook, which has 287 GitHub stars. The repository holds 97 skills in this directory. The repository was last updated on October 8, 2026.
Source: majiayu000/spellbook on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.