Skip to content

mrc4tt/CS2_VibeSignatures / .claude/skills/create-preprocessor-scripts

create-preprocessor-scripts

Verified

Create a new find-XXXX preprocessor Python script from scratch (no existing SKILL.md), add configs/<GAMEVER>.yaml skill and symbol entries. Covers xref-string-based and LLM_DECOMPILE-based discovery patterns. Use when a GitHub issue or user instruction specifies a new function to find.

FileKindSize
SKILL.mdskill md69.0 KB
agents/openai.yamlconfig43 B
references/pattern-A.mdmarkdown3.2 KB
references/pattern-B.mdmarkdown3.5 KB
references/pattern-C.mdmarkdown4.5 KB
references/pattern-D.mdmarkdown2.0 KB
references/pattern-E.mdmarkdown4.1 KB
references/pattern-F.mdmarkdown6.7 KB
references/pattern-G.mdmarkdown3.0 KB
references/pattern-H.mdmarkdown3.7 KB
references/pattern-I.mdmarkdown8.7 KB
references/pattern-J.mdmarkdown5.2 KB
references/pattern-L.mdmarkdown8.4 KB
references/pattern-M.mdmarkdown11.9 KB

references/pattern-H.md

View on GitHub
# Pattern H -- Secondary (ordinal) vtable

**Use when:** the target is a **secondary vtable** (`_vtable2`) for a class that has multiple inheritance. Located via the mangled symbol name on Windows (e.g. `??_7ClassName@@6B@_0`) and via matching `offset-to-top` on Linux.

This pattern does NOT use `preprocess_common_skill`. It uses the `_ordinal_vtable_common` helper instead.

## User inputs

- **Class name** -- e.g. `CLoopTypeClientServerService`
- **Windows mangled symbol** -- e.g. `??_7CLoopTypeClientServerService@@6B@_0` (the `@_0` suffix distinguishes the secondary vtable)
- **Linux offset-to-top** -- e.g. `-56` (a negative decimal value from `dq -NN ; offset to this` in the vtable layout)

## Template

```python
#!/usr/bin/env python3
"""Preprocess script for find-{CLASS_NAME}_vtable2 skill."""

from pathlib import Path

from ida_analyze_util import write_vtable_yaml
from ida_preprocessor_scripts._ordinal_vtable_common import (
    preprocess_ordinal_vtable_via_mcp,
)


TARGET_CLASS_NAME = "{CLASS_NAME}"
TARGET_OUTPUT_STEM = "{CLASS_NAME}_vtable2"
WINDOWS_SYMBOL_ALIASES = ["??_7{CLASS_NAME}@@6B@_0"]
LINUX_EXPECTED_OFFSET_TO_TOP = {OFFSET_TO_TOP}  # negative decimal, e.g. -8, -56


async def preprocess_skill(
    session,
    skill_name,
    expected_outputs,
    old_yaml_map,
    new_binary_dir,
    platform,
    image_base,
    debug=False,
):
    _ = skill_name, old_yaml_map, new_binary_dir

    expected_filename = f"{TARGET_OUTPUT_STEM}.{platform}.yaml"
    matching_outputs = [
        output_path
        for output_path in expected_outputs
        if Path(output_path).name == expected_filename
    ]
    if len(matching_outputs) != 1:
        return False

    if platform == "windows":
        symbol_aliases = WINDOWS_SYMBOL_ALIASES
        expected_offset_to_top = None
    elif platform == "linux":
        symbol_aliases = None
        expected_offset_to_top = LINUX_EXPECTED_OFFSET_TO_TOP
    else:
        return False

    result = await preprocess_ordinal_vtable_via_mcp(
        session=session,
        class_name=TARGET_CLASS_NAME,
        ordinal=0,
        image_base=image_base,
        platform=platform,
        debug=debug,
        symbol_aliases=symbol_aliases,
        expected_offset_to_top=expected_offset_to_top,
    )
    if not result:
        return False

    write_vtable_yaml(matching_outputs[0], result)
    return True
```

## Key differences from all other patterns

- Does NOT use `preprocess_common_skill` -- uses `preprocess_ordinal_vtable_via_mcp` from `_ordinal_vtable_common` plus `write_vtable_yaml` from `ida_analyze_util`
- No `TARGET_FUNCTION_NAMES`, `FUNC_XREFS`, `LLM_DECOMPILE`, `FUNC_VTABLE_RELATIONS`, or `INHERIT_VFUNCS`
- configs/<GAMEVER>.yaml category is `vtable`, no `expected_input` needed
- Output stem is `{CLASS_NAME}_vtable2`, configs/<GAMEVER>.yaml symbol name matches
- Windows uses `WINDOWS_SYMBOL_ALIASES` (mangled name with `@_0` suffix)
- Linux uses `LINUX_EXPECTED_OFFSET_TO_TOP` (negative decimal offset-to-top value)
- The `ordinal=0` parameter selects the first secondary vtable (use `ordinal=1` for a third vtable, etc.)
- The `expected_filename` variable in the f-string uses the curly-brace trick: define `TARGET_OUTPUT_STEM` as a plain string, then build the filename with `f"{TARGET_OUTPUT_STEM}.{platform}.yaml"`

## Checklist

- [ ] `TARGET_CLASS_NAME` and `TARGET_OUTPUT_STEM` match (stem = `{CLASS_NAME}_vtable2`)
- [ ] `WINDOWS_SYMBOL_ALIASES` contains the correct mangled name (e.g. `??_7ClassName@@6B@_0`)
- [ ] `LINUX_EXPECTED_OFFSET_TO_TOP` is the correct negative decimal value
- [ ] Uses `preprocess_ordinal_vtable_via_mcp` + `write_vtable_yaml` (NOT `preprocess_common_skill`)
- [ ] configs/<GAMEVER>.yaml symbol category is `vtable`, no `expected_input` needed
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall