ai-feature-template
Create new AI-powered features using xAI Grok. Use when user mentions "new AI feature", "add Grok", "create prompt", "AI analysis", or "generate with AI".
Best use case
ai-feature-template is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Create new AI-powered features using xAI Grok. Use when user mentions "new AI feature", "add Grok", "create prompt", "AI analysis", or "generate with AI".
Teams using ai-feature-template 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ai-feature-template/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ai-feature-template Compares
| Feature / Agent | ai-feature-template | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Create new AI-powered features using xAI Grok. Use when user mentions "new AI feature", "add Grok", "create prompt", "AI analysis", or "generate with AI".
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
# Creating AI Features with xAI Grok
This project uses xAI's Grok model for AI-powered features with X (Twitter) search capabilities.
## Instructions
1. **Create API route** at `app/api/<feature-name>/route.ts`
2. **Use this template for Grok with X search**:
```typescript
import { NextRequest, NextResponse } from 'next/server';
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
};
// Define your AI persona and instructions
const systemPrompt = `You are [PERSONA NAME], a [ROLE DESCRIPTION].
Your task is to [WHAT TO DO] based on the X account data.
Output Requirements:
- [REQUIREMENT 1]
- [REQUIREMENT 2]
- [FORMAT INSTRUCTIONS]
CRITICAL: Output ONLY the result. No preamble, no explanations.`;
export async function OPTIONS() {
return NextResponse.json(null, { headers: corsHeaders });
}
export async function POST(req: NextRequest) {
try {
const { handle } = await req.json();
const HANDLE_REGEX = /^[a-zA-Z0-9_]{1,15}$/;
if (!handle || !HANDLE_REGEX.test(handle)) {
return NextResponse.json(
{ error: 'Invalid X handle format.' },
{ status: 400, headers: corsHeaders }
);
}
const xaiApiKey = process.env.XAI_API_KEY;
if (!xaiApiKey) {
return NextResponse.json(
{ error: 'XAI_API_KEY not configured' },
{ status: 500, headers: corsHeaders }
);
}
// Build 6-month date range for X search
const today = new Date();
const toDate = today.toISOString().split('T')[0];
const sixMonthsAgo = new Date(today.getTime() - 182 * 24 * 60 * 60 * 1000);
const fromDate = sixMonthsAgo.toISOString().split('T')[0];
const response = await fetch('https://api.x.ai/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: `Bearer ${xaiApiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
// DO NOT CHANGE - grok-4-1-fast required for X search
model: 'grok-4-1-fast',
messages: [
{ role: 'system', content: systemPrompt },
{
role: 'user',
content: `Analyze @${handle}'s posts and [SPECIFIC INSTRUCTION].`,
},
],
search_parameters: {
mode: 'on',
sources: [{ type: 'x' }],
from_date: fromDate,
to_date: toDate,
},
}),
});
if (!response.ok) {
const errorText = await response.text();
console.error('xAI API error:', response.status, errorText);
return NextResponse.json(
{ error: `xAI API error: ${response.status}` },
{ status: response.status, headers: corsHeaders }
);
}
const data = await response.json();
const result = data.choices?.[0]?.message?.content;
if (!result) {
return NextResponse.json(
{ error: 'No result generated' },
{ status: 500, headers: corsHeaders }
);
}
return NextResponse.json({ result }, { headers: corsHeaders });
} catch (error) {
console.error('Error:', error);
return NextResponse.json(
{ error: error instanceof Error ? error.message : 'Unknown error' },
{ status: 500, headers: corsHeaders }
);
}
}
```
3. **Add frontend handler** in `app/page.tsx`:
```typescript
const handleNewFeature = async () => {
setIsLoading(true);
try {
const response = await fetch('/api/feature-name', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ handle: normalizedHandle }),
});
const data = await response.json();
if (!response.ok) throw new Error(data.error);
setResult(data.result);
toast.success('Generated!');
} catch (err) {
toast.error('Failed');
} finally {
setIsLoading(false);
}
};
```
## Existing AI Prompts (Reference)
| Feature | Persona | Output |
|---------|---------|--------|
| analyze-account | Art Director | 4-6 sentence image prompt |
| roast-account | Dr. Burn Notice | 300-400 word therapy letter |
| fbi-profile | FBI Analyst | Classified behavioral report |
## Prompt Best Practices
- Define clear persona with voice/tone
- Specify exact output format and length
- Include "Output ONLY..." to prevent preamble
- Add examples for complex outputs
- Use "CRITICAL RULES" section for must-follow instructions
## Examples
- "Create a horoscope generator" → New route with astrologer persona
- "Add personality summary" → New route with psychologist persona
## Guardrails
- Always use `grok-4-1-fast` model for X search capability
- Include 6-month date range for search parameters
- Never log or expose API keys
- Handle API errors gracefully with user-friendly messages
- Test prompts for safety/appropriateness before deployingRelated Skills
prioritize-python-3-10-features
Prioritizes the use of new features available in Python 3.12 and later versions.
plan-feature
Plan a new feature from concept to approved implementation plan. Activates Product Council for strategic evaluation, then Feature Council for technical planning. Produces a documented decision and scoped task breakdown. Use when starting any new feature work.
new-feature
Use when starting new feature development - sets up Agent Teams, gathers requirements, creates plan, implements with parallel agents, runs code review/QA/security checks, and commits with conventional commits
Implementing Features
Execute specification-driven implementation with automatic quality gates, multi-agent orchestration, and progress tracking. Use when building features from specs, fixing bugs with test coverage, or refactoring with validation.
genomic-feature-annotation
This skill is used to perform genomic feature annotation and visualization for any file containing genomic region information using Homer (Hypergeometric Optimization of Motif EnRichment). It annotates regions such as promoters, exons, introns, intergenic regions, and TSS proximity, and generates visual summaries of feature distributions. ChIPseeker mode is also supported according to requirements.
full-stack-orchestration-full-stack-feature
Use when working with full stack orchestration full stack feature
feature-status
Count features marked as @failing and write to status JSON file. Used to determine when the autonomous coding loop should end.
feature-investigation
[Investigation] Use when the user asks to investigate, explore, understand, explain, or analyze how an existing feature or logic works. Triggers on keywords like "how does", "explain", "what is the logic", "investigate", "understand", "where is", "trace", "walk through", "show me how".
feature-implementation
[Implementation] Use when the user asks to implement a new feature, enhancement, add functionality, build something new, or create new capabilities. Triggers on keywords like "implement", "add feature", "build", "create new", "develop", "enhancement".
feature-engineering
モデルの性能を向上させるために、既存のデータから新しい特徴量を作成する。
feature-dev-workflow
Complete end-to-end feature development workflow from issue tracking through PR delivery. Use for implementing features, building new functionality, and adding capabilities. Includes requirements discovery, architecture planning, implementation, testing, code review, design audit, and comprehensive validation.
feature-design-assistant
Turn ideas into fully formed designs and specs through natural collaborative dialogue. Use when planning new features, designing architecture, or making significant changes to the codebase.