## Best Practices

### 1. Minimal Capabilities

Only request capabilities you actually need:

```json
// Too broad
"capabilities": ["commands", "exec", "filesystem:read", "filesystem:write", "http"]

// Minimal
"capabilities": ["commands", "notifications"]
```

### 2. Specific exec Patterns

```json
// Too permissive
"execPatterns": ["*"]

// Specific
"execPatterns": ["git status", "git branch", "git log --oneline -10"]
```

### 3. Error Handling

Always wrap API calls in try/catch:

```javascript
handler: async () => {
  try {
    const result = await api.exec.run('some-command');
    // Handle success
  } catch (err) {
    api.notifications.show({
      type: 'error',
      message: `Failed: ${err.message}`
    });
  }
}
```

### 4. Fast Activation

Keep `onActivate` fast - defer heavy work to command handlers:

```javascript
onActivate: async (api) => {
  // Fast: just register commands
  await api.commands.register('my-plugin.heavy-task', {
    title: 'Run Heavy Task',
    handler: async () => {
      // Heavy work happens on-demand
      await doHeavyWork();
    }
  });
}
```
