add-feature

Scaffold complete feature with types, repository, API routes, components, store actions, and tests. Use when adding major new functionality like water tracking, sleep tracking, etc.

181 stars

Best use case

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

Scaffold complete feature with types, repository, API routes, components, store actions, and tests. Use when adding major new functionality like water tracking, sleep tracking, etc.

Teams using add-feature 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/add-feature/SKILL.md --create-dirs "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/data/add-feature/SKILL.md"

Manual Installation

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

How add-feature Compares

Feature / Agentadd-featureStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Scaffold complete feature with types, repository, API routes, components, store actions, and tests. Use when adding major new functionality like water tracking, sleep tracking, etc.

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

# Add Feature

Scaffold a complete feature including types, database layer, API routes, UI components, state management, and tests.

## Usage

When user requests to add a new major feature, ask for:

1. **Feature name** (e.g., "Water Tracking", "Sleep Logging", "Weight Management")
2. **Feature description** (what data it tracks, why it matters)
3. **Data fields** needed (with types and validation rules)
4. **Dashboard components** needed (card, chart, statistics)
5. **Forms needed** (input forms, edit forms)
6. **Daily summary impact** (whether it affects health score, true/false)

## Implementation Process

This skill orchestrates the following steps:

### Step 1: Create TypeScript Types

Create file: `src/lib/types/{featureName}.ts`

```typescript
export interface FeatureEntity {
  id: string;
  date: string;
  field1: string;
  field2: number;
  createdAt: string;
}

// Validation schema types (for API)
export type FeatureInput = Omit<FeatureEntity, 'id' | 'createdAt'>;
```

### Step 2: Create Repository

Use `/generate-repository` skill to create:

- `src/lib/database/repositories/featureRepository.ts`
- CRUD methods
- Date-based queries

### Step 3: Create API Routes

Use `/generate-api-route` skill to create:

- `src/app/api/feature/route.ts`
- POST handler (create)
- DELETE handler (delete)
- Daily summary recalculation (if applicable)

### Step 4: Create Store Actions

Use `/generate-store-action` skill to add to `src/lib/store/healthStore.ts`:

- State property for feature data
- fetchFeature() action
- addFeature() action
- deleteFeature() action

### Step 5: Create Dashboard Card

Use `/generate-card` skill to create:

- `src/components/dashboard/{FeatureName}Card.tsx`
- Display key metrics
- Show trends or statistics
- Optional: Recharts integration

### Step 6: Create Input Form

Use `/generate-form` skill to create:

- `src/components/forms/{FeatureName}Form.tsx`
- Form fields for data entry
- Validation logic
- Store action integration

### Step 7: Create Tests

Use `/generate-test` skill to create:

- `src/__tests__/lib/database/repositories/{FeatureName}.test.ts`
- `src/__tests__/components/forms/{FeatureName}Form.test.tsx`
- `src/__tests__/app/api/feature/route.test.ts`

### Step 8: Update Dashboard Layout

Edit: `src/app/page.tsx` or `src/components/layout/MainLayout.tsx`

- Import new card component
- Add to dashboard grid
- Position appropriately

### Step 9: Update Navigation (if needed)

If feature has dedicated page:

- Create `src/app/feature/page.tsx`
- Create full page component
- Update navigation in Sidebar

### Step 10: Database Schema Update

Add to: `src/lib/database/schema.sql`

- Create new table
- Define columns with types
- Add indexes for common queries

## Full Feature Example: Water Tracking

### 1. Types (`src/lib/types/water.ts`)

```typescript
export interface WaterLog {
  id: string;
  date: string;
  amount: number; // in ml
  time: string; // HH:MM format
  source: 'water' | 'beverage' | 'food';
  createdAt: string;
}

export type WaterInput = Omit<WaterLog, 'id' | 'createdAt'>;
```

### 2. Repository → `/generate-repository`

- Entity: WaterLog
- Table: water_logs
- Methods: addWaterLog, getWaterLogsByDate, deleteWaterLog

### 3. API Routes → `/generate-api-route`

- POST /api/water → create water log
- DELETE /api/water?id=X → delete water log
- Daily summary recalculation: YES

### 4. Store Actions → `/generate-store-action`

```typescript
interface HealthState {
  waterLogs: WaterLog[];
  fetchDailyWaterLogs: (date: string) => Promise<void>;
  addWaterLog: (log: WaterInput) => Promise<void>;
  deleteWaterLog: (id: string) => Promise<void>;
}
```

### 5. Dashboard Card → `/generate-card`

- Card name: WaterIntakeCard
- Displays: Total ml today, Target vs actual, Timeline of entries
- Icon: Droplets
- Optional chart: Hourly water intake

### 6. Input Form → `/generate-form`

- Form name: WaterLogForm
- Fields: Amount (number), Time (time picker), Source (select)
- List: Shows today's water entries with ability to remove

### 7. Tests → `/generate-test`

- Repository tests: CRUD operations
- Form tests: Validation, submission
- API tests: POST, DELETE handlers

### 8. Update Dashboard

Add WaterIntakeCard to dashboard grid

## Key Considerations

### Database Schema

```sql
CREATE TABLE IF NOT EXISTS water_logs (
  id TEXT PRIMARY KEY,
  date TEXT NOT NULL,
  amount INTEGER NOT NULL,
  time TEXT NOT NULL,
  source TEXT NOT NULL,
  created_at TEXT NOT NULL,
  UNIQUE(date, time, source)
);

CREATE INDEX idx_water_logs_date ON water_logs(date);
```

### Health Score Integration

If feature impacts health score:

- Update `calculateHealthScore()` in `src/lib/utils/healthScoring.ts`
- Update daily summary calculation in `DailySummaryRepository`
- Document scoring formula

### Migrations

Document any schema changes needed:

- Create migration file or script
- Add instructions to DEVELOPMENT.md

## Checklist

Complete feature should have:

- [ ] TypeScript types defined
- [ ] Database repository with CRUD
- [ ] API routes (POST, DELETE, GET)
- [ ] Zustand store actions
- [ ] Dashboard card component
- [ ] Input/edit forms
- [ ] Comprehensive tests
- [ ] Dashboard integration
- [ ] Database schema
- [ ] Optional: dedicated page
- [ ] Documentation updated (if major feature)

## Coordination with Other Skills

This skill uses:

1. `/generate-repository` - for data access
2. `/generate-api-route` - for API endpoints
3. `/generate-store-action` - for state management
4. `/generate-card` - for dashboard widgets
5. `/generate-form` - for data entry
6. `/generate-test` - for test coverage

Each sub-skill handles a specific layer of the feature.

## Best Practices

1. **Start with types** - Define data structure first
2. **Database first** - Create repository before using in API
3. **API routes next** - Implement endpoints before UI
4. **Store actions** - Wire up state management before components
5. **UI components** - Build forms and cards
6. **Tests throughout** - Write tests for each layer
7. **Integration** - Add to dashboard and navigation
8. **Documentation** - Update relevant docs

## Output Structure

After using this skill, project structure should look like:

```
src/
├── lib/
│   ├── types/
│   │   └── waterTracking.ts
│   └── database/repositories/
│       └── waterTrackingRepository.ts
├── app/
│   └── api/
│       └── water/
│           └── route.ts
├── components/
│   ├── dashboard/
│   │   └── WaterIntakeCard.tsx
│   └── forms/
│       └── WaterLogForm.tsx
└── __tests__/
    ├── lib/
    │   └── database/repositories/
    │       └── WaterTracking.test.ts
    ├── components/
    │   └── forms/
    │       └── WaterLogForm.test.tsx
    └── app/
        └── api/water/
            └── route.test.ts
```

## Implementation Checklist

- [ ] Request feature details from user
- [ ] Create TypeScript types
- [ ] Generate repository
- [ ] Generate API routes
- [ ] Generate store actions
- [ ] Generate dashboard card
- [ ] Generate form component
- [ ] Generate tests
- [ ] Update dashboard integration
- [ ] Update navigation (if page)
- [ ] Verify TypeScript compilation
- [ ] Run tests
- [ ] Commit changes with proper messages

Related Skills

advanced-features

181
from majiayu000/claude-skill-registry

Implement advanced task features - Priorities, Tags, Due Dates, Reminders, Recurring Tasks, Search, Filter, and Sort. Use when adding Phase 5 advanced functionality. (project)

advanced-features-2025

181
from majiayu000/claude-skill-registry

Advanced 2025 Claude Code plugin features. PROACTIVELY activate for: (1) Agent Skills with progressive disclosure (2) Hook automation (PreToolUse, PostToolUse, etc.) (3) MCP server integration (4) Repository-level configuration (5) Team plugin distribution (6) Context efficiency optimization Provides cutting-edge plugin capabilities and patterns.

Addon/Feature System Development Guide

181
from majiayu000/claude-skill-registry

**Version:** 1.0

add-new-feature

181
from majiayu000/claude-skill-registry

No description provided.

add-feature-hook

181
from majiayu000/claude-skill-registry

Creates TanStack Query hooks for API features with authentication. Use when connecting frontend to backend endpoints, creating data fetching hooks.

meta:cli-feature-creator

181
from majiayu000/claude-skill-registry

CLI Feature Creator wizard for adding new aaa CLI commands. Use when user asks to "add aaa command", "create CLI feature", "add CLI command", or needs to extend the aaa CLI with new functionality.

correlation-methylation-epiFeatures

181
from majiayu000/claude-skill-registry

This skill provides a complete pipeline for integrating CpG methylation data with chromatin features such as ATAC-seq signal, H3K27ac, H3K4me3, or other histone marks/TF signals.

1k-feature-guides

181
from majiayu000/claude-skill-registry

Feature development guides for OneKey. Use when adding new chains, socket events, notifications, pages, or routes. Covers blockchain integration, WebSocket subscriptions, push notifications, and navigation patterns.

genomic-feature-annotation

181
from majiayu000/claude-skill-registry

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.

Clarify Epic/Feature/UserStory/Task ticketing guidance in SKILL

181
from majiayu000/claude-skill-registry

No description provided.

whisper-transcribe

159
from majiayu000/claude-skill-registry

Transcribes audio and video files to text using OpenAI's Whisper CLI, enhanced with contextual grounding from local markdown files for improved accuracy.

Media Processing

vly-money

159
from majiayu000/claude-skill-registry

Generate crypto payment links for supported tokens and networks, manage access to X402 payment-protected content, and provide direct access to the vly.money wallet interface.

Fintech & CryptoClaude