Skip to content
Development
Command

/knowledge-extract

Extract comprehensive domain knowledge and architectural patterns using parallel analysis

From plugin
claude-cmd
313180 skills180 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/knowledge-extract

Context preview

What this command does when you run it.

Extract comprehensive domain knowledge and architectural patterns using parallel analysis

Command definition

knowledge-extract.md
allowed-tools: Task, Read, Write, Bash(fd:*), Bash(rg:*), Bash(jq:*), Bash(gdate:*), Bash(eza:*), Bash(bat:*)
name: "Knowledge Extract"
description: "Extract comprehensive domain knowledge and architectural patterns using parallel analysis"
author: "wcygan"
tags: ["meta","extract"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

Context

  • Session ID: !`gdate +%s%N`
  • Target project: $ARGUMENTS
  • Project structure: !`fd . -t d -d 3 | head -10 || echo "No directories found"`
  • Build system detection: !`fd "(deno\.json|package\.json|Cargo\.toml|go\.mod|pom\.xml|build\.gradle)" . -d 3 | head -5 || echo "No build files detected"`
  • Documentation exists: !`fd "(README|ARCHITECTURE|DESIGN|DOCS)" . -t f -d 2 | head -3 || echo "No docs found"`
  • Code languages: !`fd "\.(rs|go|java|ts|js|py|rb)$" . | head -5 | sed 's/.*\.//' | sort -u | tr '\n' ' ' || echo "No code files"`
  • Repository size: !`eza -la . | head -3 || ls -la . | head -3`

Your Task

STEP 1: Initialize knowledge extraction session with state management

  • CREATE session state file: `/tmp/knowledge-extract-state-$SESSION_ID.json`
  • INITIALIZE extraction scope and project boundaries
  • DETERMINE primary technology stacks and architectural complexity
  • ASSESS existing documentation completeness and quality gaps
echo '{' > /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "sessionId": "'$SESSION_ID'",' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "timestamp": "'$(gdate -Iseconds 2>/dev/null || date -Iseconds)'",' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "project": "'$ARGUMENTS'",' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "phase": "initialization",' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "completed_phases": [],' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "discovered_domains": [],' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "architectural_patterns": [],' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '  "knowledge_artifacts": []' >> /tmp/knowledge-extract-state-$SESSION_ID.json
echo '}' >> /tmp/knowledge-extract-state-$SESSION_ID.json

STEP 2: Parallel domain discovery using strategic sub-agent delegation

TRY:

  • LAUNCH 8 parallel sub-agents for comprehensive codebase analysis
  • EACH sub-agent focuses on specific architectural aspect
  • COORDINATE findings through session state management
  • SYNTHESIZE results for architectural understanding

**Parallel Sub-Agent Knowledge Extraction:**

LAUNCH parallel sub-agents for simultaneous domain analysis:

  • **Agent 1: Domain Model Discovery**: Analyze core business entities, data models, and domain types
  • Focus: struct/class/interface definitions, enums, data transfer objects
  • Extract: Business terminology, entity relationships, data constraints
  • Save findings: Domain entities, business rules, validation logic
  • **Agent 2: Service Architecture Analysis**: Map service layers, handlers, and business logic patterns
  • Focus: Service implementations, controllers, handlers, repositories
  • Extract: Service boundaries, dependency patterns, integration points
  • Save findings: Service interfaces, business workflows, architectural layers
  • **Agent 3: API & Interface Documentation**: Discover all external and internal APIs
  • Focus: REST endpoints, RPC services, GraphQL schemas, OpenAPI specs
  • Extract: API contracts, request/response patterns, authentication flows
  • Save findings: Endpoint inventory, API documentation, integration guides
  • **Agent 4: Data Architecture Mapping**: Analyze database schemas, migrations, and data flow
  • Focus: Migration files, ORM models, SQL queries, data transformations
  • Extract: Schema evolution, data relationships, query patterns
  • Save findings: Database design, data flow diagrams, migration strategies
  • **Agent 5: Business Logic & Workflow Analysis**: Identify state machines, business rules, and processes
  • Focus: State management, workflow engines, business calculations, validation rules
  • Extract: Business processes, state transitions, rule engines
  • Save findings: Workflow documentation, business rule catalog, process maps
  • **Agent 6: Configuration & Infrastructure Discovery**: Map deployment, configuration, and operational patterns
  • Focus: Config files, environment variables, deployment manifests, infrastructure as code
  • Extract: Deployment patterns, configuration management, operational procedures
  • Save findings: Deployment guides, configuration documentation, operational runbooks
  • **Agent 7: Error Handling & Monitoring Analysis**: Document error patterns, logging, and observability
  • Focus: Error definitions, logging patterns, metrics, monitoring, alerting
  • Extract: Error handling strategies, observability patterns, debugging guides
  • Save findings: Error catalogs, monitoring documentation, troubleshooting guides
  • **Agent 8: Testing & Quality Patterns**: Analyze testing strategies, coverage, and quality patterns
  • Focus: Test structure, mock patterns, integration tests, quality gates
  • Extract: Testing methodologies, quality standards, coverage patterns
  • Save findings: Testing guides, quality documentation, best practices

**Sub-Agent Coordination Protocol:**

  • Each sub-agent executes independently using Task tool
  • Results saved to session state under respective domains
  • Parallel execution provides 6-8x performance improvement
  • Failed agents report gracefully without blocking others
  • Main agent synthesizes findings across all domains

CATCH (analysis_failed):

  • LOG error details to session state
  • CONTINUE with available analysis results
  • DOCUMENT gaps and limitations in final report

STEP 3: Architectural synthesis and pattern identification

TRY:

  • AGGREGATE findings from all sub-agents
  • IDENTIFY cross-cutting architectural patterns
  • MAP domain relationships and dependencies
  • EXTRACT recurring design patterns and conventions
Read more
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Get the whole plugin