name: detect-scope description: Detects user request intent, identifies target plugin/module, loads relevant code context, and asks minimal informed questions before proceeding to intake.
Skill: Detect Scope
When to Use
ALWAYS use this skill immediately after assemble-context and BEFORE intake.
This skill runs silent discovery on the user's request so that subsequent questions are informed, precise, and don't waste time on obvious matters.
Workflow
Step 1: Parse User Request
Analyze the raw request for:
- Action type:
create|modify|fix|delete|improve|create-new-plugin - Target entity: posts, deals, tasks, tickets, tags, etc.
- Scope hints: UI elements (page, table, form, button) → frontend; data/schema/model → backend; "new feature" → both
- Plugin hints: direct mentions (sales, content, operation, frontline, etc.)
Step 2: Search Feature Map
Search .agents/maps/feature-map.yaml for exact or fuzzy matches:
# Search by keywords
grep -i "keyword" .agents/maps/feature-map.yaml
# Search by plugin name
grep -i "plugin: {plugin}_ui" .agents/maps/feature-map.yaml
If exact match found:
- Extract plugin, module, components, routes, entities
- Note whether frontend/backend/both exists in the mapping
If no match found:
- Infer plugin from keywords or ask user directly: "Which plugin area does this belong to?"
- Mark scope as
needs-clarification
Step 3: Determine Action Classification
| Request Pattern | Classification | Auto-detected Scope |
|---|---|---|
| "Add/create new X" | create |
Usually frontend + backend |
| "Fix X" / "X is broken" | fix |
Minimal (wherever bug manifests) |
| "X looks bad / UI issue" | fix |
Frontend only |
| "X is slow / timeout" | fix |
Backend only |
| "Update/improve X" | modify |
Frontend + Backend |
| "Remove/delete X" | delete |
Frontend + Backend |
| "Build new plugin for X" | create-new-plugin |
Full scaffold |
Step 4: Load Plugin Context
Read plugin AGENTS.md if exists:
test -f frontend/plugins/{plugin}_ui/AGENTS.md && cat frontend/plugins/{plugin}_ui/AGENTS.md
test -f backend/plugins/{plugin}_api/AGENTS.md && cat backend/plugins/{plugin}_api/AGENTS.md
Explore plugin structure:
# Frontend plugin modules
ls frontend/plugins/{plugin}_ui/src/modules/ 2>/dev/null || echo "No frontend plugin"
# Backend plugin modules
ls backend/plugins/{plugin}_api/src/ 2>/dev/null || echo "No backend plugin"
Find similar existing implementations:
# Find existing RecordTable, Form, or page in same plugin
grep -r "RecordTable" frontend/plugins/{plugin}_ui/src/modules/{module}/ --include="*.tsx" -l 2>/dev/null | head -5
# Find existing GraphQL operations
grep -r "gql\|graphql" backend/plugins/{plugin}_api/src/ --include="*.ts" -l 2>/dev/null | head -5
Step 5: Build Preliminary Scope
Synthesize findings into:
Detected Scope:
Plugin: {plugin_name}
Module: {module_name}
Action: {create|modify|fix|delete|create-new-plugin}
Scope: {frontend|backend|both}
Existing Components: [...]
Similar Implementations: [...]
Step 6: Ask Minimal Informed Questions
DO NOT ask:
- "Which plugin?" (already detected)
- "Frontend or backend?" (already inferred)
- "What components do you need?" (we know the patterns)
DO ask:
Scope Confirmation (1 sentence):
I'll {action} {feature} in the {plugin} plugin ({module} module). Scope: {frontend/backend/both}. Is this correct?Goal Condition (1 question):
What does "done" look like for you? Any specific behavior, design, or constraint I should know?Reference Preference (optional, if similar implementations exist):
I found {similar_feature} in the same plugin. Should I model this after it?
If detection was uncertain, ask ONE clarifying question:
I detected {plugin}/{module}, but I'm not certain. Is this correct, or did you mean {alternative}?
Step 7: Hand Off to Intake
Once user confirms scope and provides goal conditions:
Pass detected scope to
intakeskill:plugin: confirmed pluginmodule: confirmed moduleaction: create|modify|fix|delete|create-new-pluginscope: frontend|backend|bothgoal_condition: user's answer about "done"similar_impl: reference implementation path (if found)
The
intakeskill will then build the component checklist without asking redundant questions.
Examples
Example 1: Clear Request
User: "Add tags to posts"
LLM (detect-scope):
- Parse: action=create, entity=tags, hints=posts (content plugin)
- Feature map: matches
tagsdomain=content, module=cms/tags - Classification: create → scope=both
- Load context:
- Read
frontend/plugins/content_ui/AGENTS.md(if exists) - List
frontend/plugins/content_ui/src/modules/cms/contents - Find similar:
categoriesmodule hasCategoriesRecordTable,CategoryForm
- Read
- Ask:
I'll add tags to the content plugin (cms/tags module). Scope: frontend + backend. Is this correct? What does "done" look like? (e.g., tag management page, tag selector in post form, both?) I found the categories feature as a similar implementation. Should I model tags after it?
User: "Yes, and yes model after categories. I need a tag page and selector in post form."
LLM: Proceeds to intake with confirmed scope.
Example 2: Fix Request
User: "Fix deal pipeline board - cards not dragging"
LLM (detect-scope):
- Parse: action=fix, entity=pipeline board, hints=deal (sales plugin)
- Feature map: matches
pipelinesdomain=sales, module=pipelines - Classification: fix → scope=frontend (UI issue: "not dragging")
- Load context:
- Read
frontend/plugins/sales_ui/AGENTS.md - Find
PipelineBoardcomponent - Check drag-and-drop library usage
- Read
- Ask:
I'll fix the deal pipeline board drag-and-drop in the sales plugin. Scope: frontend only. Is this correct? What does "fixed" look like? Smooth drag-and-drop between stages, or specific edge case?
Example 3: New Plugin Request
User: "Build a warehouse plugin for inventory management"
LLM (detect-scope):
- Parse: action=create-new-plugin, entity=warehouse/inventory
- Feature map: no match for "warehouse"
- Classification: create-new-plugin
- Check manifest: no
warehouseplugin exists - Ask:
I'll create a new "warehouse" plugin for inventory management. This will scaffold both frontend (warehouse_ui) and backend (warehouse_api). Is this correct? What does "done" look like? (e.g., basic CRUD for products, stock tracking, warehouse locations?)
Example 4: Ambiguous Request
User: "Add custom fields to products"
LLM (detect-scope):
- Parse: action=create, entity=custom fields, hints=products (sales plugin)
- Feature map:
custom_fieldsdomain=content (not sales!) - Classification: modify (adding to existing entity)
- Ask:
I detected custom fields for the content plugin (custom fields are managed centrally and applied to products via config). Is this correct, or do you want product-specific custom fields in the sales plugin?
Important Rules
- ALWAYS search feature-map first - don't guess the plugin
- ALWAYS read plugin AGENTS.md if it exists
- ALWAYS find similar implementations in the same plugin before asking questions
- NEVER ask more than 3 questions - detection should handle the rest
- NEVER start coding - hand off to intake after confirmation
- If creating a new plugin, check manifest registry and confirm the name doesn't exist
- Pass all context to intake so it can build checklist immediately
Output Format
When handing off to intake, provide:
detected_scope:
plugin: "content"
module: "cms/tags"
action: "create"
scope: "both"
frontend_plugin: "content_ui"
backend_plugin: "content_api"
existing_similar:
- plugin: "content"
module: "cms/categories"
components: ["CategoriesRecordTable", "CategoryForm"]
goal_condition: "User wants tag management page + tag selector in post form"
user_confirmed: true
CRITICAL: Write State File
detect-scope MUST write its output to:
.agents/state/last-detect-scope.json
This file is validated by the pre-flight check script before intake can run.
Example state file:
{
"plugin": "content",
"module": "cms/tags",
"action": "create",
"scope": "both",
"frontend_plugin": "content_ui",
"backend_plugin": "content_api",
"existing_similar": [
{
"plugin": "content",
"module": "cms/categories",
"components": ["CategoriesRecordTable", "CategoryForm"]
}
],
"goal_condition": "Tag management page + tag selector in post form",
"user_confirmed": true,
"timestamp": "2026-05-29T12:00:00Z"
}
Without this file, intake will FAIL the pre-flight check and cannot proceed.
Related Skills
assemble-context- Must run before this skillintake- Receives output from this skillcreate-plugin- Used when action=create-new-pluginplugin-workflow- Used after intake for execution