add-feature

Scaffold a new toggleable feature with full structure, storage, API exposure, and bootstrap registration

16 stars

Best use case

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

Scaffold a new toggleable feature with full structure, storage, API exposure, and bootstrap registration

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/diegosouzapw/awesome-omni-skill/main/skills/backend/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 a new toggleable feature with full structure, storage, API exposure, and bootstrap registration

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 Skill

## Usage
```
/add-feature <featureName>
```

---

## Step 1: Ask Questions

Before creating files, gather this information:

### 1. Game Data (CRITICAL)
```
Does this feature need game data?

A) Static data → MGData
B) Real-time state → Globals
C) Both → MGData + Globals
D) None
```

**If A or C (Static data), specify which:**
```
[ ] Plants - definitions, growth stages, harvest data
[ ] Items - definitions, categories, properties
[ ] Pets - definitions, abilities, stats
[ ] Mutations - definitions, effects
[ ] Shops - configurations (not stock)
[ ] Recipes - crafting recipes
[ ] Other: ___________
```

**If B or C (Real-time), specify which:**
```
[ ] currentTile - player's current tile
[ ] myGarden - player's garden state
[ ] myInventory - player's inventory
[ ] myPets - player's pets
[ ] players - other players in room
[ ] shops - current shop stock
[ ] weather - current weather
[ ] gameMap - full map data
[ ] Other: ___________
```

### 2. UI Type
```
A) Gemini HUD only - UI in Gemini overlay
B) Game UI injection - Modifies existing game UI (src/ui/inject/qol/<name>/)
C) Both - Feature logic + game UI injection
D) No UI - Backend/logic only
```

### 3. Sprites (if UI selected)
```
Does the UI need game sprites?

A) Yes → MGSprite.show() / MGSprite.toCanvas()
B) No - Text/icons only

If A, which types?
[ ] Plant sprites  [ ] Item sprites  [ ] Pet sprites
[ ] Cosmetic sprites  [ ] Tile sprites  [ ] Other: ___
```

### 4. UI Components (if UI selected)
```
Does the UI need existing components?
→ REUSE, never recreate!

[ ] ArcadeButton, GeminiIconButton → Buttons
[ ] Modal → Dialogs/popups
[ ] ProgressBar → Progress indicators
[ ] SegmentedControl → Tab-like selection
[ ] Tab → Tabs
[ ] SoundPicker → Audio selection
[ ] Other from src/ui/components/
```

### 5. Module Dependencies
```
[ ] MGCalculators - XP, prices, growth time calculations
[ ] MGCosmetic - Player cosmetic data
[ ] MGTile - Map/tile utilities
[ ] MGAudio - Sound effects, notifications
[ ] MGShopActions - Buy/sell operations
[ ] MGEnvironment - World/environment data
[ ] None
```

### 6. WebSocket
```
A) Outgoing actions - Sends messages (api.ts)
B) Incoming handlers - Reacts to server messages
C) Middleware - Intercept/block/modify outgoing messages
D) Multiple (specify which)
E) None
```

**If C (Middleware), specify:**
```
[ ] Intercept specific message types
[ ] Modify payload before sending
[ ] Block messages based on conditions
[ ] Log/track outgoing messages
Which message types? ___________
```

### 7. Brief Description
```
One sentence for documentation:
```

---

## Step 2: Create Structure

```
src/features/<featureName>/
├── types.ts        # Config, constants, types
├── state.ts        # Storage operations
├── index.ts        # Public API (MG<FeatureName>)
├── logic/
│   └── core.ts     # Business logic
├── ui.ts           # (if HUD UI)
├── handler.ts      # (if incoming WS)
└── middleware.ts   # (if WS middleware)
```

### Naming Conventions
- Folder: `camelCase` → `src/features/autoHarvest/`
- Public API: `MG<PascalCase>` → `MGAutoHarvest`
- Storage key: `SCREAMING_SNAKE` → `AUTO_HARVEST`
- Storage value: `feature:<camelCase>:config` → `feature:autoHarvest:config`

### File Responsibilities

| File | Purpose |
|------|---------|
| `types.ts` | Config interface with `enabled: boolean`, `STORAGE_KEY`, `DEFAULT_CONFIG` |
| `state.ts` | `loadConfig()`, `saveConfig()`, `updateConfig()` |
| `index.ts` | `MG<Name>` with `init`, `destroy`, `isEnabled`, `setEnabled` |
| `logic/core.ts` | `start()`, `stop()`, `cleanups[]` array |
| `ui.ts` | HUD components (reuse existing!) |
| `handler.ts` | `registerHandlers()` for incoming WS |
| `middleware.ts` | `registerFeatureMiddleware()`, `unregisterFeatureMiddleware()` |

**Read existing features for templates:** `src/features/*/`

---

## Step 3: Register

### A) Storage key → `src/utils/storage.ts`
```typescript
export const FEATURE_KEYS = {
    // ... existing
    <FEATURE_NAME>: 'feature:<featureName>:config',
} as const;
```

### B) Export → `src/features/index.ts`
```typescript
export { MG<FeatureName> } from './<featureName>';
export type { <FeatureName>Config } from './<featureName>';
```

### C) API → `src/api/index.ts`
```typescript
import { MG<FeatureName> } from "../features/<featureName>";

Features: {
    <FeatureName>: MG<FeatureName>,
}
```

### D) Bootstrap → `src/ui/loader/bootstrap.ts`
```typescript
import { MG<FeatureName> } from "../../features/<featureName>";

{ name: "<FeatureName>", init: () => MG<FeatureName>.init() }
```

### E) Game UI injection (if applicable)
Create structure in `src/ui/inject/qol/<featureName>/`:
```
├── index.ts       # init(), destroy(), isEnabled()
├── inject.ts      # DOM injection logic
├── styles.css.ts  # Scoped styles
└── state.ts       # (optional)
```

---

## Step 4: Key Patterns

### Using Globals (reactive state)
```typescript
import { getMyInventory } from '../../../globals/variables/myInventory';

const cleanups: (() => void)[] = [];

function start(): void {
    const unsub = getMyInventory().subscribe((inventory) => {
        // React to changes
        onInventoryChange(inventory);
    });
    cleanups.push(unsub);
}

function stop(): void {
    cleanups.forEach(fn => fn());
    cleanups.length = 0;
}
```

### Using Middleware
```typescript
import { registerMiddleware } from '../../websocket/middlewares/registry';

let unregister: (() => void) | null = null;

export function registerFeatureMiddleware(): void {
    if (unregister) return;
    unregister = registerMiddleware((message) => {
        // Return message (pass), modified message, or null (block)
        return message;
    });
}

export function unregisterFeatureMiddleware(): void {
    unregister?.();
    unregister = null;
}
```

### UI with existing components
```typescript
import { createArcadeButton, createProgressBar } from '../../ui/components';

function buildUI(container: HTMLElement): void {
    const button = createArcadeButton({ label: 'Action', onClick: handleClick });
    const progress = createProgressBar({ value: 0, max: 100 });

    container.appendChild(button.root);
    container.appendChild(progress.root);

    // Track for cleanup
    cleanups.push(() => {
        button.destroy();
        progress.destroy();
    });
}
```

---

## Step 5: Validate

### Structure
- [ ] `types.ts` with `enabled: boolean` in config
- [ ] `index.ts` exports `MG<FeatureName>`
- [ ] Public API: `init`, `destroy`, `isEnabled`, `setEnabled`
- [ ] `logic/` folder for business logic

### Lifecycle
- [ ] `init()` is idempotent (safe to call multiple times)
- [ ] `destroy()` cleans up ALL resources
- [ ] No side effects on import
- [ ] Uses `FEATURE_KEYS` (not `MODULE_KEYS`)

### Game Data (NEVER hardcode!)
- [ ] Static data → `MGData.get('plants'/'items'/'pets'/...)`
- [ ] Sprites → `MGSprite.show()` / `MGSprite.toCanvas()`
- [ ] Calculations → `MGCalculators`
- [ ] Real-time → Globals with `.subscribe()` + unsubscribe in cleanup

### UI (if applicable)
- [ ] Reuses existing components (never recreate Button, Modal, etc.)
- [ ] Child components' `destroy()` called in cleanup
- [ ] Uses CSS variables (no hardcoded colors)
- [ ] If injection: fully removes DOM on destroy

### WebSocket (if applicable)
- [ ] Actions via `websocket/api.ts` only
- [ ] Handlers via `registerHandler()`
- [ ] Middleware returns `message` or `null`, never throws
- [ ] Middleware unregisters on `destroy()`
- [ ] Message types from `protocol.ts` enums

### Registration
- [ ] Storage key in `src/utils/storage.ts`
- [ ] Export in `src/features/index.ts`
- [ ] Exposed in `src/api/index.ts`
- [ ] Initialized in `src/ui/loader/bootstrap.ts`

---

## References

- Rules: `.claude/rules/features.md`, `.claude/rules/core.md`
- Existing features: `src/features/*/`
- Modules: `src/modules/*/` (MGData, MGSprite, MGCalculators, etc.)
- Globals: `src/globals/variables/`
- WebSocket: `src/websocket/` (api.ts, middlewares/, handlers/)
- UI Components: `src/ui/components/`
- UI Injection: `src/ui/inject/qol/`, `.claude/rules/ui/ui.inject.md`

Related Skills

feature

16
from diegosouzapw/awesome-omni-skill

Creates a new feature module with minimal viable structure. Use when bootstrapping a new feature from scratch, scaffolding the Tuist module, Container, Feature entry point, DeepLinkHandler, and initial screen with placeholder Text view. Includes all unit tests, mocks, stubs, and app integration. For adding domain/data layers afterward, use /datasource, /repository, /usecase. For enhancing views, use /view, /viewmodel, /navigator.

Data Engineering Data Driven Feature

16
from diegosouzapw/awesome-omni-skill

World-class data science skill for statistical modeling, experimentation, causal inference, and advanced analytics. Expertise in Python (NumPy, Pandas, Scikit-learn), R, SQL, statistical methods, A/B testing, time series, and business intelligence. Includes experiment design, feature engineering, model evaluation, and stakeholder communication.

implement-feature

16
from diegosouzapw/awesome-omni-skill

Implementa feature nel sistema di fatturazione italiana validando contro normativa fiscale. Usa per aggiungere calcoli IVA, ritenuta d'acconto, split payment, imposta di bollo, gestione fatture PA, regime forfettario, numerazione progressiva, note di credito, o qualsiasi logica che deve rispettare DPR 633/72, DPR 600/73, DPR 642/72. NON usare per bug fix tecnici, refactoring, o modifiche UI senza impatto fiscale.

fullstack-feature

16
from diegosouzapw/awesome-omni-skill

Load PROACTIVELY when task involves building a complete feature across multiple layers. Use when user says "build a feature", "add user profiles", "create a dashboard", or any request spanning database, API, UI, and tests. Orchestrates multi-agent work sequentially: schema and migrations, API endpoints, UI components, tests, and review. The runtime engine handles WRFC chains automatically via <gv> directives. Handles dependency ordering and cross-layer type sharing.

commit-feature

16
from diegosouzapw/awesome-omni-skill

Stage changes, create conventional commit (no co-author), push to origin, and add detailed PR comment with session context

api_feature

16
from diegosouzapw/awesome-omni-skill

Imported skill api_feature from openai

add-feature-hook

16
from diegosouzapw/awesome-omni-skill

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

Agentic Feature Design

16
from diegosouzapw/awesome-omni-skill

Designing features for the "Action Era" that are AI-accessible by default

AgentDB Advanced Features

16
from diegosouzapw/awesome-omni-skill

Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

mcp-create-declarative-agent

16
from diegosouzapw/awesome-omni-skill

Skill converted from mcp-create-declarative-agent.prompt.md

MCP Architecture Expert

16
from diegosouzapw/awesome-omni-skill

Design and implement Model Context Protocol servers for standardized AI-to-data integration with resources, tools, prompts, and security best practices