Domain Detection Skill
When to Use
Activate this skill when:
- •Need to identify which domains/agents are involved in work
- •User asks "which agent should handle this?"
- •Determining delegation strategy (single vs multi-agent)
- •After creating specification (identify domains early)
- •After creating plan (confirm domains, detect new ones)
- •Before executing tasks (route to correct agents)
Trigger Keywords: which agent, domain, who should, delegate to, specialist, orchestrator
Automatic Activation: /specify, /plan, and /tasks commands automatically use this skill
Procedure
Step 1: Load Agent Collaboration Reference
Read the agent collaboration triggers document:
Read: .specify/memory/agent-collaboration-triggers.md
Understand the 11 domains:
- •Frontend - UI, components, client-side
- •Backend - APIs, servers, business logic
- •Database - Schema, queries, data modeling
- •Testing - Quality assurance, test automation
- •Security - Authentication, authorization, vulnerabilities
- •Performance - Optimization, scaling, monitoring
- •DevOps - CI/CD, deployment, infrastructure
- •Architecture - System design, patterns, decisions
- •Specification - Requirements, user stories, acceptance criteria
- •Tasks - Work breakdown, dependencies, planning
- •Integration - External APIs, third-party services
Step 2: Analyze Text for Domain Keywords
If analyzing a file:
.specify/scripts/bash/detect-phase-domain.sh --file PATH_TO_FILE
If analyzing user text:
echo "TEXT_TO_ANALYZE" | .specify/scripts/bash/detect-phase-domain.sh --text
Script performs keyword-based detection:
- •Counts domain keyword occurrences
- •Scores each domain (weighted by keyword frequency)
- •Identifies significant domains (threshold: 3+ keywords)
- •Determines delegation strategy
Domain Keywords (Examples):
Frontend: ui, user interface, component, view, screen, page, react, vue, angular, css, html, styling, responsive, mobile, desktop, web app, client-side
Backend: api, endpoint, server, service, route, handler, middleware, controller, business logic, authentication, authorization, session, jwt, rest, graphql
Database: database, schema, table, query, sql, nosql, postgres, mongodb, redis, migration, index, relationship, foreign key, primary key, data model, entity
Testing: test, testing, tdd, unit test, integration test, e2e, jest, vitest, cypress, playwright, coverage, assertion, mock, stub, test case
Security: security, vulnerability, authentication, authorization, rbac, permission, role, owasp, xss, sql injection, csrf, encryption, password, secret, token
Step 3: Interpret Detection Results
Parse JSON output:
{
"detected_domains": ["frontend", "backend", "database"],
"domain_scores": {
"frontend": 8,
"backend": 12,
"database": 5
},
"significant_domains": ["frontend", "backend", "database"],
"delegation_strategy": "multi-agent",
"suggested_agents": [
"frontend-specialist",
"backend-architect",
"database-specialist",
"task-orchestrator"
],
"confidence": "high"
}
Domain Count Rules:
- •0 domains: Generic work, no specialist needed
- •1 domain: Single-agent delegation
- •2 domains: Single or dual-agent delegation (evaluate complexity)
- •3+ domains: Multi-agent delegation via task-orchestrator
Step 4: Determine Delegation Strategy
Single-Agent Delegation:
- •One significant domain detected
- •Work is contained within domain
- •No cross-domain dependencies
Example: "Implement user profile card component"
- •Domain: frontend
- •Agent: frontend-specialist
- •Strategy: single-agent
Multi-Agent Delegation:
- •Multiple significant domains (3+)
- •Work spans domain boundaries
- •Requires coordination
Example: "Implement user registration with email verification"
- •Domains: backend, database, security, integration
- •Agents: backend-architect, database-specialist, security-specialist, task-orchestrator
- •Strategy: multi-agent (orchestrator coordinates)
task-orchestrator Required When:
- •3+ significant domains detected
- •Complex cross-domain coordination needed
- •Multiple specialists must work together
Step 5: Map Domains to Agents
Agent Mapping (from agent collaboration reference):
| Domain | Specialist Agent | Department |
|---|---|---|
| Frontend | frontend-specialist | Engineering |
| Backend | backend-architect | Architecture |
| Database | database-specialist | Data |
| Testing | testing-specialist | Quality |
| Security | security-specialist | Quality |
| Performance | performance-engineer | Operations |
| DevOps | devops-engineer | Operations |
| Architecture | backend-architect, subagent-architect | Architecture |
| Specification | specification-agent | Product |
| Tasks | tasks-agent | Product |
| Integration | backend-architect, devops-engineer | Multiple |
Coordination Agent:
- •task-orchestrator (Product dept): Coordinates multi-agent workflows
Step 6: Report Detection Results
Provide comprehensive domain analysis:
🔍 Domain Detection Results Text Analyzed: [file path or description] Analysis Method: [keyword-based detection] Detected Domains (X total): - Frontend: Score 8 (significant) - Backend: Score 12 (significant) - Database: Score 5 (significant) - Testing: Score 2 (minor) Significant Domains: frontend, backend, database Delegation Strategy: multi-agent Suggested Agents: - frontend-specialist (Engineering) - UI components - backend-architect (Architecture) - API design - database-specialist (Data) - Schema design - task-orchestrator (Product) - Coordinate workflow Confidence: High Rationale: - 3 significant domains detected (frontend, backend, database) - Cross-domain work requires coordination - task-orchestrator recommended to manage specialists Next Step: - Delegate to task-orchestrator - task-orchestrator will route work to specialists - Specialists collaborate on implementation
Constitutional Compliance
Principle X: Agent Delegation Protocol
This skill IMPLEMENTS Principle X:
- •Analyzes task domain
- •Identifies specialized agents
- •Determines delegation strategy
- •Ensures specialized work → specialized agents
Principle X Workflow (4 mandatory steps):
- •READ CONSTITUTION ✅
- •ANALYZE TASK DOMAIN ✅ (this skill)
- •DELEGATION DECISION ✅ (this skill)
- •EXECUTION (agent executes)
Critical Triggers from Principle X:
- •"test" → testing-specialist
- •"database" → database-specialist
- •"API" → backend-architect
- •"component" → frontend-specialist
- •"security" → security-specialist
- •"deploy" → devops-engineer
- •"optimize" → performance-engineer
Examples
Example 1: Single-Domain Detection
User Request: "Implement a loading spinner component for React"
Skill Execution:
- •Load agent collaboration reference
- •Analyze text: "loading spinner component React"
- •Detect keywords: component (frontend), React (frontend), UI (frontend)
- •Results:
- •Domains: frontend (score: 5)
- •Significant: frontend
- •Strategy: single-agent
- •Agents: frontend-specialist
Output:
🔍 Domain Detection Results Detected Domains: frontend Delegation Strategy: single-agent Suggested Agent: frontend-specialist (Engineering) Rationale: Pure frontend UI component work
Example 2: Multi-Domain Detection
User Request: "Build user authentication with email, password, JWT tokens, and PostgreSQL storage"
Skill Execution:
- •Load reference
- •Analyze text
- •Detect keywords:
- •Backend: api, endpoint, jwt, token, authentication
- •Database: postgresql, storage, schema
- •Security: authentication, password, token
- •Results:
- •Domains: backend (12), database (6), security (8)
- •Significant: backend, database, security
- •Strategy: multi-agent
- •Agents: backend-architect, database-specialist, security-specialist, task-orchestrator
Output:
🔍 Domain Detection Results Detected Domains: backend, database, security Delegation Strategy: multi-agent Suggested Agents: - backend-architect - API design, JWT handling - database-specialist - User schema, sessions - security-specialist - Password hashing, auth security - task-orchestrator - Coordinate workflow Rationale: 3 domains require specialist coordination
Example 3: No Specialist Needed
User Request: "Update README with installation instructions"
Skill Execution:
- •Load reference
- •Analyze text: "README installation instructions"
- •Detect keywords: documentation (general)
- •Results:
- •Domains: none significant
- •Strategy: no delegation needed
- •Can be handled without specialist
Output:
🔍 Domain Detection Results Detected Domains: None significant Delegation Strategy: No specialist needed Suggestion: Handle directly (simple documentation update) Rationale: No specialized domain work detected
Agent Collaboration
task-orchestrator
When to suggest: 3+ significant domains detected
What they do: Coordinate multiple specialists, manage workflow, ensure integration
All Specialist Agents
When to suggest: Domain detected matches their specialty
What they do: Execute specialized work in their domain
Work Session Initiation Protocol
This skill supports Step 2 of the mandatory 4-step protocol:
- •READ CONSTITUTION (required before this skill)
- •ANALYZE TASK DOMAIN ← THIS SKILL
- •DELEGATION DECISION (based on this skill's output)
- •EXECUTION (execute directly or delegate)
Validation
Verify the skill executed correctly:
- • Agent collaboration reference loaded
- • Text analyzed (file or user input)
- • Domain detection script executed
- • Detection results parsed (JSON)
- • Domain scores calculated
- • Significant domains identified
- • Delegation strategy determined
- • Agents mapped to domains
- • Results reported to user
- • Confidence level assessed
- • Rationale provided
Troubleshooting
Issue: No domains detected for obviously technical work
Cause: Keywords not in detection dictionary
Solution:
- •Review
.specify/scripts/bash/detect-phase-domain.shkeyword lists - •Add missing keywords to appropriate domain
- •Re-run detection
Issue: Wrong domains detected
Cause: Ambiguous keywords or keyword overlap
Solution:
- •Review domain scores (not just presence/absence)
- •Higher score = stronger signal
- •Consider context (not just keywords)
- •Manual override if clearly incorrect
Issue: Single-agent vs multi-agent unclear (2 domains)
Cause: Edge case (2 domains can go either way)
Solution:
- •Evaluate complexity:
- •Simple integration → single-agent can handle both
- •Complex coordination → use multi-agent with orchestrator
- •Default to multi-agent if unsure (safer)
Issue: Multiple agents from same department
Cause: Domain maps to multiple specialists
Solution:
- •Choose most specific agent
- •Example: "system architecture" could be backend-architect or subagent-architect
- •For implementation architecture → backend-architect
- •For agent/constitutional architecture → subagent-architect
Notes
- •Domain detection is keyword-based (fast but not perfect)
- •High domain scores indicate stronger presence of that domain
- •task-orchestrator is "coordinator" not a domain specialist
- •Single-agent delegation is simpler and faster (prefer when possible)
- •Multi-agent delegation provides better quality for complex work
- •Principle X makes delegation MANDATORY for specialized work
- •This skill automates Step 2 of Work Session Initiation Protocol
- •Detection runs automatically in /specify, /plan, /tasks workflows
- •Can be run standalone on any text/file
Related Skills
- •sdd-specification: Uses this skill to identify agents early
- •sdd-planning: Uses this skill to confirm/update agents
- •sdd-tasks: Uses this skill to route task execution
- •constitutional-compliance: Validates Principle X compliance
References
- •Agent Collaboration Triggers:
.specify/memory/agent-collaboration-triggers.md - •Constitution v1.5.0:
.specify/memory/constitution.md(Principle X) - •Detection Script:
.specify/scripts/bash/detect-phase-domain.sh - •Agent Directory:
.claude/agents/(all 12 specialist agents)