Mastering AI Development Tools: Rules, Skills, Subagents, and MCP Explained
This guide walks through the core concepts of Cursor’s AI‑assisted development workflow—Rules, Skills, Subagents, and the Model Context Protocol (MCP)—explaining their purposes, types, configuration steps, practical examples, and when each should be used to streamline iOS projects.
Background
The author, an iOS developer who frequently uses AI coding assistants such as Cursor, realized a gap in understanding the concepts of Rules, Skills, Subagents, and MCP. The article aims to clarify these concepts and show how to apply them effectively.
What Are Rules and Why Use Them?
Rules are standardized directives that tell an AI what constraints and conventions to follow, improving response consistency and code quality. Without Rules, AI output can be unpredictable.
There are three rule scopes:
Team Rules : Stored in the Cursor dashboard, apply to the whole organization, highest priority, not version‑controlled.
Project Rules : Placed in the project’s ~/.cursor/rules directory, shared via Git, medium priority, govern project‑specific architecture, naming, and technology stack.
User Rules : Configured in Cursor Settings → Rules, apply to the user’s local environment, lowest priority, capture personal coding style and preferences.
Most developers will mainly use User Rules and Project Rules.
Setting Up Rules in Cursor
To create a Project Rule, open Finder, go to ~/.cursor/, create a rules folder, and add the rule files. For User Rules, open Cursor → Settings → Rules, Skills, Subagents, click “Add”, and paste the contents of user_rules.mdc.
Example verification phrase: “Report to the commander, I have obeyed all rules, please check.” If the AI’s response lacks this phrase, the rule was not applied.
Skills: Reusable Prompt Packages
Skills are static prompt templates that give an AI Agent domain‑specific knowledge or workflows. They are loaded only when relevant, unlike always‑on Rules.
Typical uses include crash‑log analysis, Swift‑UI to UIKit migration, and unit‑test generation. A Skill is defined with a YAML‑like header and sections for trigger conditions, core commands, and optional custom commands.
---
name: migrate-oc
description: Convert Objective‑C code to Swift while preserving UI, logic, MVVM, SnapKit, and NetworkService.
version: 1.0
---
# OC to Swift Migrator Skill
## Trigger Conditions
- User provides OC path or mentions OC→Swift migration
## Core Commands
1. Analyze UI, logic, and models.
2. Generate Swift files under SwiftModules/... with MVVM and SnapKit.
3. Ensure 100% UI parity and safe Swift patterns.
4. Output diff and explanations.
## Custom Command
/migrate-oc [OC path or description]Invoke a Skill with a slash command, e.g., /migrate-oc Modules/Profile/SubModules/Business/View.
Managing and Sharing Skills
Place Skills in the project’s .cursor/skills/ directory. Each Skill resides in its own subfolder containing at least a SKILL.md file. Because the folder is part of the Git repository, Skills can be version‑controlled and shared across the team.
Subagents: Dynamic Collaborative Agents
Subagents are temporary helper agents created by the main Agent during a session. They inherit the main context (Rules, Skills, open files) but can be given distinct personas or commands.
Key characteristics:
Created by the main Agent or manually by the user.
Exist only for the current session.
Can be assigned different roles (e.g., planner, converter, reviewer).
Typical number: 2–6; too many cause token overflow.
Differences from Skills: Skills are static prompt bundles for repeatable tasks; Subagents are dynamic, multi‑role collaborators for complex, multi‑stage work.
Recommended scenarios include large refactorings, multi‑angle code reviews, and end‑to‑end architecture‑implementation‑testing pipelines. Simple bug fixes or minor edits should not use Subagents.
Example Subagent workflow for an OC‑to‑Swift migration:
“Migrate the entire Modules/Profile module to SwiftModules/Profile, preserving UI, logic, and analytics, using MVVM + SnapKit + NetworkService. Complete the task with Subagents.”
1. Planner SubAgent: Analyze structure, plan file mapping, assess risks.
2. Converter SubAgent: Convert each file.
3. Reviewer SubAgent: Verify consistency, completeness, and style.
All SubAgents run in parallel using worktrees.Model Context Protocol (MCP)
MCP (Model Context Protocol) is an open standard that lets AI models safely access external data, tools, or files—essentially a plug‑in system for the AI.
Use MCP when the AI needs to perform actions beyond text generation, such as querying a database, reading logs, or manipulating the file system.
Configuration steps in Cursor:
Open Settings → Tools & MCP → Add MCP Server.
Edit mcp.json to add a server, e.g.:
{
"mcpServers": {
"filesystem": {
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
"command": "npx"
}
}
}Create a Skill that uses the filesystem MCP to resize an app icon and import it into Xcode:
---
name: App Icon Resizer & Xcode Importer
description: Crop a 1024×1024 icon into all required iOS sizes and add to Assets.xcassets.
version: 1.0
---
## Trigger Conditions
- User mentions app‑icon resizing or provides a 1024px source image.
## Core Commands
1. Verify source path.
2. Use macOS <code>sips</code> or ImageMagick to generate required sizes.
3. Save results via the <code>filesystem</code> MCP into <code>Assets.xcassets/AppIcon.appiconset</code>.
4. Update <code>Contents.json</code> accordingly.Running the Skill automatically produces all icon assets, as shown in the accompanying screenshots.
Summary
• Rules are mandatory constraints that ensure consistent AI behavior; they come in Team, Project, and User scopes.
• Skills package reusable prompts for domain‑specific tasks and can be version‑controlled in .cursor/skills.
• Subagents act as temporary specialists for complex, multi‑step workflows, complementing Skills.
• MCP extends AI capabilities to interact with real‑world tools and data, enabling automation such as icon generation.
By integrating these mechanisms, developers can offload repetitive tasks—like code migration, crash‑log analysis, or asset generation—to AI, freeing time for higher‑value work.
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
