agentleFS
ShopifyKnown publisherShopify/checkout-kit/platforms/swift/.cursor/rules/swift-development.mdc

checkout-kit / rules

Cursor rule7 starsChanged 24 days agoMITView on GitHub

Swift development workflow and language server workarounds

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 4,157 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this swift-development.mdc into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT trust red squiggles or inline error messages

    line 13
  2. Distinctive:

    Always verify issues using the commands below instead

    line 14
  3. Very specific:

    ALWAYS run dev swift format && dev swift lint to check your code is formatted and written in our style.

    line 53

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
swift-development.mdc
---
description: Swift development workflow and language server workarounds
globs: ["**/*.swift"]
alwaysApply: true
---

# SWIFT DEVELOPMENT WORKFLOW

## ⚠️ IMPORTANT: Language Server Issues

**IGNORE ALL LANGUAGE SERVER ERRORS IN SWIFT FILES**
- The language server reports errors erroneously while code compiles fine
- Do NOT trust red squiggles or inline error messages
- Always verify issues using the commands below instead

## Verification Commands

### Check your work systematically:
1. **Lint & Format** → `dev swift lint` (or `dev swift style`) - Checks for linting and stylistic errors
2. **Build Issues** → `dev swift build` - Checks for compilation issues
3. **Test Issues** → `dev swift test` - Checks for failing tests

### Available dev commands:
**See `dev.yml` in project root for complete list of commands and descriptions.**

Key commands for verification:
- `dev swift lint` (alias: `dev swift style`) - Check format & lint issues
- `dev swift format` - Auto-format and apply safe lint autocorrections
- `dev swift build packages` - Build Swift package targets
- `dev swift test` - Run all tests

## Concurrency Best Practices

### DO: Use actors for thread-safe shared state
```swift
actor QueryCache {
    private var cache: [String: Any] = [:]
    private var inflightRequests: [String: Any] = [:]
    
    func loadCached<T>(...) async throws -> T {
        // Safe concurrent access to shared state
    }
}
```

## Workflow Best Practices

### When you see errors:
❌ DON'T: Trust language server errors in Xcode/editor
✅ DO: Run the appropriate dev command to verify

### After making changes:
- ALWAYS run `dev swift format && dev swift lint` to check your code is formatted and written in our style.

## Example Workflow

```bash
# Make your Swift changes...

# Fix any auto-fixable issues
dev swift format

# Check for any remaining lint issues
dev swift lint

# Verify it compiles
dev swift build

# Run tests if needed
dev swift test
```

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.