--- title: "Cas d'Usage : Compétence Unique" description: Quand vous avez juste besoin d'un agent pour une tâche ciblée — la voie rapide. --- # Exécution d'une compétence unique L'exécution d'une compétence unique est la voie rapide -- un agent, un domaine, une tâche ciblée. Pas de surcoût d'orchestration, pas de coordination multi-agents. La compétence s'active automatiquement depuis votre prompt en langage naturel. --- ## Quand utiliser une compétence unique Utilisez cela lorsque votre tâche remplit TOUS ces critères : - **Appartient à un seul domaine** -- la tâche entière relève du frontend, backend, mobile, base de données, design, infrastructure ou d'un autre domaine unique - **Autonome** -- pas de changements de contrats d'API inter-domaines, pas de modifications backend nécessaires pour une tâche frontend - **Périmètre clair** -- vous savez ce que le résultat devrait être (un composant, un endpoint, un schéma, une correction) - **Pas de coordination** -- aucun autre agent n'a besoin de s'exécuter avant ou après **Examples of single-skill tasks:** - Build one UI component - Add one API endpoint - Fix one bug in one layer - Design one database table - Write one Terraform module - Translate one set of i18n strings - Create one design system section **Switch to multi-agent** (`/work` or `/orchestrate`) when: - UI work needs a new API contract (frontend + backend) - One fix cascades across layers (debug + implementation agents) - The feature spans frontend, backend, and database - Scope grows beyond one domain after the first iteration --- ## Preflight Checklist Before prompting, answer these four questions (they map to the [Prompt Structure](/docs/core-concepts/skills) four elements): | Element | Question | Why It Matters | |---------|----------|----------------| | **Goal** | What specific artifact should be created or changed? | Prevents ambiguity — "add a button" vs "add a form with validation" | | **Context** | What stack, framework, and conventions apply? | Agent detects from project files, but explicit is better | | **Constraints** | What rules must be followed? (style, security, performance, compatibility) | Without constraints, agents use defaults that may not match your project | | **Done When** | What acceptance criteria will you check? | Gives the agent a target and you a verification checklist | If any element is missing from your prompt, the agent will either: - **LOW uncertainty:** Apply defaults and list assumptions - **MEDIUM uncertainty:** Present 2-3 options and proceed with the most likely - **HIGH uncertainty:** Block and ask questions (will not write code) --- ## Prompt Template ```text Build using . Constraints: . Acceptance criteria: 1) 2) 3) Add tests for: . ``` ### Template Breakdown | Part | Purpose | Example | |------|---------|---------| | `Build ` | The Goal — what to create | "Build a user registration form component" | | `using ` | The Context — tech stack | "using React + TypeScript + Tailwind CSS" | | `Constraints:` | Rules the agent must follow | "accessible labels, no external form libraries, client-side validation only" | | `Acceptance criteria:` | Done When — verifiable outcomes | "1) email format validation 2) password strength indicator 3) submit disabled while invalid" | | `Add tests for:` | Test requirements | "valid/invalid submit paths, edge cases for email validation" | --- ## Real Examples ### Frontend: Login Form ```text Create a login form component in React + TypeScript + Tailwind CSS. Constraints: accessible labels, client-side validation with Zod, no external form library beyond @tanstack/react-form, shadcn/ui Button and Input components. Acceptance criteria: 1) Email validation with meaningful error messages 2) Password minimum 8 characters with feedback 3) Disabled submit button while form is invalid 4) Keyboard and screen-reader friendly (ARIA labels, focus management) 5) Loading state while submitting Add unit tests for: valid submission path, invalid email, short password, loading state. ``` **Expected execution flow:** 1. **Skill activation:** `oma-frontend` activates (keywords: "form", "component", "Tailwind CSS", "React") 2. **Difficulty assessment:** Medium (2-3 files, some design decisions around validation UX) 3. **Resources loaded:** - `execution-protocol.md` (always) - `snippets.md` (form + Zod patterns) - `component-template.tsx` (React structure) 4. **CHARTER_CHECK output:** ``` CHARTER_CHECK: - Clarification level: LOW - Task domain: frontend - Must NOT do: backend API, database, mobile screens - Success criteria: form validation, accessibility, loading state, tests - Assumptions: Next.js App Router, @tanstack/react-form + Zod, shadcn/ui, FSD-lite architecture ``` 5. **Implementation:** - Creates `src/features/auth/components/login-form.tsx` (Client Component with `"use client"`) - Creates `src/features/auth/utils/login-schema.ts` (Zod schema) - Creates `src/features/auth/components/skeleton/login-form-skeleton.tsx` - Uses shadcn/ui `