AI Feedback Coder
Automates coding feedback items marked as ai_code in public.app_feedback.
Workflow
1. Query ai_code feedbacks
Use mcp__plugin_supabase_supabase__execute_sql with project ID iryqgmjauybluwnqhxbg:
SELECT * FROM public.app_feedback
WHERE status = 'ai_code'
ORDER BY created_at ASC
LIMIT 1;
2. If none found
Report "No ai_code feedbacks remaining" and stop.
3. Count remaining
SELECT count(*) FROM public.app_feedback WHERE status = 'ai_code';
4. Fetch comments
SELECT * FROM public.feedback_comments
WHERE feedback_id = '<id>'
ORDER BY created_at ASC;
5. Build context block
Assemble all feedback fields into a structured context:
- id, system_id, feedback_type, subject, message
- satisfaction_rating, email, allow_contact
- status, admin_notes, promoted_idea_id
- page_url, user_agent, browser_history
- kipina_id, created_at
- All comments (message, is_internal, created_at)
The system_id field tells which app the feedback concerns — see src/lib/systems.ts for the app registry.
6. Announce and present plan
Tell the user:
Palaute: [subject or message truncated to ~80 chars] Tyyppi: [feedback_type] | Sovellus: [system_id] | Jaljella: N kpl
Suunnitelma:
- [Konkreettinen askel 1 — esim. "Muokkaa ComponentX.tsx: lisaa null-tarkistus"]
- [Konkreettinen askel 2]
- ...
Tiedostot joihin koskee: file1.tsx, file2.ts
MANDATORY — always present this plan and wait for user confirmation using the AskUserQuestion tool before proceeding.
Use AskUserQuestion with these options:
- "Jatka" (description: "Toteuta suunnitelma sellaisenaan")
- "Anna lisäohjetta" (description: "Muokkaa suunnitelmaa ennen toteutusta")
- "Peruuta" (description: "Ohita tämä palaute, merkitse luetuksi")
Handle the response:
- Jatka → proceed to step 7
- Anna lisäohjetta → user types instructions via "Other" → adjust plan and re-present with AskUserQuestion again
- Peruuta → mark feedback as
readinstead offixedand stop - Other (free text) → treat as instructions, adjust plan and re-present
To build a good plan, use the Explore agent or Grep/Glob to find the relevant files before presenting. The plan should be concrete enough that the user can judge if the approach is correct.
7. Route to the right implementation skill
After user approves the plan, invoke the appropriate skill(s) directly based on what the feedback requires. Do NOT delegate to using-superpowers — route directly.
Routing table
| Feedback concerns | Invoke skill | Context to pass |
|-------------------|-------------|-----------------|
| Bug / unexpected behavior | systematic-debugging | Error description, reproduction steps, page_url |
| UI / layout / component issue | frontend-design | Component name, expected vs actual behavior |
| Admin panel issue | admin-panel-builder | Admin page, tab, what's broken/missing |
| Database / RLS / migration needed | supabase-migration-writer | Table, operation, expected behavior |
| Edge Function issue | edge-function-generator | Function name, error, expected behavior |
| AI feature / prompt issue | ai-prompt-manager | Feature name, prompt, expected behavior |
| Idea Machina specific | idea-machina | Evolution stage, component, issue |
| Practice / gamification | practice-gamification | Practice type, scheduling, completion |
| New feature (general) | brainstorming first, then implementation skill | Full feedback context + plan |
| Type errors / Supabase types | supabase-typing-architect | File, type error, schema |
| i18n / translation | language-specialist | Missing key, language, component |
| Performance | performance-auditor | Slow query, component, metric |
Multiple skills may apply. For example, a feature request may need brainstorming → supabase-migration-writer → frontend-design. Run them in sequence.
If the feedback doesn't clearly match any skill, use code-guru for general implementation guidance.
8. Update feedback status
MANDATORY — always run after implementation, even if implementation was partial:
UPDATE public.app_feedback SET status = 'fixed' WHERE id = '<id>';
9. Add admin comment documenting what was done
MANDATORY — write a concise Finnish summary of every change made (files modified, features added, bugs fixed). This is the audit trail.
INSERT INTO public.feedback_comments (feedback_id, user_id, message, is_internal)
VALUES (
'<id>',
COALESCE(
(SELECT id FROM auth.users ORDER BY created_at ASC LIMIT 1),
'<feedback-user_id>'
),
'AI-toteutettu: <1-3 lauseen yhteenveto tehdyistä muutoksista, esim. "Korjattu sidebar-komponentin renderöintiongelma. Muokattu sidebar.tsx: lisätty null-tarkistus props-arvoille.">',
true
);
The comment message must include:
- What was changed (file names or component names)
- Why (link back to the feedback problem)
- Keep it under 300 characters
10. Report and continue
Report the final count, then use AskUserQuestion to offer continuing:
- "Seuraava" (description: "Hae ja käsittele seuraava ai_code-palaute") — this must be the first option so Enter accepts it
- "Lopeta" (description: "Lopeta palautekierros")
If user picks "Seuraava", go back to step 1. If "Lopeta", stop.
Data Models
app_feedback (public schema)
| Field | Type | Notes | |-------|------|-------| | id | uuid | PK | | user_id | text | nullable | | system_id | text | e.g. 'raamattu-nyt', 'idea-machina' | | feedback_type | text | 'bug', 'feature', 'general', 'question' | | subject | text | nullable | | message | text | required | | satisfaction_rating | int | 1-5, nullable | | email | text | nullable | | allow_contact | boolean | | | status | text | 'new', 'read', 'handled', 'fixed', 'ai_fix', 'ai_code', 'idea', 'idea_implemented' | | admin_notes | text | nullable | | promoted_idea_id | text | nullable, FK to feature_suggestions | | kipina_id | text | nullable | | page_url | text | nullable | | user_agent | text | nullable | | browser_history | jsonb | nullable | | created_at | timestamptz | |
feedback_comments (public schema)
| Field | Type | Notes | |-------|------|-------| | id | uuid | PK | | feedback_id | uuid | FK to app_feedback.id | | user_id | text | | | message | text | | | is_internal | boolean | | | created_at | timestamptz | |
Configuration
- Supabase project ID:
iryqgmjauybluwnqhxbg - Tool:
mcp__plugin_supabase_supabase__execute_sql