audit-spec

audit-spec is a command for Claude Code from ThisIsSadeghi/KMPilot. It costs 12 tokens per session (754 once invoked), scanned A, original, MIT.

A command for auditing or generating specifications for existing KMP features. KMP is Kotlin Multiplatform, which lets Kotlin code be shared across platforms.

In plain words
What is it for?
Use it to generate a feature specification from existing Kotlin code or compare a specification with its implementation to find drift.
Why use it?
It documents features that lack specifications and identifies differences between the written specification and the code.

Command for Claude Code

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.

agentmods
npx agentmods add commands/thisissadeghi/kmpilot/audit-spec
Clone the repo
git clone --depth 1 https://github.com/ThisIsSadeghi/KMPilot

Made for: Claude Code.

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 audit-spec

README.md
[![agentmods](https://agentmods.dev/badge/commands/thisissadeghi/kmpilot/audit-spec.svg)](https://agentmods.dev/commands/thisissadeghi/kmpilot/audit-spec)
Your own site
<a href="https://agentmods.dev/commands/thisissadeghi/kmpilot/audit-spec"><img src="https://agentmods.dev/badge/commands/thisissadeghi/kmpilot/audit-spec.svg" alt="Measured on agentmods" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 754 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00012 $0.00754
Opus 5 $0.00006 $0.00377
Sonnet 5 $0.00002 $0.00151
Haiku 4.5 $0.00001 $0.00075

Measured 4d ago against content hash 5b79b6c8b3d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

audit-spec scanned grade A with 1 finding 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 4d 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.

Reads agent configuration directorieslowAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat .claude/docs/{featurename}/prd.md

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.claude/commands/audit-spec.md · 95 lines

How it starts

The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Audit Feature Specification

Audit, generate, or compare specifications for existing features.

Architecture Reference: @../skills/_shared/patterns.md Spec Template: @../skills/_shared/spec-template.md

Usage

/audit-spec {featurename}           # Generate spec from code
/audit-spec {featurename} --compare # Detect spec drift

When to Use

Scenario Use?
Legacy feature without spec Yes
Check spec-code consistency Yes (--compare)
New feature creation No → /create-feature
Modifying existing feature No → /modify-feature

Mode 1: Generate Spec (Default)

Process

  1. Validate: ls feature/{featurename}/src/commonMain/kotlin/

  2. Discover Package: grep "namespace" feature/{featurename}/build.gradle.kts

  3. Analyze Implementation:

    • data/model/*.kt - Data models
    • data/datasource/*.kt - DataSource interface + impl
    • data/repository/*.kt - Repository interface + impl
    • presentation/*ViewModel.kt - State management
    • presentation/ui/*Screen.kt - UI composition
    • presentation/navigation/*.kt - Routes and callbacks
    • di/*Modules.kt - DI bindings
  4. Check for PRD (preserve WHY):

    cat .claude/docs/{featurename}/prd.md
    

    Copy: Goals, Non-Goals, Background & Rationale, Design Decisions

  5. Generate: Create .claude/docs/{featurename}/spec.md using @../skills/_shared/spec-template.md

  6. Report — emit the blockquote as the very last line of output:

    ## Specification Generated
    **Feature:** {featurename}
    **Output:** .claude/docs/{featurename}/spec.md
    
    ---
    
    > **Next step —** review `.claude/docs/{featurename}/spec.md` and fill any TODO sections, then run `/clear` to free the context window, followed by `/review-feature {featurename}` to validate the implementation against it.
    

Mode 2: Compare/Drift Detection (--compare)

Process

  1. Load existing spec: .claude/docs/{featurename}/spec.md
  2. Analyze current implementation (same as Mode 1)
  3. Compare and generate drift report:

Read the full file on GitHub · 95 lines

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. 4d ago First seen · 95 lines · 12 tokens per session scan A 5b79b6c8b3d4

Subscribe to this mod's changes

audit-spec is a command published in the GitHub repository ThisIsSadeghi/KMPilot (56 stars, last pushed 26d ago), licensed MIT. It adds 12 tokens to every session and 754 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.