원클릭으로
add-module
Create a new core infrastructure module with standard API, lazy init, and proper structure
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Create a new core infrastructure module with standard API, lazy init, and proper structure
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Create a new card part within a section with factory/class pattern, Card wrapper, and proper cleanup
Add a new Jotai atom to the state system with type definitions, registry, and Store API access
Create a reusable UI component with factory pattern, theme compatibility, and proper cleanup
Scaffold a new toggleable feature with full structure, storage, API exposure, and bootstrap registration
Create a reactive global variable that derives from atoms with subscription support
Create a game UI injection that modifies existing game elements with proper cleanup
| name | add-module |
| description | Create a new core infrastructure module with standard API, lazy init, and proper structure |
| aliases | ["new-module","create-module"] |
/add-module <ModuleName>
Note: Modules are core infrastructure (always-on). For toggleable functionality, use /add-feature instead.
What infrastructure does this module provide?
Brief description:
Where does the module get its data?
A) Game runtime - Hooks into game code
B) Network - Captures WebSocket/HTTP
C) Assets - Game assets (sprites, audio, etc.)
D) Computed - Derives from other modules
E) Other: ___
Which existing modules does it depend on?
[ ] MGData [ ] MGSprite [ ] MGTile
[ ] MGPixi [ ] MGAudio [ ] MGCosmetic
[ ] MGVersion [ ] MGAssets [ ] MGManifest
[ ] MGEnvironment [ ] MGCalculators [ ] None
Does it need runtime state?
A) Yes - Caches data in memory (needs state.ts)
B) No - Stateless utilities only
What methods should the module expose?
(Besides required init/isReady)
Examples:
- get(key) - Get data by key
- calculate(params) - Perform calculation
- render(target) - Render something
src/modules/<moduleName>/
├── index.ts # Public façade (MG<ModuleName>)
├── types.ts # Type definitions
├── state.ts # Runtime state (if needed)
└── logic/
└── core.ts # Business logic
No logic/index.ts - Import directly from logic files.
/**
* <ModuleName> Module Types
*/
// ─────────────────────────────────────────────────────────────────────────────
// Types
// ─────────────────────────────────────────────────────────────────────────────
export interface <ModuleName>Data {
// Define data structures
}
// ─────────────────────────────────────────────────────────────────────────────
// Constants
// ─────────────────────────────────────────────────────────────────────────────
export const <MODULE_NAME>_CONSTANTS = {
// Define constants
} as const;
/**
* <ModuleName> Module State
*
* Runtime cache/state management.
*/
import type { <ModuleName>Data } from './types';
// ─────────────────────────────────────────────────────────────────────────────
// State
// ─────────────────────────────────────────────────────────────────────────────
let cache: <ModuleName>Data | null = null;
let ready = false;
// ─────────────────────────────────────────────────────────────────────────────
// Accessors
// ─────────────────────────────────────────────────────────────────────────────
export function getCache(): <ModuleName>Data | null {
return cache;
}
export function setCache(data: <ModuleName>Data): void {
cache = data;
ready = true;
}
export function isReady(): boolean {
return ready;
}
export function reset(): void {
cache = null;
ready = false;
}
/**
* <ModuleName> Core Logic
*/
import { setCache, getCache } from '../state';
import type { <ModuleName>Data } from '../types';
// ─────────────────────────────────────────────────────────────────────────────
// Initialization
// ─────────────────────────────────────────────────────────────────────────────
export async function initialize(): Promise<void> {
// Initialization logic
// Capture data, setup hooks, etc.
const data: <ModuleName>Data = {
// ...
};
setCache(data);
}
// ─────────────────────────────────────────────────────────────────────────────
// Public Methods
// ─────────────────────────────────────────────────────────────────────────────
export function getData(): <ModuleName>Data | null {
return getCache();
}
/**
* <ModuleName> Module
*
* <Brief description>
*
* @example
* ```typescript
* await MG<ModuleName>.init();
* const data = MG<ModuleName>.get();
* ```
*/
import { initialize, getData } from './logic/core';
import { isReady as checkReady } from './state';
// ─────────────────────────────────────────────────────────────────────────────
// State
// ─────────────────────────────────────────────────────────────────────────────
let initialized = false;
// ─────────────────────────────────────────────────────────────────────────────
// Public API
// ─────────────────────────────────────────────────────────────────────────────
/**
* Initialize the module
* Idempotent - safe to call multiple times
*/
async function init(): Promise<void> {
if (initialized) return;
initialized = true;
await initialize();
console.log('[<ModuleName>] Initialized');
}
/**
* Check if module is ready
*/
function isReady(): boolean {
return checkReady();
}
/**
* Get module data
*/
function get() {
return getData();
}
// ─────────────────────────────────────────────────────────────────────────────
// Export
// ─────────────────────────────────────────────────────────────────────────────
export const MG<ModuleName> = {
// Required (standard API)
init,
isReady,
// Module-specific
get,
// Add other public methods
};
export type { <ModuleName>Data } from './types';
src/modules/index.tsexport { MG<ModuleName> } from './<moduleName>';
export type { <ModuleName>Data } from './<moduleName>';
src/api/index.tsimport { MG<ModuleName> } from '../modules/<moduleName>';
Modules: {
// ... existing
<ModuleName>: MG<ModuleName>,
}
src/ui/loader/bootstrap.tsimport { MG<ModuleName> } from '../../modules/<moduleName>';
// In initModules():
await MG<ModuleName>.init();
index.ts exports MG<ModuleName>types.ts defines types/constantsstate.ts exists (if stateful)logic/ folder for business logiclogic/index.ts barrel fileinit() - Required, idempotentisReady() - Required, returns booleansrc/modules/index.tssrc/api/index.ts| Aspect | Module | Feature |
|---|---|---|
| Toggle | Always on | enabled: boolean |
| Location | src/modules/ | src/features/ |
| Purpose | Infrastructure | Enhancement |
| API | MG<Name> | MG<Name> |
| Storage | MODULE_KEYS (rare) | FEATURE_KEYS |
.claude/rules/modules.mdsrc/modules/*/