| name | code-reader |
| description | Read C# code files with XML documentation comments stripped to save context. Preserves important comments (TODO, HACK, NOTE). Use when reading code for analysis instead of documentation. |
Code Reader Skill
This skill reads C# code files while stripping XML documentation comments to reduce context consumption by 30-50%.
When to Use This Skill
- ALWAYS use this instead of Read tool when analyzing C# code
- When you need to understand code structure
- When analyzing complexity
- When finding members
- When generating tests
- Any time XML docs aren't needed
When NOT to Use This Skill
- When user explicitly asks for documentation
- When generating API documentation
- When examining XML doc examples
- When user says "show me the docs"
CRITICAL: Default Behavior
By default, ALWAYS use code-reader instead of Read for .cs files.
Exception: Only use Read if:
- User explicitly asks for documentation
- You're generating/updating XML docs
- File is not C# code
What Gets Stripped
Always Removed (30-50% context savings!)
/// <summary>
/// Gets the product by identifier
/// </summary>
/// <param name="id">The identifier</param>
/// <returns>The product</returns>
public Product GetById(int id)
Becomes:
public Product GetById(int id)
Always Preserved
// TODO: Refactor this after migration
// HACK: Workaround for legacy bug
// NOTE: Must run before validation
// FIXME: This breaks with null input
// WARNING: Performance bottleneck
These provide context code can't express - they stay!
Strip Modes
XmlDocsKeepSpecial (DEFAULT)
- Remove XML docs (///, /** */)
- Keep regular comments (//, /* */)
- Keep special comments (TODO, HACK, NOTE, etc.)
Use for: 99% of code reading
XmlDocsOnly
- Remove XML docs only
- Keep ALL other comments
Use for: When you want all implementation comments
AllComments
- Remove ALL comments
Use for: Absolute minimal context (rarely needed)
None
- Don't strip anything
Use for: When user wants full file with docs
API Endpoint
POST /transformation/strip-docs
Request:
{
"scope": "document",
"target": "src/Services/ProductService.cs",
"preservePublicApi": false
}
Response:
{
"isSuccess": true,
"data": {
"strippedContent": "...",
"originalLines": 847,
"strippedLines": 612,
"reduction": 27.7
}
}
How It Works
1. Start the Server
dotnet run --project D:\FractalDataworks\RoslynTools\src\CyberdineDevelopment.RoslynTools.Server
2. Load Solution
using CyberdineDevelopment.RoslynTools.Client;
var client = new RoslynWorkspaceClient("http://localhost:5000");
await client.LoadSolution(@"D:\MyProject\MyProject.sln");
3. Strip Documentation
// Strip docs from a document
var result = await client.StripDocumentation(
scope: "document",
target: "src/Services/ProductService.cs"
);
if (result.IsSuccess)
{
Console.WriteLine($"Original: {result.Data.OriginalLines} lines");
Console.WriteLine($"Stripped: {result.Data.StrippedLines} lines");
Console.WriteLine($"Saved: {result.Data.Reduction}%");
// Use stripped content for analysis
var strippedCode = result.Data.StrippedContent;
}
Process Flow
Get document from workspace → Parse syntax with Roslyn → Remove XML trivia → Return stripped code
Fast: In-memory syntax transformation Safe: Uses Roslyn semantic-aware trivia removal Smart: Preserves important comments (TODO, HACK, etc.) Workspace-Aware: Can strip docs from edited files before committing
Semantic Analysis Benefits
Using the Server API provides advantages:
- Workspace Integration: Strip docs from files already loaded in workspace
- No File I/O: Work with in-memory documents
- Batch Processing: Strip docs from multiple files efficiently
- Validation: Ensure code still compiles after stripping
- Preserve State: Stripped content available for other operations without re-parsing
Context Savings Example
Original file: ProductService.cs (847 lines)
/// <summary>
/// Product service for managing products
/// </summary>
public class ProductService
{
/// <summary>
/// Gets a product by its identifier
/// </summary>
/// <param name="id">The product identifier</param>
/// <returns>Result containing the product or error</returns>
public IGenericResult<Product> GetById(int id)
{
// TODO: Add caching here
return _repository.GetById(id);
}
/// <summary>
/// Gets all products
/// </summary>
/// <returns>List of all products</returns>
public IGenericResult<List<Product>> GetAll()
{
return _repository.GetAll();
}
}
After stripping: (612 lines, 28% reduction)
public class ProductService
{
public IGenericResult<Product> GetById(int id)
{
// TODO: Add caching here
return _repository.GetById(id);
}
public IGenericResult<List<Product>> GetAll()
{
return _repository.GetAll();
}
}
Savings: 235 lines = 28% less context!
Note: TODO comment preserved because it's important!
Integration with Other Skills
complexity-analyzer
BEFORE: Read file (with XML docs)
NOW: code-reader → Strip docs → Analyze
Benefit: Faster parsing, less context
member-identifier
BEFORE: Read file (with XML docs)
NOW: code-reader → Strip docs → Inspect members
Benefit: Member signatures already clear, docs redundant
dotnet-test-automation
BEFORE: Read file (with XML docs)
NOW: code-reader → Strip docs → Analyze → Generate tests
Benefit: Focus on code structure, not documentation
build-fixer
BEFORE: Read file (with XML docs)
NOW: code-reader → Strip docs → Fix errors
Benefit: Errors are about code, not docs
refactor
BEFORE: Read multiple files (with XML docs)
NOW: code-reader → Strip docs → Refactor
Benefit: When reading 5-10 files, 30% savings per file = huge!
CRITICAL: Auto-Invocation
These skills should use code-reader automatically:
- complexity-analyzer
- member-identifier
- dotnet-test-automation
- build-fixer (when reading files to fix)
- refactor
- type-finder (when showing context)
Never ask user: "Should I strip XML docs?" Just do it: It's always the right choice for code analysis.
Statistics Output
=== STRIPPING STATISTICS ===
Original lines: 847
Stripped lines: 612
Lines removed: 235
XML doc lines: 235
Reduction: 27.7%
Preserved comments: 3
// TODO: Add caching here
// HACK: Workaround for EF bug
// NOTE: Must validate before saving
When to Add XML Docs Back
After code-writer creates code without docs:
- User asks: "Add XML documentation"
- Use doc-generator skill (separate skill)
- Generate docs from signatures
- Write back with docs included
Workflow:
code-writer (no docs) → Write to disk → doc-generator → Update with docs
Benefit:
- Code generation uses minimal context
- Docs added as final polish
- Best of both worlds
Tool Usage
Command line:
# Default: Strip XML docs, keep special comments
dotnet run --project CodeStripper ProductService.cs
# Show statistics
dotnet run --project CodeStripper ProductService.cs --stats
# Save to file
dotnet run --project CodeStripper ProductService.cs --output=stripped.cs
# Strip all comments
dotnet run --project CodeStripper ProductService.cs --mode=all
In skill:
Instead of: Read ProductService.cs
Use: code-reader ProductService.cs
Example Usage
User: "Analyze complexity of ProductService"
Old way:
1. Read ProductService.cs (847 lines with XML docs)
2. Parse and analyze
3. Return complexity
New way:
1. code-reader ProductService.cs (612 lines, docs stripped)
2. Parse and analyze (28% less context!)
3. Return complexity
User: "Show me the ProductService documentation"
Response:
Use Read tool (not code-reader) because user wants docs
Benefits Summary
✅ 30-50% context savings on well-documented code ✅ Preserves important comments (TODO, HACK, etc.) ✅ Faster parsing (less text to process) ✅ Better focus (code structure, not redundant docs) ✅ Automatic (skills use it by default)
❌ Still have docs in actual files (not destructive) ❌ Can regenerate docs when needed (doc-generator skill)
Important Notes
- Non-destructive: Original files unchanged (works with workspace copies)
- In-memory only: Stripping happens in workspace, not on disk
- Roslyn-based: Syntax-aware trivia removal
- Fast: Minimal overhead, cached in workspace
- Automatic: Skills should use by default
- Server Integration: Works seamlessly with other workspace operations
Configuration
Can be configured per-skill or globally:
# .claude/code-reader-config.yml
default_mode: xml-keep-special
always_show_stats: false
preserve_keywords:
- TODO
- HACK
- FIXME
- NOTE
- BUG
- WARNING
- IMPORTANT
- CRITICAL
Summary
Problem: XML docs consume 30-50% of context but rarely add value during code analysis
Solution: Strip XML docs automatically, keep important comments
Result:
- More code analyzed per request
- Faster processing
- Better focus on structure
- Important context (TODO/HACK) preserved
Usage: Automatic in all code analysis skills
XML docs are for humans reading documentation. Code signatures are for Claude analyzing code.