mutually-exclusive-group-handler
Generate logic for handling mutually exclusive argument groups with clear error messages and validation in CLI applications.
Best use case
mutually-exclusive-group-handler is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Generate logic for handling mutually exclusive argument groups with clear error messages and validation in CLI applications.
Teams using mutually-exclusive-group-handler should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/mutually-exclusive-group-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How mutually-exclusive-group-handler Compares
| Feature / Agent | mutually-exclusive-group-handler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Generate logic for handling mutually exclusive argument groups with clear error messages and validation in CLI applications.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Mutually Exclusive Group Handler
Generate logic for handling mutually exclusive CLI argument groups.
## Capabilities
- Generate mutually exclusive group validation
- Create dependent argument relationships
- Set up required group validation
- Implement custom conflict messages
- Configure OR/XOR group logic
- Generate documentation for groups
## Usage
Invoke this skill when you need to:
- Implement mutually exclusive options
- Create dependent argument chains
- Validate argument relationships
- Generate clear conflict messages
## Inputs
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| language | string | Yes | Target language |
| groups | array | Yes | Mutually exclusive group definitions |
### Group Structure
```json
{
"groups": [
{
"name": "output-format",
"type": "mutually_exclusive",
"required": true,
"options": ["--json", "--yaml", "--table"],
"errorMessage": "Choose one output format: --json, --yaml, or --table"
},
{
"name": "auth-method",
"type": "mutually_exclusive",
"options": ["--token", "--username"],
"dependencies": {
"--username": ["--password"]
}
}
]
}
```
## Generated Patterns
### TypeScript Group Handler
```typescript
interface GroupValidation {
name: string;
options: string[];
required?: boolean;
errorMessage?: string;
dependencies?: Record<string, string[]>;
}
export function validateMutuallyExclusiveGroups(
args: Record<string, unknown>,
groups: GroupValidation[]
): void {
for (const group of groups) {
const presentOptions = group.options.filter(opt => {
const key = opt.replace(/^--/, '').replace(/-/g, '_');
return args[key] !== undefined;
});
// Check mutual exclusivity
if (presentOptions.length > 1) {
throw new Error(
group.errorMessage ||
`Options ${presentOptions.join(', ')} are mutually exclusive`
);
}
// Check required group
if (group.required && presentOptions.length === 0) {
throw new Error(
`One of ${group.options.join(', ')} is required`
);
}
// Check dependencies
if (group.dependencies && presentOptions.length === 1) {
const selected = presentOptions[0];
const deps = group.dependencies[selected];
if (deps) {
for (const dep of deps) {
const depKey = dep.replace(/^--/, '').replace(/-/g, '_');
if (args[depKey] === undefined) {
throw new Error(
`${selected} requires ${dep} to be specified`
);
}
}
}
}
}
}
```
### Python Group Handler
```python
from typing import Dict, List, Optional, Any
class MutuallyExclusiveGroup:
def __init__(
self,
name: str,
options: List[str],
required: bool = False,
error_message: Optional[str] = None,
dependencies: Optional[Dict[str, List[str]]] = None
):
self.name = name
self.options = options
self.required = required
self.error_message = error_message
self.dependencies = dependencies or {}
def validate_groups(args: Dict[str, Any], groups: List[MutuallyExclusiveGroup]) -> None:
for group in groups:
present = [
opt for opt in group.options
if args.get(opt.lstrip('-').replace('-', '_')) is not None
]
# Check mutual exclusivity
if len(present) > 1:
raise ValueError(
group.error_message or
f"Options {', '.join(present)} are mutually exclusive"
)
# Check required
if group.required and not present:
raise ValueError(
f"One of {', '.join(group.options)} is required"
)
# Check dependencies
if present and group.dependencies:
selected = present[0]
deps = group.dependencies.get(selected, [])
for dep in deps:
dep_key = dep.lstrip('-').replace('-', '_')
if args.get(dep_key) is None:
raise ValueError(
f"{selected} requires {dep} to be specified"
)
```
## Workflow
1. **Define groups** - Specify mutually exclusive options
2. **Set requirements** - Required vs optional groups
3. **Add dependencies** - Dependent argument chains
4. **Create messages** - Custom error messages
5. **Generate validator** - Validation logic
6. **Generate docs** - Group documentation
## Target Processes
- argument-parser-setup
- error-handling-user-feedback
- cli-command-structure-designRelated Skills
jwt-handler
JWT creation, validation, and management for SDK authentication
electron-protocol-handler-setup
Register and handle custom URL protocols (deep linking) across platforms for Electron applications
clipboard-handler
Cross-platform clipboard operations for text, images, files, and rich content
trap-handler-generator
Generate trap handlers for cleanup, signal handling, and graceful shutdown in shell scripts.
encoding-handler
Handle text encoding across platforms including UTF-8, Windows codepages, and BOM handling.
cross-platform-path-handler
Generate cross-platform path handling utilities for Windows, macOS, and Linux compatibility in CLI applications.
process-builder
Scaffold new babysitter process definitions following SDK patterns, proper structure, and best practices. Guides the 3-phase workflow from research to implementation.
babysitter
Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)
yolo
Run Babysitter autonomously with minimal manual interruption.
user-install
Install the user-level Babysitter Codex setup.
team-install
Install the team-pinned Babysitter Codex workspace setup.
retrospect
Summarize or retrospect on a completed Babysitter run.