VIRIM Infotech
Your AI Assisted Product Developers

vm-script-calibrator

Skill detail with category, linked agents, and source metadata.

vm-script-calibrator

Phase -1 calibration skill for reverse engineering. Examines 3-5 representative files per detected language and role tag to produce script-config.json containing tuned regex patterns, naming conventions, and framework-specific extraction rules. Consumed by deterministic extraction scripts in subsequent phases. USE WHEN: starting a new codebase reverse engineering run. Requires phase0-inventory.json as input.

Category: code-generation Used by 1 agents

Source: .github/skills/code-generation/vm-script-calibrator/SKILL.md

Used By Agents

Preview

View source preview (first 3000 chars)

# Script Calibrator Skill

Examines representative source files to produce tuned extraction patterns for deterministic analysis scripts.

## When to Use This Skill

- Before running deterministic file inventory or signature extraction scripts
- When starting reverse engineering on a new or unfamiliar codebase
- When the target codebase uses non-standard naming or framework conventions
- To produce `script-config.json` consumed by `vm-deterministic-extractor` skill

## Unitary Function

**ONE RESPONSIBILITY:** Analyze representative source files and produce calibrated extraction patterns.

**NOT RESPONSIBLE FOR:**
- Running the extraction scripts (see vm-deterministic-extractor)
- Full codebase analysis (see reverse engineering agent)
- Security scanning (see vm-dependency-scanner)

## Input

```json
{
  "repo_path": "/absolute/path/to/repo",
  "output_dir": "docs/codebase-analysis",
  "phase0_inventory_path": "docs/codebase-analysis/intermediate/phase0-inventory.json"
}
```

**Parameters:**
- **repo_path** (required): Absolute path to the target repository
- **output_dir** (required): Output directory relative to repo root
- **phase0_inventory_path** (required): Path to Phase 0 inventory JSON

## Procedure

### Step 1: Read Phase 0 Inventory

Load `phase0-inventory.json` and extract:
- `detected_languages[]` -- which languages to calibrate for
- `enumerated_files[]` -- the file list to sample from
- `counts` -- file counts per language

### Step 2: Select Representative Files

For each detected language, select 3-5 files that represent different roles:
- 1 large file (top 10% by size) -- likely a controller or service
- 1 medium file -- likely a component or model
- 1 small file -- likely a util or helper
- 1 test file (if `include_tests` is true)
- 1 entry point file (if detected)

Selection priority: files in directories named `src/`, `lib/`, `app/`, `components/` come first.

### Step 3: Examine Each Representative File

For each selected file, read the full contents and identify:

**A. Class/Component Detection Patterns:**
- How are classes declared? (`class X`, `export class X`, `const X = React.createClass`, etc.)
- Are functional components used? (`const X = () =>`, `function X()`, `export default function X()`)
- What is the inheritance/composition pattern? (`extends`, `implements`, HOC wrapping, hooks)

**B. Function Detection Patterns:**
- Named functions: `function X()`, `const X = () =>`, `export function X()`
- Method declarations inside classes
- Are there callback patterns? Event handlers? Lifecycle methods?

**C. Import Detection Patterns:**
- ES6 imports: `import X from 'y'`, `import { X } from 'y'`
- CommonJS: `const X = require('y')`
- Dynamic imports: `import('y')`
- Internal vs external: what prefix distinguishes local imports from node_modules?
  - Relative paths (`./`, `../`) = internal
  - Aliases (`@/`, `~/`, custom webpack aliases from discovery.json) = internal
  - Bare specifiers = external

**D. Framework-Specific P