ワンクリックで
function-naming
Validates function naming when adding new functions, refactoring existing functions, or reviewing function signatures.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Validates function naming when adding new functions, refactoring existing functions, or reviewing function signatures.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | function-naming |
| description | Validates function naming when adding new functions, refactoring existing functions, or reviewing function signatures. |
When to apply: When adding new functions, refactoring existing functions, or reviewing function signatures.
Priority: HIGH - Naming affects API clarity and maintainability across 30+ years of codebase evolution.
snake_case for functions/variables. No abbreviations; choose unique global names.CamelCase for classes/methods. No underscores in test names (GoogleTest restriction).int my_function(int arg) { // NOT on new line
// spaces only, no tabs
}
| Operation Type | Prefix | Parameter | Example |
|---|---|---|---|
| Per-object query | query_* | object_t* first | query_prompt(object_t *) |
| Per-object setter | set_* | object_t* first | set_prompt(object_t *, const char *) |
| Per-object getter | get_* | object_t* + output param | get_pending_command(object_t *, char *) |
| Global lookup | find_* or lookup_* | search/index param | lookup_user_at(int), find_object_by_name(const char *) |
| Global collection | get_all_* | returns array/collection | get_all_heart_beats(void) |
| Global iterator | next_* | maintains internal state | next_user_command(void) |
| Global check | descriptive verb | void or simple params | has_pending_commands(void), grant_all_turns(void) |
| Internal helper | descriptive | any | varies - static only |
❌ NEVER use module prefixes like comm_, user_cmd_, etc.
Rationale: Neolith's 30-year-old codebase uses semantic names without prefixes:
load_object(), destruct_object() (NOT simulate_load_object())set_heart_beat(), query_heart_beat() (NOT backend_set_heart_beat())When you might be tempted:
Per-object operations - ALWAYS take object_t* as first parameter:
✅ query_prompt(object_t *ob)
✅ set_prompt(object_t *ob, const char *text)
❌ set_prompt(const char *text) // Implicit - uses command_giver global
Global operations - NO object_t* parameter:
✅ has_pending_commands(void) // Checks all users
✅ next_user_command(void) // Iterator over all users
✅ lookup_user_at(int index) // Access global array
❌ query_pending_commands(void) // Ambiguous - query_ implies per-object
Iterators (next_*) - Mutate internal state:
✅ next_user_command(void) // Advances static counter
✅ next_reset_object(void) // Walks reset queue
Collections (get_all_*) - Return snapshot, no side effects:
✅ get_all_heart_beats(void) // Returns array of all heart beat objects
✅ get_all_users(void) // Returns array of all interactive objects
❌ get_heart_beats(void) // Ambiguous - single or multiple?
Use query_* for simple attribute retrieval (per-object):
✅ query_prompt(object_t *ob) // Returns const char*
✅ query_idle(object_t *ob) // Returns time_t
Use get_* when output parameter needed (per-object):
✅ get_pending_command(object_t *ob, char *buf) // Fills buffer
✅ get_environment(object_t *ob, object_t **env) // Output via pointer
Use set_* for attribute modification (per-object):
✅ set_prompt(object_t *ob, const char *text)
✅ set_heart_beat(object_t *ob, int flag)
Special case - get_all_* for global collections:
✅ get_all_heart_beats(void) // Returns array
When adding or modifying a function, verify:
object_t* first parameterobject_t* parameterquery_/set_/get_* = per-object, find_/lookup_/next_/get_all_* = global)comm_, backend_, simulate_, etc.)get_all_* not just get_*next_* not get_*object_t* is first parametercommand_giver)get_* prefix and output parameterquery_* prefix and return value directly❌ comm_set_prompt(object_t *ob, const char *text)
✅ set_prompt(object_t *ob, const char *text)
❌ set_prompt(const char *text) // Uses command_giver internally
✅ set_prompt(object_t *ob, const char *text)
// Efun wrapper adds convenience:
void f_set_prompt(void) {
set_prompt(command_giver, SVALUE_STRPTR(sp)); // Explicit
}
❌ query_pending_commands(void) // Returns what? For whom?
✅ query_buffered_commands(object_t *ob) // Per-object
✅ has_pending_commands(void) // Global check
❌ get_user_command(void) // Surprise! Advances internal counter
✅ next_user_command(void) // Clear it's an iterator
❌ get_heart_beats(void) // One or many?
✅ get_all_heart_beats(void) // Clearly returns all
// Queries - return values directly
const char* query_ip_name(object_t *ob);
time_t query_idle(object_t *ob);
object_t* query_snoop(object_t *ob);
// Setters - explicit object parameter
void set_heart_beat(object_t *ob, int flag);
void set_prompt(object_t *ob, const char *text);
// Getters - use output parameters
int get_pending_command(object_t *ob, char *buf);
// Collections - return arrays
object_t** get_all_heart_beats(void);
// Iterators - maintain state
char* next_user_command(void);
object_t* next_reset_object(void);
// Lookups - search by key
object_t* lookup_user_at(int index);
object_t* find_object_by_name(const char *name);
// Checks - descriptive verbs
int has_pending_commands(void);
void grant_all_turns(void);
// These cache whether object has specific applies
// Named to emphasize behavior, not storage location
int has_process_input_apply(object_t *ob);
void cache_process_input_apply(object_t *ob, int exists);
int has_write_prompt_apply(object_t *ob);
void cache_write_prompt_apply(object_t *ob, int exists);
Rationale: These describe object program attributes but are currently stored on interactive_t (technical debt). Names emphasize caching behavior so they work regardless of future storage location. See docs/internals/lpc-program.md.
Implicit → Explicit signatures:
object_t* firstcommand_giver:// Old efun implementation
void f_set_prompt(void) {
set_prompt(SVALUE_STRPTR(sp)); // Implicit command_giver
}
// New efun implementation
void f_set_prompt(void) {
set_prompt(command_giver, SVALUE_STRPTR(sp)); // Explicit
}
Renaming for clarity:
get_user_command() → next_user_command() (indicates iteration)get_heart_beats() → get_all_heart_beats() (indicates collection)DO:
DON'T:
get_* for both collections and per-object operationsWhen testing new functions:
next_*Add unit tests for individual components. Use the GoogleTest (GTest) framework to define test cases and assertions. Troubleshooting test failures involves checking test logs, reproducing failures locally, and debugging with breakpoints or additional logging to identify root causes.
Generate and refactor Neolith LPC code with correct driver semantics. Use when writing LPC functions, efun calls, simul_efun-aware code, inheritance calls, strict_types-safe code, inline LPC code (pre_text) in unit-tests, or when prompts mention ambiguity between local/simul/efun resolution. Prefer dot-call syntax receiver.method(args...) when explicit driver-efun intent is needed; dot-call lowers to efun::method(receiver, args...) and remains subject to efun type/arity validation.
Manage Neolith build-time options: add, change, or remove CMake options that control driver behavior and LPC visibility. Use when creating a new option, toggling an existing option default, renaming macros, tracing how an option surfaces to LPC code, or troubleshooting preprocessor define mismatches between cmake/options.cmake, lib/lpc/options.h.in, and the generated options.h.
Implement async worker thread patterns with bounded task queues, admission control, and completion posting. Use when adding blocking I/O operations (DNS, file I/O, network calls) that must not block the main event loop. Covers worker thread design, queue management, completion callbacks, and main-loop integration for event-driven architectures.
Add opt_trace() calls for debugging and profiling. Use -t option to enable specific trace tiers and levels.