Document detection

From laurigates/claude-plugins · View interactive version

Document detection is an AI agent skill from the GitHub repository laurigates/claude-plugins. Detect PRD/ADR/PRP opportunities in conversations and prompt for document creation. Use when the user discusses feature requirements, tech trade-offs, or implementation plans.

How to use this skill

Skill file

Document Detection

Proactively identify when conversations should become structured documents (PRDs, ADRs, or PRPs) and guide users through the documentation workflow.

When to Use This Skill

| Use this skill when... | Use blueprint-derive-plans instead when... |

|---|---|

| Mid-conversation cues suggest a PRD/ADR/PRP should be captured | You're explicitly deriving plans (PRDs/ADRs/PRPs) from existing README/docs and git history |

| The user says "I want to build...", "users should be able to..." | Use blueprint-derive-plans instead when the cue is a tech-choice decision worth an ADR |

| The user compares trade-offs ("should we use X or Y?") | Use document-linking instead to wire IDs across already-created docs |

| Implementation scope is being discussed and warrants a PRP | Use blueprint-prp-create instead when you've already decided to author a PRP |

When This Skill Activates

This skill is loaded when conversation context suggests documentation opportunities:

Prerequisites

Document detection requires:

  1. Blueprint initialized in project (docs/blueprint/manifest.json exists)
  2. has_document_detection: true in manifest structure
  3. docs/ directory structure created

Check prerequisites before prompting:

# Verify blueprint is initialized with document detection enabled
jq -r '.structure.has_document_detection // false' docs/blueprint/manifest.json 2>/dev/null

Detection Patterns

PRD Indicators (Product Requirements)

Primary triggers (confidence +0.5 each):

Confidence boosters (+0.1-0.2 each):

Example triggers: references/example-triggers.md.

ADR Indicators (Architecture Decisions)

Primary triggers (confidence +0.5 each):

Confidence boosters (+0.1-0.2 each):

Example triggers: references/example-triggers.md.

PRP Indicators (Implementation Prompts)

Primary triggers (confidence +0.5 each):

Confidence boosters (+0.1-0.2 each):

Example triggers: references/example-triggers.md.

Confidence Calculation

Threshold for prompting: >= 0.7

Base confidence: 0.0
+ Primary trigger matched: +0.5
+ Additional primary trigger: +0.3
+ Each booster matched: +0.1 to +0.2

Total >= 0.7 → Prompt user
Total < 0.7 → Continue without prompting

Examples:

Detection Flow

When confidence >= 0.7, execute this flow:

Step 1: Prompt User

Use AskUserQuestion to confirm document creation:

question: "This looks like a [PRD/ADR/PRP] opportunity. Would you like to document it?"
options:
  - label: "Yes, create [document type]"
    description: "I'll gather context and create the document"
  - label: "Add to backlog"
    description: "Record this topic for later documentation"
  - label: "Not now, remind me later"
    description: "Continue conversation, prompt again if topic expands"
  - label: "No, just continue"
    description: "Skip documentation for this topic"

Step 1.5: Backlog Path (if "Add to backlog" selected)

For ADR opportunities, append the decision topic to the Proposed ADRs section in docs/adrs/README.md:

  1. Check that docs/adrs/README.md exists (create from template if missing)
  2. Append a bullet to the Proposed ADRs section:

```markdown

```

  1. Remove the _No proposed ADRs at this time._ placeholder if present
  2. Confirm to user: "Added to proposed ADRs backlog. Run /blueprint:derive-plans when ready to document it fully."

For PRD/PRP opportunities, note the topic in the conversation and suggest revisiting later. No persistent backlog file exists for these types yet.

Step 2: Gather Clarification (if accepted)

Ask context-specific questions based on document type:

Use the PRD (primary users), ADR (constraints), or PRP (priority and scope) prompt from references/clarification-prompts.md.

Step 3: Prepare Context Package

Extract from conversation:

For ADR: Infer Domain

Map discussion topics to an ADR domain with the keyword table in references/adr-domains.md.

Include inferred domain in context package for /blueprint:derive-plans.

Step 4: Delegate to Documentation Agent

Launch appropriate documentation command:

For PRD:

Run /blueprint:derive-plans with context:
- Feature description from conversation
- User types identified
- Requirements enumerated
- Success criteria discussed

For ADR:

Run /blueprint:derive-plans with context:
- Decision being made
- Options compared
- Constraints identified
- Trade-offs discussed
- Inferred domain (for conflict analysis)

For PRP:

Run /blueprint:prp-create with context:
- Feature scope
- Implementation approach
- Test strategy discussed
- Files/components planned

Step 5: Report Result

After document creation:

  1. Show document location (docs/prds/, docs/adrs/, or docs/prps/)
  2. Summarize key sections created
  3. Suggest next steps:

Session Tracking

To avoid duplicate prompts, track detected topics:

Track declined topics: Don't re-prompt for explicitly declined documentation

Track deferred topics: Re-prompt if significant new context is added (new requirements, new trade-offs, etc.)

Track created documents: Don't re-prompt for topics with existing documents

Session tracking uses conversation memory - no persistent storage needed.

Integration with Blueprint Commands

Document detection integrates with existing commands:

| Detection Type | Command Triggered | Document Location |

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

| PRD | /blueprint:derive-plans | docs/prds/{feature-name}.md |

| ADR | /blueprint:derive-plans | docs/adrs/{number}-{title}.md |

| PRP | /blueprint:prp-create | docs/prps/{feature-name}.md |

Configuration

Document detection is controlled by manifest flag:

{
  "structure": {
    "has_document_detection": true
  }
}

Enable during /blueprint:init or /blueprint:upgrade.

False Positive Prevention

To minimize interruptions:

  1. Require high confidence (>= 0.7) before prompting
  2. Don't prompt on vague statements:
  1. Don't re-prompt for same topic in same session
  2. Respect user choice: "No, just continue" stops all prompts for that topic

Quick Reference

| Document | Key Triggers | Confidence Threshold |

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

| PRD | Feature descriptions, user stories, requirements lists | >= 0.7 |

| ADR | Technology comparisons, trade-off discussions, "why" questions | >= 0.7 |

| PRP | Implementation intent, file planning, specific feature scope | >= 0.7 |

| User Response | Action |

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

| "Yes, create" | Gather clarification, delegate to command |

| "Not now" | Track topic, re-prompt if expanded |

| "No, continue" | Mark declined, never re-prompt |

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.