Naming craft

From Intense-Visions/harness-engineering · View interactive version

Naming craft is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > LLM-judgment skill that critiques identifier names — variables, functions, types, and files — for clarity, concreteness, weight, and predictive power. First member of the craft-pipeline initiative.

How to use this skill

Skill file

Naming Craft

LLM-judgment skill that critiques identifier names — variables, functions, types, and files — for clarity, concreteness, weight, and predictive power. First member of the craft-pipeline initiative. Uses a curated rubric catalog seeded from Martin / Beck / Karlton. Emits 3-axis findings (tier × impact × confidence per ADR 0019).

When to Use

Capability Roles

<!-- Capability seam: this skill participates in a real extension point whose three roles are named and concrete. A seam with only one role filled is accidental single-implementation lock-in. See harness-skill-authoring Phase 1C. -->

Process

Phase 1: EXTRACT — Identifier walk

  1. Read project configuration. Check harness.config.json for:
  1. Walk project files (.ts / .tsx / .js / .jsx). Skip node_modules, dist, build, coverage, dotdirs.
  1. Extract identifiers per file via TS Compiler API:

Phase 2: SAMPLE — Convention inference

For each identifier kind, sample up to N=500 identifiers across the project and infer the dominant convention via majority-rule:

>50% majority threshold per kind. Below threshold → null (no dominant convention) and the convention-conformance rubric silently skips.

Phase 3: CRITIQUE — Per-rubric LLM loop

For each file:

  1. Sample identifiers weighted by importance:
  1. For each (identifier, rubric) in the cross-product:
  1. v1 rubric catalog (6 seed rubrics):

Phase 4: REPORT — Aggregate + cost telemetry

Emit NamingCraftOutput:

{
  findings: NamingFinding[];
  summary: {
    phaseRun: ['critique'];
    durationMs: number;
    llmCalls: { provider, model, count, costUsd };
    catalog: { rubricsApplied: string[] };
    convention: { variables, functions, types, files };
    runId: string;
  }
}

Harness Integration

Migration from `harness.orchestrator.md`

If you already declared agent.backends in harness.orchestrator.md, the craft selector reads from it as a fallback and emits a one-time warning on first run. Run harness migrate backends (preview with --dry-run) to copy the entries into harness.config.json so both files share a single source of truth.

Example

Example config snippet for routing craft skills to a local Ollama:

{
  "agent": {
    "backends": {
      "ollama": {
        "type": "local",
        "endpoint": "http://localhost:11434/v1",
        "model": ["deepseek-coder-v2", "qwen3:8b"],
      },
    },
  },
  "craft": { "llm": { "backend": "ollama" } },
}

Invoked as a review hook

naming-craft auto-activates as an advisory review hook whenever a diff touches the surface it

owns — harness-autopilot at after:REVIEW / after:FINAL_REVIEW, and harness-code-review at

after:mechanical. The domain table is CRAFT_REVIEW_DOMAINS and the per-host events are

CRAFT_REVIEW_EVENTS_BY_HOST, both in packages/core/src/hooks/craft-review-hooks.ts. The host

forwards the subset of the diff this domain owns:

reads it from plan.files["naming-craft"], which holds repo-relative POSIX paths, and resolves each

entry against the project root before calling mcp__harness__naming_craft. Absolute is the

recommended form, not a correctness requirement for this domain: its collector resolves a

relative entry against the tool's path (never the process CWD), so a repo-relative entry

forwarded unresolved still reads the in-diff file (pinned by

packages/cli/tests/shared/craft/relative-files-scope.test.ts). Only

mcp__harness__design_craft still requires absolute paths.

Findings from a hook-triggered run are advisory: reported, never blocking, never counted toward

review severity, and never entered into a host's mechanical exclusion set. A hook-triggered run

that fails is a missing opinion, not a broken gate.

In-session flow (default)

When HARNESS_CRAFT_LLM is unset (or set to in-session), the MCP tool does not call any LLM. Instead it returns a list of prompts for the calling agent to answer with its own model. This is a two-step protocol:

Step 1 — mcp__harness__naming_craft({ path, ... }) returns:

{
  "status": "collected",
  "runId": "<uuid>",
  "pendingPrompts": [
    { "promptId": "p1", "systemPrompt": "...", "userPrompt": "..." },
    ...
  ],
  "projection": { "promptCount": N, "budget": 100 }
}

If projection.promptCount > budget, status is "budget-exceeded" and pendingPrompts is empty — re-invoke with smaller maxFiles / maxIdentifiersPerFile, or pass promptBudget to raise the ceiling.

Step 2 — for each pending prompt, generate the fenced-JSON response as if you were a senior engineer applying the rubric to the identifier. The required response shape (per prompt) is:

null

if the rubric does not apply or the name is fine, OR:

{

"tier": "foundational|polish|aspirational",

"impact": "small|medium|large",

"confidence": "high|medium|low",

"message": "<critique with suggested rename when possible>"

}

Step 3 — mcp__harness__naming_craft_finalize({ path, runId, responses: [{ promptId, raw }, ...] }) parses the responses, applies the same validation the inline path uses, and returns the standard NamingCraftOutput.

If you want the inline behavior (skill calls an LLM directly), pass mode: 'inline' to step 1 and set HARNESS_CRAFT_LLM to a non-in-session provider.

Success Criteria

See docs/changes/craft-pipeline/naming-craft/proposal.md for the full 34 success criteria. Highlights:

Rationalizations to Reject

These are common rationalizations that sound reasonable but lead to incorrect results. When you catch yourself thinking any of these, stop and follow the documented process instead.

| Rationalization | Why It Is Wrong |

| --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "This name is camelCase and matches the project convention, so it's fine." | Convention conformance (NAME-R004) is one rubric of six. A perfectly-cased processData still fails predictive-power (R001) and concreteness (R002) — cased correctly, says nothing. |

| "timeout reads clearly in context, so NAME-R006 (encoded measure) doesn't apply." | Encoded-measure asks whether the unit is silent — timeout could be ms or seconds. Reads-fine-in-context is exactly how silent-unit bugs ship. Suggest timeoutMs. |

| "The convention sampler returned null, so I'll infer the dominant style and flag it." | Below the >50% threshold the sampler returns null and NAME-R004 silently skips by design. Guessing a convention on a mid-migration project manufactures wrong findings. |

| "A one-letter loop variable x is lazy naming, so I'll flag it foundational." | NAME-R005 is scope-match: length proportional to scope. x in a ≤10-line body is appropriate; the same name at file scope is not. Scope size decides the verdict, not brevity alone. |

| "This is a judgment call I'm unsure about, so I'll emit it high confidence to be safe." | Confidence is an honesty axis, not a safety lever. Unsure means low/medium so derivePriority de-emphasizes it. Inflating confidence to hedge pollutes the report with false urgency. |

Examples

Example: Vague function name

Input: src/orders/processor.ts:

export function processData(orders: Order[]) { ... }

Output (mock LLM):

NAME-R002 [polish/medium/low] function processData:14
  "processData" is a vague verb-pair where the operation and subject
  are both unstated. Consider `applyDiscountsToOrders` or
  `convertOrdersToInvoices` depending on the actual transform.
NAME-R001 [polish/medium/medium] function processData:14
  The name predicts neither the input shape (orders) nor the operation.

(Real LLM responses vary; mock provider returns deterministic low-confidence findings for test determinism.)

Example: Silent unit

Input:

const timeout = 5000;

Output:

NAME-R006 [foundational/medium/high] variable timeout:1
  "timeout" implies a time measure but the unit is silent. Use
  `timeoutMs` so the call site can't be misread as seconds.

Example: Mixed-convention project — convention sampler returns null

Input: A project with 60% camelCase, 30% snake_case, 10% PascalCase variables. No >50% camelCase majority (60% IS >50%, so convention=camelCase). But with 45/40/15 split: no convention.

Output: convention-conformance rubric (NAME-R004) silently skips for the variables kind. Other rubrics still run.

Gates

Escalation

Status

v1 — in implementation. See:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.