AI Feature Implementation

Integrate AI capabilities like LLM calls, RAG pipelines, and prompt engineering. Use this skill when an AI-powered feature needs to be built or refined.

5 stars

Best use case

AI Feature Implementation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Integrate AI capabilities like LLM calls, RAG pipelines, and prompt engineering. Use this skill when an AI-powered feature needs to be built or refined.

Teams using AI Feature Implementation should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ai-feature/SKILL.md --create-dirs "https://raw.githubusercontent.com/BasharAmso/Bashi/main/.claude/skills/ai-feature/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ai-feature/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How AI Feature Implementation Compares

Feature / AgentAI Feature ImplementationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Integrate AI capabilities like LLM calls, RAG pipelines, and prompt engineering. Use this skill when an AI-powered feature needs to be built or refined.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Skill: AI Feature Implementation

## Metadata

| Field | Value |
|-------|-------|
| **Skill ID** | SKL-0009 |
| **Version** | 1.0 |
| **Owner** | builder |
| **Inputs** | Task description, PRD AI/ML section, DECISIONS.md, existing AI files |
| **Outputs** | AI service layer files, STATE.md updated |
| **Triggers** | `AI_FEATURE_REQUESTED` |

---

## Purpose

Build AI-powered features (LLM integrations, RAG pipelines, prompt engineering, agentic workflows) with production-grade reliability. Every AI integration handles failures, controls costs, and evaluates quality.

---

## Architecture Selection

| Use Case | Architecture |
|----------|-------------|
| Q&A over documents/data | RAG (Retrieval Augmented Generation) |
| Structured data extraction | Prompt engineering with JSON output mode |
| Multi-step automation | Agentic with tool use |
| Classification / routing | Classifier prompt or fine-tuned model |
| Chat / conversation | Stateful conversation with system prompt |
| Content generation | Prompt engineering with temperature control |

---

## Procedure

1. **Read PRD AI/ML Requirements** — extract what the AI does, model selection, performance thresholds, guardrails, cost model.
2. **Choose and confirm architecture** from the table above. Log to DECISIONS.md.
3. **Build AI service layer** in `src/services/ai/`:
   - `client.js` — model client setup, auth, retry config
   - `prompts/[feature].js` — all prompt templates (never inline)
   - `[feature]-service.js` — feature-specific AI logic
   - `guardrails.js` — input/output validation
4. **Non-negotiables:**
   - Pin model versions (e.g., `claude-sonnet-4-6`, not `claude-sonnet`)
   - Set explicit `temperature`, `max_tokens`, `top_p`
   - Handle all failure modes: rate limit (backoff), timeout, low confidence, model error
   - Log token usage per request; set `max_tokens` to minimum needed
   - Cache identical requests for cost reduction
5. **Implement guardrails:**
   - Input: validate length, check injection patterns, redact PII
   - Output: check confidence, validate schema, flag unsourced claims
   - Fallback hierarchy: retry simplified → rule-based → "I'm not sure" → never empty
6. **RAG (if applicable):** chunk docs (800-1200 tokens, 10-15% overlap), embed, retrieve top-K, instruct model to cite sources and say "I don't know" when context is insufficient.
7. **Write evaluation tests** — minimum 10-case golden set (expected outputs, must-not-contain).
8. **Document in `docs/AI.md`** — feature, model, architecture, cost estimate, fallback behavior.
9. **Update STATE.md.**

---

## Constraints

- Never uses floating model aliases — always pins versions
- Never puts prompts inline — always in dedicated prompt files
- Never ships without a fallback for model failure
- Never sends PII to external models without PRD authorization
- Always logs token usage — no AI feature without cost visibility
- Never sets max_tokens to unlimited

---

## Primary Agent

builder

---

## Definition of Done

- [ ] Model version pinned
- [ ] Temperature and max_tokens explicitly set
- [ ] Prompts in `/prompts/` directory
- [ ] Input and output guardrails implemented
- [ ] Fallback behavior defined and tested
- [ ] Token usage logged per request
- [ ] Cost controls in place
- [ ] Golden set evaluation test written (10+ cases)
- [ ] AI feature documented in docs/AI.md
- [ ] Architecture decision logged to DECISIONS.md
- [ ] STATE.md updated

## Output Contract

| Field | Value |
|-------|-------|
| **Artifacts** | AI service layer files (`src/services/ai/`), prompt templates (`prompts/`), guardrails, `docs/AI.md` |
| **State Update** | `.claude/project/STATE.md` — mark task complete, log files modified |
| **Decision Log** | `.claude/project/knowledge/DECISIONS.md` — AI architecture and model selection decisions |
| **Handoff Event** | `TASK_COMPLETED` (ready for code review) |

## Knowledge Enhancement (MCP mode)

If Cortex MCP is available:
1. Call `search_knowledge` with query derived from task (e.g., "RAG pipeline patterns", "prompt engineering best practices"), category="patterns"
2. If relevant results found, call `get_fragment` on the top result
3. Apply as supplementary context (does not override this skill's procedure)

Related Skills

Supply Chain Audit

5
from BasharAmso/Bashi

Audit the dependency supply chain for security risks beyond what `npm audit` or `pip audit` catches. Analyzes dependency health, maintainer trust signals, typosquatting risk, and transitive dependency exposure.

SEO Audit

5
from BasharAmso/Bashi

Audit web pages for search engine optimization: meta tags, heading hierarchy, structured data, image optimization, mobile-friendliness, and content quality. Complements SKL-0013 (Growth & Distribution) by validating what was built.

Pitch Deck

5
from BasharAmso/Bashi

Create a structured pitch deck outline for investors, stakeholders, or partners. Covers problem, solution, market, traction, team, and ask. Natural output after PRD + Problem Stress Test validation.

Launch Checklist

5
from BasharAmso/Bashi

Pre-launch validation covering everything deployment (SKL-0021) doesn't: analytics, error tracking, social meta, legal pages, email setup, DNS, SSL, and go-live readiness. Produces a launch readiness report with pass/fail checklist. Use this skill before going live on any project.

Insecure Defaults Detection

5
from BasharAmso/Bashi

Detect insecure default configurations, hardcoded credentials, fail-open security patterns, and dangerous default values in application code and configuration files. Complements SKL-0015 (Security Audit) by focusing on configuration-level vulnerabilities that dependency scanners miss.

Differential Security Review

5
from BasharAmso/Bashi

Security-focused review of code changes using git diff analysis. Identifies security implications of recent modifications — new attack surfaces, removed protections, changed auth logic, and risky refactors. Complements SKL-0016 (Code Review) with a security lens on diffs.

Copywriting

5
from BasharAmso/Bashi

Write conversion-focused copy using proven frameworks (AIDA, PAS, BAB). Produces headlines, CTAs, landing page copy, email sequences, and micro-copy. Ensures copy matches brand voice and target audience.

Competitor Analysis

5
from BasharAmso/Bashi

Structured competitor research: features, pricing, positioning, gaps, and differentiation strategy. Feeds into PRD Writing (SKL-0004) and Problem Stress Test (SKL-0027) with better market context.

UX Design

5
from BasharAmso/Bashi

Design user experiences including wireframes, flows, and interaction patterns. Use this skill when UX design work is requested, including onboarding flows and interface layouts.

User Acceptance Testing

5
from BasharAmso/Bashi

Structured QA testing with four modes: diff-aware (auto-scoped to branch changes), full (systematic exploration), quick (30-second smoke test), and regression (compare against baseline). Produces health score, structured reports, and actionable bug lists. Use this skill when UAT is requested or a feature is ready for acceptance testing.

Token Audit

5
from BasharAmso/Bashi

Audit the current project for token waste patterns. Produces a Token Health Report with scored findings and actionable fixes. Use this skill when token usage feels high, sessions are hitting limits, or before optimizing costs.

Test Writing

5
from BasharAmso/Bashi

Write automated tests for existing or new functionality. Use this skill when tests are requested, including unit tests, integration tests, and end-to-end tests.