agentleFS
s-morgan-jeffriess-morgan-jeffries/omnifocus-mcp/.claude/skills/api-design/SKILL.md

api-design

Skill8 starsChanged 8 months agoMITView on GitHub

Use BEFORE adding any new function, parameter, or endpoint to the OmniFocus MCP server. Also use when considering API changes, evaluating feature requests, or when tempted to create a specialized operation. Contains the decision tree that prevents API sprawl, the anti-pattern catalog, and the consolidation philosophy.

192 other projects use a version of this, 2 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use db-design, everything-claude-code and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • yuexueyuSkill

    db-design

    数据库工程师技能 - Schema设计、索引优化、并发安全、数据库审计。当你涉及数据库表/字段/索引/SQL/迁移/MCP数据库操作、建表改表、写查询时必须使用此技能。即使用户只是说"加个字段"或"查下数据",也应触发。

    Also in 4 projects that use this

  • InfopibeSkill

    everything-claude-code

    Also in 9 projects that use this

  • mryeastcodeSkill

    everything-claude-code-conventions

    Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

    Also in 8 projects that use this

  • tpavanipradeepSkill

    nextjs-turbopack

    Next.js 16+ and Turbopack — incremental bundling, FS caching, dev speed, and when to use Turbopack vs webpack.

    Also in 15 projects that use this

  • Indium-AI-LabsSkill

    data-pipeline-design

    Design batch or incremental ETL and ELT pipelines and warehouse models: grain, partitioning, idempotent loads, late-arriving data, data quality tests, PII controls, and cost monitoring, before building them. Use when adding or changing a dbt model, warehouse table, scheduled transformation, or ingestion job. Not for transactional schema design (use the database-design skill) or event-sourced stores (use the event-sourcing-architecture skill).

    Also in 3 projects that use this

  • thejordanleopoldSkill

    third-party-integration

    Use when integrating with external APIs, payment processors (Stripe), webhooks, or third-party services. Use when implementing API clients with authentication and rate limiting, handling webhooks with signature verification and idempotency, writing contract tests for external services, or isolating third-party dependencies behind adapters. Triggers: \"Stripe\", \"payment integration\", \"webhook\", \"third-party API\", \"external service\", \"API client\", \"integrate with\", \"signature verification\", \"idempotency key\".

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 166 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create and update are always separate operations.

    line 108
  2. Distinctive:

    If you've passed the decision tree and genuinely need a new function:

    line 112
  3. Distinctive:

    Verify it doesn't fit in existing update_X() or get_X()

    line 114
  4. Distinctive:

    Write unit tests (mock AppleScript)

    line 115
  5. Distinctive:

    Write integration tests (real OmniFocus)

    line 116
  6. Very specific:

    Write E2E tests (test MCP tool invocation in test_e2e_mcp_tools.py)

    line 117
  7. Very specific:

    Run ./scripts/check_client_server_parity.sh to verify exposure

    line 120

“Common” is measured: kept by at least 6 in 10 of the 166 edited versions of this file we could read. “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
SKILL.md

OmniFocus MCP API Design

The API was consolidated from 40+ functions to 16 in October 2025. This consolidation is the project's most important architectural decision. Every new function request must pass through this decision tree.

Decision Tree: Use BEFORE Adding Any Function

Can existing update_X() handle this?  (90% of cases: YES)
  |-- Setting a field? -> update_task() or update_project()
  |-- Example: Flag a task -> update_task(task_id, flagged=True)
  |-- Example: Complete a task -> update_task(task_id, completed=True)
  |-- Example: Move to project -> update_task(task_id, project_id=X)
  |
Can existing get_X() handle this with a parameter?  (9% of cases: YES)
  |-- Filtering data? -> Add parameter to get_tasks() or get_projects()
  |-- Example: Overdue tasks -> get_tasks(overdue=True)
  |-- Example: Flagged tasks -> get_tasks(flagged_only=True)
  |
Is this truly specialized logic?  (1% of cases: MAYBE)
  |-- Positioning? Recursive? UI state?
  |-- Example: reorder_task() has before/after logic that doesn't fit update_task()
  |
If NO to all three: You might need a new function. This is rare.

Anti-Patterns (Never Do These)

Field-Specific Setters

# WRONG - creates API sprawl
set_due_date(task_id, date)
set_flag(task_id, True)
set_estimated_minutes(task_id, 30)
complete_task(task_id)
drop_task(task_id)
move_task(task_id, project_id)

# RIGHT - one comprehensive function
update_task(task_id, due_date=date, flagged=True, estimated_minutes=30)
update_task(task_id, completed=True)
update_task(task_id, status=TaskStatus.DROPPED)
update_task(task_id, project_id=project_id)

Specialized Filter Functions

# WRONG - each filter becomes a function
get_overdue_tasks()
get_stalled_projects()
get_flagged_tasks()
get_tasks_in_project(project_id)

# RIGHT - parameters on the existing function
get_tasks(overdue=True)
get_projects(stalled=True)
get_tasks(flagged_only=True)
get_tasks(project_id=project_id)

String Booleans

# WRONG
update_task(task_id, flagged="true")

# RIGHT
update_task(task_id, flagged=True)

Formatted Text Returns

# WRONG - returns human-readable string
def get_tasks():
    return "Task 1: Buy groceries\nTask 2: Write report"

# RIGHT - returns structured data
def get_tasks():
    return [{"id": "abc", "name": "Buy groceries"}, {"id": "def", "name": "Write report"}]

Single vs Batch Update Rules

The API separates single-item and batch updates for safety:

  • update_task() — single task, ALL fields available (including name, note)
  • update_tasks() — multiple tasks, LIMITED fields (excludes name, note)

Why? Name and note require unique values per task. Batch-setting all tasks to the same name is almost always a mistake. The API prevents this by design.

Same pattern applies to projects: update_project() vs update_projects().

Union Types

Union[str, list[str]] is used ONLY for delete operations:

def delete_tasks(task_ids: Union[str, list[str]]) -> dict
def delete_projects(project_ids: Union[str, list[str]]) -> dict

This allows convenient single-item deletes without wrapping in a list. Do NOT use this pattern for update operations — the single/batch distinction is intentional.

No Upsert

Create and update are always separate operations. Never combine them into a "create or update if exists" pattern. This is an MCP design principle — the caller should know whether they're creating or updating.

Adding a New Function Checklist

If you've passed the decision tree and genuinely need a new function:

  1. Verify it doesn't fit in existing update_X() or get_X()
  2. Write unit tests (mock AppleScript)
  3. Write integration tests (real OmniFocus)
  4. Write E2E tests (test MCP tool invocation in test_e2e_mcp_tools.py)
  5. Implement in omnifocus_connector.py
  6. Expose in server_fastmcp.py
  7. Run ./scripts/check_client_server_parity.sh to verify exposure
  8. Update API documentation

Full Design Rationale

For detailed worked examples, the complete anti-pattern catalog with explanations, and type signature templates, see docs/reference/ARCHITECTURE.md.

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.