Swift source organization workflow
Skill gaelic-ghost/socket/plugins/swift-lang/skills/swift-source-organization-workflow
Organize Swift source trees and files by concern, feature, and layer; split oversized files, extract extension files, normalize MARK sections, file headers, and TODO/FIXME ledgers with stricter split defaults. Use after formatting baseline is clear.From its SKILL.md
npx -y skills add gaelic-ghost/socket --skill swift-source-organization-workflowAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.4 KB, 644 tokens by cl100k_base, as published. Nobody here has run it
Swift Source Organization Workflow
Purpose
Keep Swift source trees small, navigable, and organized around real responsibility boundaries.
Use swift-format-style-workflow before structural edits and again afterward. Hand off to apple-dev-skills when file moves require Xcode target membership, project-file mutation, previews, schemes, or build/run validation.
Workflow
- Establish or confirm the formatting baseline.
- Resolve repo shape:
- Swift package
- Xcode app project
- mixed package plus app
- server-side Swift service
- Inventory source shape:
- large files
- mixed concerns
- broad extensions
- unclear access-control boundaries
- nested types that block reuse
- long TODO/FIXME comments
- redundant or missing
// MARK:sections
- Split by concern:
- strongly consider splitting around
250to300lines when two or more concerns are present - treat
500to600lines as a hard split signal unless the file is generated or has a documented exception - prefer complete passes over tiny partial splits when adjacent files are part of the same concern cleanup
- strongly consider splitting around
- Choose the split shape:
TypeName+Models.swiftTypeName+Validation.swiftTypeName+Pipeline.swiftTypeName+Formatting.swift- feature directories for independent user-facing or domain areas
- layer directories when a package has clear API, domain, persistence, transport, or UI boundaries
- Preserve behavior:
- keep access control intentional
- keep generated files untouched
- update package manifests or Xcode project membership through the owning workflow
- run formatting after moves
MARK Guidance
- Add
// MARK: - <Heading>only when it improves navigation. - Name the responsibility boundary, not the declaration kind.
- Avoid filler headings in short files.
- Avoid comments that repeat obvious method or type names.
File Header And Ledger Guidance
- Preserve existing license banners.
- Use file headers only when the repository already requires them or the task explicitly includes header normalization.
- Keep file-header purpose and concern text plain, specific, and non-generic.
- Move long TODO and FIXME prose into ledgers when the repo uses ledger files; keep source comments short and traceable.
Output Shape
Return:
Organization state: repo shape and largest concern problems.Split plan: files to split, target names, and reason for each split.Moves: directories or manifests that need updates.Handoffs: Apple Dev, Server-Side Swift, or package validation needs.Validation: formatting, build, test, or project-integrity checks.
Guardrails
- Do not split files purely by line count when the file is coherent and generated files are excluded.
- Do not invent abstraction layers just to make files shorter.
- Do not move files across Xcode-managed boundaries without project-membership follow-through.
- Do not leave duplicate helpers behind after extraction.
- Do not use
// MARK:as decoration.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.