ai-feature-spec/SKILL.md
Design a single AI-powered feature end-to-end — model selection, prompt engineering, context window, output schema, fallback behaviour, human oversight, and UX integration. Invoke for each opportunity identified in ai-opportunity-canvas.
npx skillsauth add peterbamuhigire/skills-web-dev ai-feature-specInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ai-feature-spec or would be better handled by a more specific companion skill.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.Produce a complete, implementation-ready blueprint for one AI-powered feature. This is the specification artifact that drives both development and the AI Integration Section of the SRS/HLD.
Invoke this skill: Once per AI opportunity, after ai-opportunity-canvas has ranked it.
## AI Feature Blueprint: [Feature Name]
**Feature ID:** AI-[NNN]
**Module:** [Parent module]
**Pattern:** [From the 10 patterns in ai-opportunity-canvas]
**AI Module Tier:** Starter / Growth / Enterprise
**Status:** Draft / Approved
### 1. Business Goal
[One sentence: what user problem this solves and the measurable outcome]
### 2. Trigger
[What event or user action initiates the AI call]
- User-initiated: [button click / form submit / page load]
- System-initiated: [scheduled job / data change event]
### 3. Model Selection
[Selected model and rationale — see Model Selection Guide below]
### 4. Input Context
[Exactly what data is assembled and sent to the model]
- System prompt: [purpose and persona]
- Data injected: [table names, field names, row limits]
- Max input tokens: [number]
### 5. Output Schema
[Exact structure the model must return]
- Format: JSON / Markdown / Plain text
- Schema: [field names, types, constraints]
- Validation: [how output is checked before showing to user]
### 6. Prompt Design
[The system prompt text — production-ready]
### 7. Fallback Behaviour
[What the system does if the AI call fails, times out, or returns invalid output]
### 8. Human Oversight
[When a human must review before action is taken]
### 9. Token Estimate
[Input tokens per call, output tokens per call — feeds ai-cost-modeling]
### 10. UX Integration
[Where result appears, loading state, streaming vs batch, feedback mechanism]
Choose the cheapest model that reliably handles the task.
| Task Complexity | Recommended Model | Fallback | |----------------|-------------------|---------| | Summarisation, classification, short extraction | Claude Haiku 4.5 / Gemini 2.0 Flash / GPT-4o mini | DeepSeek V3 | | Multi-step reasoning, structured JSON output, analysis | Claude Sonnet 4.6 / GPT-4o | Claude Haiku 4.5 | | Complex document analysis, long context (> 50K tokens) | Claude Sonnet 4.6 (200K context) | Gemini 1.5 Pro | | Image / document OCR + extraction | Claude Sonnet 4.6 / GPT-4o Vision | Gemini 2.0 Flash | | Cost-critical, high volume (> 1,000 calls/day) | DeepSeek V3 / Gemini 2.0 Flash | GPT-4o mini |
Rule: Always start with the cheapest adequate model. Upgrade only when output quality is demonstrably insufficient.
Provider abstraction: Always code against a provider-agnostic interface so the model can be swapped without rewriting feature logic. See ai-architecture-patterns.
You are [role] for [system name].
Your task: [one precise sentence].
Output format: [JSON schema / markdown structure / plain text].
Constraints:
- [constraint 1]
- [constraint 2]
Language: [English / Luganda / Swahili — match user locale]
ai-security for PII scrubbing rules.Examples:
Input: "Paid via MoMo on 15 March" → Category: "Mobile Money Payment"
Input: "Returned goods, credit note issued" → Category: "Credit Note"
Input: [user_input] → Category:
For structured outputs, always use JSON with a validation step before displaying to users.
Example — Predictive Alert:
{
"alert_level": "high|medium|low",
"summary": "string (max 100 chars)",
"reason": "string (max 300 chars)",
"recommended_action": "string (max 200 chars)",
"confidence": "high|medium|low",
"data_points_used": ["string"]
}
Validation rule: If the model returns an unparseable response or a field fails its constraint, log the failure, return the fallback, and flag for review. Never display raw model output directly.
| Failure Mode | Fallback Action | |--------------|----------------| | API timeout (> 10s) | Show cached last result with timestamp; offer retry | | Invalid JSON output | Log error, show "Analysis unavailable — try again" | | Budget exceeded (gate blocked) | Show "AI module limit reached — contact admin" | | Model returns refusal | Show neutral placeholder; do not expose model refusal text to end user | | API provider outage | Queue the request, process when restored; notify user |
Apply oversight based on action severity:
| Decision Type | Oversight Level | |--------------|----------------| | Display only (summary, report) | None — show directly | | Suggestion (recommend reorder) | Soft — user can accept/dismiss | | Action with cost (send alert, flag account) | Hard — require explicit confirm | | Irreversible action (delete, blacklist, approve loan) | Mandatory human approval gate |
Input tokens = system_prompt_tokens
+ injected_data_tokens
+ user_query_tokens
Output tokens = expected_response_tokens
Total per call = input + output
Calls per user per day = [estimate from use case]
Monthly tokens per user = total_per_call × calls/day × 30
Feed these numbers into ai-cost-modeling for cost and pricing calculations.
See also:
ai-opportunity-canvas — Source of AI features to specai-cost-modeling — Token cost and pricing from estimates hereai-architecture-patterns — Provider abstraction and gate implementationai-security — PII rules and output sanitisationai-ux-patterns — UX for loading, streaming, feedbackdata-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...