Skip to content

[Coding Agent] Add find-allocation-opportunities skill#8386

Draft
lucaspimentel wants to merge 3 commits intomasterfrom
lpimentel/allocations-claude-skill
Draft

[Coding Agent] Add find-allocation-opportunities skill#8386
lucaspimentel wants to merge 3 commits intomasterfrom
lpimentel/allocations-claude-skill

Conversation

@lucaspimentel
Copy link
Copy Markdown
Member

@lucaspimentel lucaspimentel commented Mar 27, 2026

Summary of changes

Add a Claude Code skill that scans code for heap allocation opportunities in hot paths, codifying 22+ proven allocation-avoidance patterns used by the team.

Reason for change

The dd-trace-dotnet tracer runs in-process with customer applications, so heap allocations in hot paths directly impact customer GC pressure. The team has accumulated significant tribal knowledge about allocation-avoidance patterns. This skill makes that knowledge consistently available to AI-assisted code reviews and allocation audits.

Implementation details

  • SKILL.md: Skill definition with triggering keywords, assessment criteria (severity levels, confidence thresholds), and structured output format for allocation findings
  • references/patterns.md: 22+ proven allocation-avoidance patterns with before/after examples (e.g., ArraySegment<T> over Array.Copy, struct enumerators, TryFormat over ToString(), tag list pre-sizing)
  • references/anti-patterns.md: Common allocation anti-patterns organized by category (string operations, collections, LINQ, boxing, closures, async, logging) with severity ratings and fixes

Test coverage

N/A — skill definition files only (no compiled code).

Other details

The skill covers both scanning existing code and reviewing PR diffs for missed optimization opportunities. It prioritizes findings by hot-path proximity and uses confidence-based filtering to minimize false positives.

🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
@lucaspimentel lucaspimentel added AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos for-ai-agents 🤖 files used by AI agents, not humans and removed area:docs labels Mar 27, 2026
@lucaspimentel lucaspimentel changed the title [Claude Code] Add find-allocation-opportunities skill [Coding Agent] Add find-allocation-opportunities skill Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos for-ai-agents 🤖 files used by AI agents, not humans

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant