# Debug Trail

> A Claude skill from tellmefrankie/ai-investment-skills.

- **Type:** Skill
- **Install:** `agentstack add skill-tellmefrankie-ai-investment-skills-debug-trail`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [tellmefrankie](https://agentstack.voostack.com/s/tellmefrankie)
- **Installs:** 0
- **Category:** [Finance & Payments](https://agentstack.voostack.com/c/finance-and-payments)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [tellmefrankie](https://github.com/tellmefrankie)
- **Source:** https://github.com/tellmefrankie/ai-investment-skills/tree/main/debug-trail
- **Website:** https://jaehyunpark.gumroad.com/l/tcyahy

## Install

```sh
agentstack add skill-tellmefrankie-ai-investment-skills-debug-trail
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Debug Trail

Automatically document your debugging session as you go. When the bug is fixed, you have a complete trail: what you tried, what you learned, what solved it.

## The problem

You spend 3 hours debugging. You find the fix. Your manager asks you to write it up. You stare at the blank Confluence page and try to remember what you tried 2 hours ago.

Or worse: the same bug comes back in 3 months and you have to debug it again from scratch.

## What it does

At the start of a debugging session, activate this skill. As you work, it tracks:

- Each hypothesis you formed and tested
- Commands run and their output
- Files examined and what you found
- Dead ends (just as important as the solution)
- The actual root cause and fix

At the end: structured bug report, ready to paste anywhere.

## Usage

**Start of session:**
```
Start debug trail for: TypeScript type error in options/analyzer.ts line 247
Error: Type 'string' is not assignable to type '"rising" | "falling" | "stable"'
```

**During session** — the skill tracks your work automatically as you run commands and read files.

**End of session:**
```
Close debug trail. Write up the full report.
```

## Example Report Output

```
# Debug Trail — TS2322 lottery_trend Type Error
Date: 2026-05-13 | Duration: 23 minutes | Status: RESOLVED

## The Bug
File: src/options/weekly-anomaly-report.ts:24
Error: Type 'string' is not assignable to type '"rising" | "falling" | "stable"'

## Root Cause
TypeScript's type narrowing failed on the ternary expression:
  const trend = last - first > 20 ? 'rising' : last - first < -20 ? 'falling' : 'stable'

TypeScript inferred `trend` as `string` (widened from string literals).
The TickerWeekly interface expected the literal union type.

## What I Tried

[DEAD END] Tried casting: `trend as 'rising' | 'falling' | 'stable'`
  → Works but is unsafe — type assertion, not type inference

[DEAD END] Tried `as const` on the ternary
  → Syntax error — as const only works on object/array literals

[SOLUTION] Explicit type annotation on the variable:
  const trend: 'rising' | 'falling' | 'stable' = ...
  → TypeScript now validates the ternary against the declared type

## Files Changed
- src/options/weekly-anomaly-report.ts:24 — added explicit type annotation

## Lesson Learned
When TypeScript widens string literal ternaries to `string`, add explicit
type annotation rather than casting. The annotation lets TS validate, the
cast just suppresses the error.

## Commands Run
- npx tsc --noEmit  (initial discovery)
- npx tsc --noEmit  (verification after fix)
```

## Why dead ends matter

Most bug reports only document the solution. That is only half the value.

The dead ends are what prevent the next person from trying the same wrong approaches. A 3-hour debug session with 2 hours of dead ends is more valuable to document than just the 1 hour that worked.

## Formats

**markdown** (default): Full structured report, paste into any doc tool

**jira**: Structured for Jira bug ticket description

**slack**: Compressed summary for #dev-incidents channel

**gist**: Ready to `gh gist create` directly

```
Close debug trail. Format: gist. Create it with gh CLI.
```

## Session commands

```
Start debug trail: [bug description]    — begin tracking
Hypothesis: [what I think is wrong]    — log a hypothesis
Tried: [what I just did]               — log an attempt
Dead end: [why this did not work]      — log a failure
Found: [what I discovered]             — log a discovery
Close debug trail                      — generate report
```

## Requirements

- Bash tool access (for command tracking)
- No API keys needed

## Free

Fully free and open source.

→ https://github.com/tellmefrankie/news-engine

## Author

Built after spending 4 hours on a bug, fixing it, and then having no record of what I tried. Three months later, the same bug appeared. Debugged it in 20 minutes because I had the trail from the first time.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [tellmefrankie](https://github.com/tellmefrankie)
- **Source:** [tellmefrankie/ai-investment-skills](https://github.com/tellmefrankie/ai-investment-skills)
- **License:** MIT
- **Homepage:** https://jaehyunpark.gumroad.com/l/tcyahy

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-tellmefrankie-ai-investment-skills-debug-trail
- Seller: https://agentstack.voostack.com/s/tellmefrankie
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
