RecursiveExtractor
Copilot instructions221 starsChanged 10 months agoMITView on GitHub
RecursiveExtractor is a cross-platform .NET library and CLI tool for parsing archive files and disk images, including nested archives. It provides a unified interface to extract arbitrary archives using libraries like SharpCompress and DiscUtils. ⚠️ Important: This repository uses Nerdbank.GitVersioning (NBGV) to calculate version numbers from git history. Shallow clones will cause the build to fail with a GitException: Shallow clone lacks the objects required to calculate version height error. If you encounter this, deepen the clone: ⚠️ Important: The…
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
20 rules. About 0 are common, 13 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 71
Use 4 spaces for indentation (no tabs)
- Very specific: line 74
Use var for local variables when type is apparent
- Distinctive: line 75
Follow PascalCase for types, methods, and properties
- Very specific: line 77
Do not use this. qualifier unless necessary
- Very specific: line 80
Interfaces: Start with 'I' (e.g., ICustomAsyncExtractor)
- Very specific: line 88
Prefer pattern matching over as with null checks
- Distinctive: line 89
Use expression-bodied members for simple properties and accessors
- Very specific: line 90
Prefer null propagation (?.) when appropriate
- Distinctive: line 91
Use async/await for I/O operations
- Distinctive: line 99
Use xUnit as the testing framework
- Distinctive: line 100
Test files should mirror the structure of source files
- Distinctive: line 103
Use descriptive test names that explain what is being tested
- Distinctive: line 107
Test archives and files should be placed in appropriate test data directories
- Distinctive: line 113
Always validate file paths to prevent directory traversal attacks
- Distinctive: line 119
Add XML documentation comments for public APIs
- Distinctive: line 120
Keep README.md updated with new features or changes
- Distinctive: line 121
Document breaking changes clearly
- Very specific: line 136
Use Extractor class as the main entry point
- Very specific: line 151
Use ExtractSelfOnFail option to return original archive on failure
- Distinctive: line 159
Avoid multiple enumeration of extraction results
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Copilot Instructions for RecursiveExtractor
Project Overview
RecursiveExtractor is a cross-platform .NET library and CLI tool for parsing archive files and disk images, including nested archives. It provides a unified interface to extract arbitrary archives using libraries like SharpCompress and DiscUtils.
Tech Stack
- Language: C# 10.0
- Target Frameworks: .NET Standard 2.0, .NET Standard 2.1, .NET 8.0, .NET 9.0, .NET 10.0
- Testing Framework: xUnit (based on project structure)
- Key Dependencies: SharpCompress, LTRData.DiscUtils, NLog, Glob
Building and Testing
Git Clone Depth
⚠️ Important: This repository uses Nerdbank.GitVersioning (NBGV) to calculate version numbers from git history. Shallow clones will cause the build to fail with a GitException: Shallow clone lacks the objects required to calculate version height error. If you encounter this, deepen the clone:
git fetch --unshallow
# or if that fails:
git fetch --depth=100Build Commands
# Build the entire solution
dotnet build RecursiveExtractor.sln
# Build a specific project
dotnet build RecursiveExtractor/RecursiveExtractor.csprojTest Commands
# Run all tests
dotnet test RecursiveExtractor.sln
# Run tests for a specific project
dotnet test RecursiveExtractor.Tests/RecursiveExtractor.Tests.csproj
dotnet test RecursiveExtractor.Cli.Tests/RecursiveExtractor.Cli.Tests.csprojRestore Packages
dotnet restore RecursiveExtractor.slnNuGet Configuration
⚠️ Important: The repository uses a private NuGet feed configured in nuget.config:
- The
nuget.configfile points to a private Azure DevOps feed:https://pkgs.dev.azure.com/microsoft-sdl/General/_packaging/PublicRegistriesFeed/nuget/v3/index.json - When working as an agent, you may need to temporarily modify
nuget.configto use public NuGet feeds (e.g.,https://api.nuget.org/v3/index.json) to restore packages successfully - ALWAYS restore the
nuget.configto its original configuration before completing your work - The original configuration must be preserved to maintain consistency with the team's workflow
Example of temporarily switching to public feed:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>Code Style Guidelines
Follow .editorconfig Settings
- Use 4 spaces for indentation (no tabs)
- CRLF line endings
- Open braces on new lines
- Use
varfor local variables when type is apparent - Follow PascalCase for types, methods, and properties
- Interfaces should begin with 'I'
- Do not use
this.qualifier unless necessary
Naming Conventions
- Interfaces: Start with 'I' (e.g.,
ICustomAsyncExtractor) - Classes: PascalCase (e.g.,
FileEntry,Extractor) - Methods: PascalCase (e.g.,
Extract,ExtractAsync) - Properties: PascalCase (e.g.,
FullPath,Content) - Parameters: camelCase (e.g.,
fileEntry,options)
C# Best Practices
- Enable nullable reference types (project uses
<Nullable>Enable</Nullable>) - Prefer pattern matching over
aswith null checks - Use expression-bodied members for simple properties and accessors
- Prefer
nullpropagation (?.) when appropriate - Use async/await for I/O operations
- Implement both synchronous and asynchronous versions of extraction methods
Testing Practices
Test Organization
- Unit tests go in
RecursiveExtractor.Testsproject - CLI tests go in
RecursiveExtractor.Cli.Testsproject - Use xUnit as the testing framework
- Test files should mirror the structure of source files
Test Naming
- Use descriptive test names that explain what is being tested
- Follow pattern:
MethodName_StateUnderTest_ExpectedBehavior
Test Data
- Test archives and files should be placed in appropriate test data directories
- Include edge cases: nested archives, encrypted files, malformed content, zip bombs
Security Considerations
- The library includes protections against ZipSlip, Quines, and Zip Bombs
- Always validate file paths to prevent directory traversal attacks
- Handle malformed archives gracefully without crashes
- Implement proper resource cleanup (dispose streams, file handles)
Documentation
- Add XML documentation comments for public APIs
- Keep README.md updated with new features or changes
- Document breaking changes clearly
- Include code examples for new public APIs
Project Structure
RecursiveExtractor/ # Main library project
RecursiveExtractor.Tests/ # Unit tests for library
RecursiveExtractor.Cli/ # Command-line interface project
RecursiveExtractor.Cli.Tests/ # Tests for CLICommon Patterns
Extraction Pattern
- Use
Extractorclass as the main entry point - Support both
Extract()(sync) andExtractAsync()(async) methods - Return
IEnumerable<FileEntry>orIAsyncEnumerable<FileEntry> - Each
FileEntrycontains a Stream of content that should be disposed properly
Custom Extractors
- Implement
ICustomAsyncExtractorfor new archive formats - Include
CanExtract()method to detect file format via magic bytes - Preserve stream position in
CanExtract() - Support both sync and async extraction
Error Handling
- Throw
OverflowExceptionfor detected quines or zip bombs - Throw
TimeoutExceptionwhen timing limits are exceeded - Log errors and skip invalid files during extraction
- Use
ExtractSelfOnFailoption to return original archive on failure
Important Notes
- Multi-targeting means code must be compatible with .NET Standard 2.0
- Some features (like WIM support) are Windows-only
- The library automatically detects archive types
- Streams in FileEntry objects should be disposed by consumers
- Avoid multiple enumeration of extraction results
- For parallel processing, use batching mechanism as documented in README
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

