code-explain-templates

code-explain-templates is a command for Claude Code from thapaliyabikendra/ai-artifacts. It costs 0 tokens per session (3,477 once invoked), scanned A, original, Apache-2.0.

A set of templates for explaining C#/.NET code, including its structure, complexity, common design patterns, and diagrams.

In plain words
What is it for?
Use it to document C#/.NET classes and methods, review complexity, identify patterns such as dependency injection, and create Mermaid flow or class diagrams.
Why use it?
It gives code explanations a consistent structure and helps readers understand hard-to-read code without starting from scratch each time.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/thapaliyabikendra/ai-artifacts/code-explain-templates
Clone the repo
git clone --depth 1 https://github.com/thapaliyabikendra/ai-artifacts

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-explain-templates

README.md
[![agentmods](https://agentmods.dev/badge/commands/thapaliyabikendra/ai-artifacts/code-explain-templates.svg)](https://agentmods.dev/commands/thapaliyabikendra/ai-artifacts/code-explain-templates)
Your own site
<a href="https://agentmods.dev/commands/thapaliyabikendra/ai-artifacts/code-explain-templates"><img src="https://agentmods.dev/badge/commands/thapaliyabikendra/ai-artifacts/code-explain-templates.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,477 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03477
Opus 5 $0.00000 $0.01739
Sonnet 5 $0.00000 $0.00695
Haiku 4.5 $0.00000 $0.00348

Measured 4d ago against content hash 5eef1d5be158, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-explain-templates scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/references/code-explain-templates.md · 624 lines

How it starts

The opening of the file, as written. The whole thing — 624 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Explanation Templates Reference

Templates and patterns for the /explain:code-explain command. All examples are C#/.NET focused.

Complexity Metrics

Code Analysis Checklist

## Code Complexity Analysis

| Metric | Value | Threshold |
|--------|-------|-----------|
| Lines of Code | {count} | <200 per class |
| Cyclomatic Complexity | {value} | <10 per method |
| Nesting Depth | {depth} | <4 levels |
| Method Count | {count} | <20 per class |
| Dependency Count | {count} | <10 per class |

### Identified Concepts
- [ ] Async/await patterns
- [ ] Dependency injection
- [ ] Repository pattern
- [ ] Unit of Work
- [ ] CQRS pattern

Visual Diagram Templates

Flow Diagram (Mermaid)

flowchart TD
    F0[MethodName]
    F0_params[/param1, param2/]
    F0_return[ReturnType]
    F0_params --> F0
    F0 --> F0_return
    F0 --> F1[CalledMethod]

Class Diagram (Mermaid)

classDiagram
    class ClassName {
        -privateField : Type
        +PublicProperty : Type
        -PrivateMethod() : void
        +PublicMethod(params) : ReturnType
    }
    IInterface <|.. ClassName : implements
    BaseClass <|-- ClassName : extends
    ClassName --> DependencyClass : uses

Sequence Diagram (Mermaid)

sequenceDiagram
    participant Controller
    participant AppService
    participant Repository
    participant Database

    Controller->>AppService: CreateAsync(dto)
    AppService->>Repository: InsertAsync(entity)
    Repository->>Database: INSERT INTO...
    Database-->>Repository: Success
    Repository-->>AppService: Entity
    AppService-->>Controller: DTO

Concept Explanations

Dependency Injection

## Understanding Dependency Injection

Dependency Injection (DI) is a design pattern where objects receive their dependencies from external sources rather than creating them internally.

**Simple Analogy**: Instead of a chef growing their own vegetables (tight coupling), vegetables are delivered to them (loose coupling). The chef doesn't need to know where vegetables come from.

**How it works in .NET**:
```csharp
// ❌ Without DI - tightly coupled
public class PatientService
{
    private readonly PatientRepository _repository = new PatientRepository();
    // Hard to test - can't mock the repository
}

Read the full file on GitHub · 624 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 624 lines · 0 tokens per session scan A 5eef1d5be158

Subscribe to this mod's changes

code-explain-templates is a command published in the GitHub repository thapaliyabikendra/ai-artifacts (24 stars, last pushed 5mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 3,477 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.