detective-spec

detective-spec is a command for Claude Code from felvieira/claude-skills-fv. It costs 24 tokens per session (614 once invoked), scanned A, original, Apache-2.0.

A read-only command that reconstructs written specifications from an existing codebase, especially an older system with incomplete documentation.

In plain words
What is it for?
Use it to document legacy repositories, investigate a module or feature, create traceable specifications, and resume an interrupted analysis.
Why use it?
It reveals module contracts, business rules, system flows, and past architecture decisions without changing the code.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Part of the dev-team-kit-fv plugin — 72 skills, 45 commands, 16 agents, 5 hooks shipped together

Good fit Use it to document legacy repositories, investigate a module or feature, create traceable specifications, and resume an interrupted analysis.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/felvieira/claude-skills-fv/detective-spec
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/felvieira/claude-skills-fv

Made for: Claude Code.

Or install dev-team-kit-fv, the plugin that ships this one along with the rest of its 72 skills, 45 commands, 16 agents, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for detective-spec

README.md
[![agentmods](https://agentmods.dev/badge/commands/felvieira/claude-skills-fv/detective-spec/github.svg)](https://agentmods.dev/commands/felvieira/claude-skills-fv/detective-spec)
Your own site
<a href="https://agentmods.dev/commands/felvieira/claude-skills-fv/detective-spec"><img src="https://agentmods.dev/badge/commands/felvieira/claude-skills-fv/detective-spec/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for detective-spec

Your own site · 80×15
<a href="https://agentmods.dev/commands/felvieira/claude-skills-fv/detective-spec"><img src="https://agentmods.dev/badge/commands/felvieira/claude-skills-fv/detective-spec.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 614 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.00614
Opus 5 $0.00012 $0.00307
Sonnet 5 $0.00005 $0.00123
Haiku 4.5 $0.00002 $0.00061

Measured 13d ago against content hash d6044245fd62, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

detective-spec scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/detective-spec.md · 46 lines

What it actually says

/detective-spec — Engenharia Reversa de Specs

Objetivo: Extrair specs executáveis (contratos de módulo, regras de negócio, fluxos, ADRs retroativos) a partir de código legado, sem modificar uma linha.

Skill ativada: 33 — Detective Spec

Subagents dispatcháveis: detective-contracts, detective-business-rules, detective-flows, detective-adrs

Input esperado: Repositório legado. Opcional: escopo (--module=path, --feature=name), fase única (--phase=N), ou --resume para retomar checkpoint.

Output esperado:

  • _detective_sdd/00-overview.md — mapa do sistema
  • _detective_sdd/01-modules/<name>.md — contratos de módulo
  • _detective_sdd/02-business-rules/<domain>.md — regras extraídas
  • _detective_sdd/03-flows/<flow>.md — fluxos end-to-end
  • _detective_sdd/04-adrs/ADR-NNN.md — decisões arquiteturais retroativas
  • _detective_sdd/99-traceability.md — spec ↔ evidência + items para validação humana
  • .detective/state.json — checkpoint resume-friendly

Garantias:

  • Zero writes fora de .detective/ e _detective_sdd/ (enforced por policies/detective-write-guardrails.md)
  • Cada spec rastreável até file:line ou commit-sha
  • Confidence scoring (high/medium/low) em todas as inferências

Policies relevantes:

  • policies/detective-write-guardrails.md — hard guardrail de imutabilidade do legado
  • policies/source-driven.md — toda afirmação ancorada em evidência
  • policies/persistence.md — checkpoint para resume

Pipeline (5 fases):

  1. Reconhecimento (orchestrator) → mapa estrutural via Graphify + repo-audit
  2. Módulos → detective-contracts
  3. Regras de Negócio → detective-business-rules
  4. Fluxos end-to-end → detective-flows
  5. ADRs retroativos + síntese → detective-adrs

Uso: /detective-spec [escopo] [--phase=N] [--resume]

Quando usar: legado sem doc, vibe coded, antes de evoluir feature em módulo desconhecido, migração, onboarding de time novo.

Quando não usar: projeto novo (use /spec), bug fix localizado (use /build), só mapa estrutural (use /audit-repo).

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 46 lines · 24 tokens per session scan A d6044245fd62

Subscribe to this mod's changes

detective-spec is a command published in the GitHub repository felvieira/claude-skills-fv (23 stars, last pushed yesterday), licensed Apache-2.0. It adds 24 tokens to every session and 614 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.