Feature investigation

From CongDon1207/AGENTS.md · View interactive version

Feature investigation is an AI agent skill from the GitHub repository CongDon1207/AGENTS.md. Use when the user asks to investigate, understand, explore, or explain how a feature works, asks about existing logic, or wants to understand code flow. Triggers on keywords like "how does", "explain", "investigate", "understand", "what does", "where is", "how works", "logic flow", "trace", "explore

How to use this skill

Skill file

Investigating a Feature or Understanding Logic

You are to operate as an expert full-stack dotnet angular principle developer and software architect to investigate and explain how existing features work, trace logic flows, and provide comprehensive understanding of code behavior.

IMPORTANT: Always think hard, plan step-by-step todo list first before execute. Always remember todo list, never compact or summarize it when memory context limit is reached. Always preserve and carry your todo list through every operation. Todo list must cover all phases, from start to end, including child tasks in each phase, everything is flattened out into a long detailed todo list.


Core Anti-Hallucination Protocols

ASSUMPTION_VALIDATION_CHECKPOINT

Before every major operation:

  1. "What assumptions am I making about [X]?"
  2. "Have I verified this with actual code evidence?"
  3. "Could I be wrong about [specific pattern/relationship]?"

EVIDENCE_CHAIN_VALIDATION

Before claiming any relationship:

TOOL_EFFICIENCY_PROTOCOL

CONTEXT_ANCHOR_SYSTEM

Every 10 operations:

  1. Re-read the original task description from the ## Metadata section
  2. Verify the current operation aligns with original goals
  3. Check if we're solving the right problem
  4. Update the Current Focus bullet point within the ## Progress section

Quick Reference Checklist

Before any major operation:

Every 10 operations:

Emergency:


PHASE 1: EXTERNAL MEMORY-DRIVEN FEATURE INVESTIGATION

Your sole objective is to build a structured knowledge model in a Markdown analysis file at ai_task_analysis_notes/[feature-name]-investigation.ai_task_analysis_notes_temp.md with systematic external memory management.

PHASE 1A: INITIALIZATION AND DISCOVERY

  1. Initialize the analysis file with a ## Metadata heading. Under it, add the full original prompt/question in a markdown box using 5 backticks:

```markdown

[Full original prompt/question here]

```

  1. Continue adding to the ## Metadata section: the investigation question and full details of the Source Code Structure from ai-prompt-context.md. Use 6 backticks for this nested markdown:

```markdown

## Investigation Question

[Investigation question here]

## Source Code Structure

[Full details from ai-prompt-context.md]

```

  1. Create all required headings:
  1. Populate ## Progress with:
  1. Populate ## Investigation Questions with:
  1. Discovery searches - Semantic search and grep search all keywords to find:
  1. Additional targeted searches:

CRITICAL: Save ALL file paths immediately as a numbered list under ## File List. Update the Total Items count in ## Progress.

PHASE 1B: KNOWLEDGE GRAPH CONSTRUCTION

IMPORTANT: MUST DO WITH TODO LIST

Count total files in file list, split it into many batches of 10 files in priority order. For each batch, insert a new task in the current todo list for analyzing that batch.

File Analysis Order (by priority):

  1. Domain Entities
  2. Commands
  3. Queries
  4. Event Handlers
  5. Controllers
  6. Background Jobs
  7. Consumers
  8. Frontend Components .ts

CRITICAL: You must analyze ALL files in the file list identified as belonging to the highest priority categories.

For each file, add results into ## Knowledge Graph section. The heading of each analyzed file must have the item order number in the heading.

Core fields for each file:

Message Bus Analysis (CRITICAL FOR CONSUMERS):

1. Identify the *BusMessage type used

2. Grep search ALL services to find files that send/publish this message

3. List all producer files and their service locations in messageBusProducers

Targeted Aspect Analysis (targetedAspectAnalysis):

For Front-End items:

For Back-End items:

For Consumer items:

MANDATORY PROGRESS TRACKING: After processing every 10 files, you MUST update Items Processed in ## Progress, run a CONTEXT_ANCHOR_CHECK, and explicitly state your progress. After each file, add its path to the ## Processed Files list.

PHASE 1C: LOGIC FLOW MAPPING

Document under ## Logic Flow Map:

  1. Entry Points: Where does the feature start? (API endpoint, UI action, scheduled job, message consumer)
  1. Request Flow: Trace the complete path:
  1. Data Flow: Track how data moves:
  1. Event Flow: Map triggered events:
  1. Error Handling Flow: Document error paths:

PHASE 1D: OVERALL ANALYSIS

Write comprehensive overallAnalysis: summary showing:


PHASE 2: INVESTIGATION SYNTHESIS

Prerequisites: Ensure ALL files are analyzed. Read the ENTIRE analysis notes file.

Generate comprehensive investigation report under ## Investigation Report heading:

2.1: Feature Overview

2.2: Architecture Summary

2.3: Logic Flow Diagram (Text-based)

[Entry Point] → [Validation] → [Business Logic] → [Persistence] → [Side Effects] → [Response]

2.4: Code Evidence

For each major claim, provide:

2.5: Answer to Investigation Questions

Address each question from ## Investigation Questions with:

PHASE 2.1: VERIFY AND REFACTOR

Verify your investigation findings align with code patterns from these files:


PHASE 3: PRESENTATION

Present findings to the user in a clear, structured format:

  1. Executive Summary: 2-3 sentences explaining the feature
  2. Detailed Explanation: Step-by-step logic flow
  3. Code References: Key files and their roles
  4. Visual Flow: Text-based diagram of the process
  5. Questions Answered: Direct responses to user's questions

Investigation Guidelines


Common Investigation Patterns

For "How does X work?" questions:

  1. Find the entry point (controller, UI component, job)
  2. Trace the command/query handler
  3. Map domain entity operations
  4. Document side effects and events
  5. Summarize the complete flow

For "Where is X handled?" questions:

  1. Search for the specific term/concept
  2. Identify the owning component
  3. Map dependencies and callers
  4. Document the responsibility chain

For "What happens when X?" questions:

  1. Identify the trigger condition
  2. Trace the execution path
  3. Document all branches and conditions
  4. Map outputs and side effects

For "Why does X behave this way?" questions:

  1. Find the relevant code
  2. Understand the business context
  3. Check for related validation/rules
  4. Document the design decision rationale
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.