when-code-when-llmlisted
Install: claude install-skill shimo4228/when-code-when-llm
# When Code, When LLM
Code and LLMs are not in opposition. They are different tools for different kinds of work, and the failure mode is not "picking the wrong side of a debate" — it is **forcing one tool to do the other's job.**
Two symmetric failure modes to watch for:
- **Code-where-LLM-belongs.** You write a regex to classify whether a paragraph is a test or a bug report. You add patterns. You add exceptions. The regex grows and still misclassifies. The task is semantic; no amount of pattern polish will fix it.
- **LLM-where-code-belongs.** You call an LLM to "check if this filename ends in `.py`" or "validate this JSON." You pay latency, tokens, and nondeterminism for a check `str.endswith` would do in a nanosecond.
This skill is the decision rule for telling them apart, plus examples of each kind going right and wrong.
---
## The judgment axis: structural vs semantic
The question is not "is this task hard?" It is **"what kind of property am I checking?"**
### Structural properties — use code
A property is structural when it depends only on the literal shape of the input: characters, tokens, delimiters, syntax, format. A machine reading the bytes can decide it without knowing what the text "means."
Tools for structural work:
- **Regex** — pattern presence, tag stripping, token replacement, format matching
- **Keyword / substring match** — `in`, `startswith`, `endswith`
- **AST / parser** — "does this Python file define a class named `Foo`?"
- **Schema validati