agentleFS
acaprariacaprari/specdriven-skills/skills/spec-infer/SKILL.md

spec-infer

Skill1 starsChanged 5 months agoMITView on GitHub

Use when adding specs to an existing codebase with no specs, when specs are suspected outdated, or when referred from spec:capture due to thin session context.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before reading any code, confirm scope with the user:

    line 14
  2. Distinctive:

    Do not start inferring across the whole codebase without confirmation.

    line 18
  3. Very specific:

    If yes → mark as > Inferred — please confirm and surface the ambiguity

    line 24
  4. Distinctive:

    If no (unambiguously intentional and well-understood pattern) → write as a decision with rationale from context

    line 25
  5. Distinctive:

    When in doubt, mark and ask.

    line 27
  6. Very specific:

    Write capability spec files following the format from spec:core.

    line 31
  7. Distinctive:

    When code reveals a decision but cannot reveal why:

    line 55
  8. Distinctive:

    Do not promote to a Decision entry:

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Spec: Infer

Overview

Infer recovers specs by reading the codebase. It is the highest-risk skill for silent misinterpretation — code reveals what was built, not what was decided. Every inferred decision is marked until the user confirms it. Nothing is promoted from implementation detail to spec entry without explicit rationale.

Scope First

Before reading any code, confirm scope with the user:

"I'll start with [capability area]. Is that the right scope, or do you want me to cover other areas? On a broad codebase I'll work one capability area at a time and check in after each."

Do not start inferring across the whole codebase without confirmation.

The Inference Rule

For every candidate decision in the code, ask: could this plausibly be accidental?

  • If yes → mark as > Inferred — please confirm and surface the ambiguity
  • If no (unambiguously intentional and well-understood pattern) → write as a decision with rationale from context

When in doubt, mark and ask. Unmarked inferences that turn out to be wrong are harder to find than marked ones.

Output Format

Write capability spec files following the format from spec:core. For every entry where rationale is missing or the decision could be accidental:

### <Decision name>
[What the code does.]
> Inferred — please confirm: was this a deliberate decision? If so, what was the rationale?

For entries where rationale can be inferred with confidence (well-known security patterns, etc.):

### <Decision name>
[What was decided and why — rationale inferred from context.]
> Alternatives considered: [if a well-known alternative exists and was visibly rejected in the code]

Invariants follow the same rule: if a behaviour could be accidental, mark it.

INV-01: <assertion> *(inferred — please confirm)*

Missing Rationale

When code reveals a decision but cannot reveal why:

"I can see [behaviour X] in the code but I don't know why it was chosen over [obvious alternative Y]. I'll mark this entry as incomplete — if the rationale exists in session history, spec:capture may be able to recover it."

Mark the entry and continue. Do not invent rationale.

What Does NOT Belong in Specs

Do not promote to a Decision entry:

  • The specific library used (unless the choice of library is itself the decision)
  • Internal variable names, function signatures, file structure
  • Behaviour that looks like a default that was never considered
  • Anything whose only evidence is that it's in the code

These are implementation details. If in doubt, ask before writing.

Temporary Markers

> Inferred — please confirm markers are temporary scaffolding. They signal that a human has not yet validated the entry. spec:validate flags any remaining unconfirmed markers as open gaps. The goal is zero unconfirmed markers in a mature spec.

Soft Referrals

  • Missing rationale → recommend spec:capture (session context may have it)
  • Ambiguous intent → ask first, infer second

Common Mistakes

MistakeCorrect behaviour
Writing inferred decisions without markersEvery plausibly-accidental decision gets > Inferred — please confirm
Starting inference across the whole codebaseConfirm scope one capability area at a time
Inventing rationale from patternsMark as incomplete; recommend spec:capture for rationale recovery
Promoting implementation details to decisionsAsk "is this a deliberate decision?" before writing it as one
Treating "it works" as "it was decided"Working code and decided behaviour are not the same thing

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.