Feature Suggestion Handler
Process feature suggestions from feature_suggestions table.
Command Routing
| Input | Action |
|-------|--------|
| /ehdota list | List ALL pending (Step 1) |
| /ehdota | List in_progress only (Step 2) |
| /ehdota suunnitelma | Generate plan for in_progress (Step 3) |
| /ehdota toteuta | Implement in_progress with plan (Step 4) |
DB: mcp__plugin_supabase_supabase__execute_sql with project iryqgmjauybluwnqhxbg
Status Values
| Status | DB | UI |
|--------|----|----|
| pending | Odottaa käsittelyä | Odottaa |
| in_progress | Työn alla (valittu toteutettavaksi) | Työn alla |
| implemented | Toteutettu | Toteutettu |
| rejected | Hylätty | Hylätty |
Suunnitelman olemassaolo: ai_implementation_plan IS NOT NULL (ei erillistä statusta).
Step 1: List ALL Pending (/ehdota list)
SELECT id, title, category, priority, status, created_at,
CASE WHEN ai_implementation_plan IS NOT NULL THEN true ELSE false END AS has_plan
FROM feature_suggestions
WHERE status IN ('pending', 'in_progress')
ORDER BY
CASE status WHEN 'in_progress' THEN 0 ELSE 1 END,
priority ASC NULLS LAST, created_at ASC
Present as table grouped by status:
### Työn alla
1. #[short_id] [title] ([category]) - prioriteetti [N] [has_plan ? "✓ suunnitelma" : ""]
### Odottavat
1. #[short_id] [title] ([category]) - prioriteetti [N]
After listing, use AskUserQuestion with multi-select to let user pick suggestions to move to in_progress:
Valitse ehdotukset työn alle:
[list of pending suggestions as options]
On selection, update status:
UPDATE feature_suggestions SET status = 'in_progress', updated_at = NOW() WHERE id IN (...)
Step 1b: Show Single Suggestion
SELECT id, title, description, context_type, context_key, suggestion,
priority, admin_notes, category, source, ai_implementation_plan,
ai_plan_generated_at, created_at, status, benefit
FROM feature_suggestions WHERE id = '[id]'
Format:
## Ehdotus #[id]: [title]
**Kuvaus:** [description]
**Kategoria:** [category] | **Prioriteetti:** [priority] | **Tila:** [status]
**AI-suunnitelma:** [ai_implementation_plan or "Ei generoitu"]
Step 2: List In-Progress (/ehdota)
SELECT id, title, category, priority,
CASE WHEN ai_implementation_plan IS NOT NULL THEN true ELSE false END AS has_plan
FROM feature_suggestions
WHERE status = 'in_progress'
ORDER BY priority ASC NULLS LAST, created_at ASC
If none found → tell user "Ei työn alla olevia ehdotuksia. Aja /ehdota list valitaksesi."
Present:
### Työn alla
1. #[short_id] [title] ([category]) [has_plan ? "✓ suunnitelma" : "⏳ ei suunnitelmaa"]
Show available actions:
`/ehdota suunnitelma` — Tee suunnitelma
`/ehdota toteuta` — Toteuta
`/ehdota list` — Valitse lisää työn alle
Step 3: Generate Plan (/ehdota suunnitelma)
- Fetch in_progress suggestions without plans:
SELECT id, title, description, category, benefit
FROM feature_suggestions
WHERE status = 'in_progress' AND ai_implementation_plan IS NULL
ORDER BY priority ASC NULLS LAST
-
If multiple found → use
AskUserQuestionwith multi-select: "Tee suunnitelma näille:"- If suggestions are clearly independent → allow multi-select
- If they have dependencies or are large → recommend one at a time in option descriptions
-
If one found → proceed directly
-
For each selected suggestion: a. Explore codebase to understand where changes are needed b. Generate plan:
## Toteutussuunnitelma: [title]
### Yhteenveto
[1-2 lausetta]
### Vaiheet
1. [ ] **[action]** - `path/to/file.tsx`
2. [ ] **[action]** - `path/to/file.tsx`
### Tietokantamuutokset
[migraatio tai "Ei tarvita"]
### Arvioitu laajuus
- Tiedostoja: [N]
- Vaikeusaste: [helppo/keskitaso/vaativa]
- Save plan (keep status as
in_progress):
UPDATE feature_suggestions
SET ai_implementation_plan = '[plan]',
ai_plan_generated_at = NOW(),
updated_at = NOW()
WHERE id = '[id]'
Step 4: Implement (/ehdota toteuta)
- Fetch in_progress/reviewed suggestions with plans:
SELECT id, title, description, category, ai_implementation_plan
FROM feature_suggestions
WHERE status = 'in_progress' AND ai_implementation_plan IS NOT NULL
ORDER BY priority ASC NULLS LAST
-
If none → "Ei suunniteltuja ehdotuksia. Aja
/ehdota suunnitelmaensin." -
If multiple → use
AskUserQuestionto let user pick ONE to implement (implementation is sequential). -
Present plan summary and ask confirmation:
Toteutetaanko ehdotus #[id]: [title]?
[plan summary]
- Assess complexity and delegate:
| Laajuus | Toimenpide |
|---------|------------|
| Pieni (1-2 tiedostoa) | Toteuta suoraan |
| Keskisuuri (uusi komponentti) | Kutsu brainstorming skill ensin |
| Laaja (arkkitehtuuri) | Kutsu code-guru + brainstorming |
- After implementation:
UPDATE feature_suggestions
SET status = 'implemented', updated_at = NOW()
WHERE id = '[id]'
Categories
ai, search, audio, social, reading, premium, admin, ux, community, content
Related Skills
| Skill | Milloin |
|-------|---------|
| brainstorming | Ennen uuden featuren toteutusta |
| code-guru | Arkkitehtuuripäätökset, package-rajat |
| supabase-migration-writer | Tietokantamuutokset |
| test-writer | Testit toteutuksen jälkeen |