agentleFS
MicrosoftKnown publishermicrosoft/ApplicationInspector/.github/copilot-instructions.md

ApplicationInspector

Copilot instructions4.4k starsChanged 10 months agoMITView on GitHub

Microsoft Application Inspector is a source code characterization tool that identifies coding features based on well-known library/API calls using regex patterns and rules. It supports multiple programming languages and generates reports in HTML, JSON, SARIF, and text formats. Version Tracking: This project uses Nerdbank.GitVersioning (nbgv) for version tracking, which requires a deep clone of the repository. Shallow clones will not work correctly with version generation. NuGet Packages: The repository uses a custom nuget.config that points to a private Azure DevOps…

Trending

Quiet since February.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/ApplicationInspector repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/ApplicationInspector

The biggest 5 of 29 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 29

Talked about on GitHub and Hacker News (29 times).

On GitHub · 24

19 more on GitHub

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

31 rules. About 0 are common, 19 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    IMPORTANT: Never check in changes to nuget.config.

    line 39
  2. Distinctive:

    Follow standard C# naming conventions (PascalCase for public members, camelCase for private fields)

    line 83
  3. Distinctive:

    Use meaningful, descriptive names for variables, methods, and classes

    line 84
  4. Distinctive:

    Keep methods focused and single-purpose

    line 85
  5. Distinctive:

    Add XML documentation comments for public APIs

    line 86
  6. Distinctive:

    Use nullable reference types where appropriate

    line 87
  7. Very specific:

    Prefer var for local variables when the type is obvious

    line 88
  8. Distinctive:

    Use LINQ for collection operations when it improves readability

    line 89
  9. Very specific:

    Namespace Structure: Follow the project name structure (e.g., Microsoft.ApplicationInspector.Commands)

    line 93
  10. Very specific:

    Logging: Use the logging infrastructure from AppInspector.Logging namespace

    line 94
  11. Distinctive:

    Async/Await: Use async methods for I/O operations.

    line 96
  12. Distinctive:

    Use specific patterns: Prefer specific API/class names over generic words to reduce false positives

    line 133
  13. Very specific:

    Word boundaries: Use \b in regex patterns or regexword type to prevent matching substrings

    line 134
  14. Very specific:

    Avoid catastrophic backtracking: Don't use unlimited repetition patterns like .* in regex

    line 135
  15. Very specific:

    Conditions: Use conditions with same-line search to ensure API methods are invoked, not just referenced

    line 139
  16. Very specific:

    Pattern for invocation: Use .Method( patterns instead of Class.Method to catch actual usage via variables

    line 140
  17. Distinctive:

    Ensure new rule IDs don't conflict with existing ones

    line 174
  18. Very specific:

    Test classes organized under AppInspector.Tests/Commands/

    line 182
  19. Very specific:

    Test data located in AppInspector.Tests/TestData/

    line 183
  20. Distinctive:

    Use descriptive test method names that explain what is being tested

    line 184
  21. Very specific:

    Use test fixtures (IClassFixture<>) for shared setup/teardown

    line 185
  22. Distinctive:

    No hardcoded secrets: Never commit credentials, API keys, or sensitive data

    line 206
  23. Distinctive:

    Safe regex: Avoid regex patterns that can cause catastrophic backtracking

    line 208
  24. Distinctive:

    Secure defaults: Use secure defaults for cryptographic operations

    line 209
  25. Very specific:

    Sanitization: Use appropriate sanitizers (e.g., html_escape) to prevent injection vulnerabilities

    line 210
  26. Distinctive:

    Regex compilation: Consider caching compiled regex patterns for frequently used rules

    line 214
  27. Distinctive:

    File I/O: Use async I/O for file operations

    line 215
  28. Distinctive:

    Rule regex performance: Avoid complex regex patterns that can cause performance issues on large files

    line 221
  29. Distinctive:

    False positives: Test rules thoroughly to minimize false positive detections

    line 222
  30. Distinctive:

    Platform dependencies: Ensure code works across Windows, Linux, and macOS

    line 224
  31. Distinctive:

    Check BUILD.md for detailed build instructions

    line 266

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

GitHub Copilot Instructions for ApplicationInspector

Project Overview

Microsoft Application Inspector is a source code characterization tool that identifies coding features based on well-known library/API calls using regex patterns and rules. It supports multiple programming languages and generates reports in HTML, JSON, SARIF, and text formats.

Tech Stack

  • Language: C# (supports netstandard2.1; .NET 8.0+ for executables; aims to support all currently supported .NET versions)
  • Build System: dotnet CLI
  • Test Framework: xUnit
  • Solution Structure: Multi-project .NET solution with 7 projects
  • Rule Format: JSON files following rule-schema-v1.json schema definition in repository root

Project Structure

  • AppInspector.CLI/ - Command-line interface application
  • AppInspector/ - Core commands library (AppInspector.Commands.csproj)
  • AppInspector.RulesEngine/ - Rule processing and pattern matching engine
  • AppInspector.Common/ - Common utilities and types
  • AppInspector.Logging/ - Logging infrastructure
  • AppInspector.Tests/ - Test suite using xUnit
  • AppInspector.Benchmarks/ - Performance benchmarks
  • AppInspector/rules/default/ - Built-in detection rules organized by category

Build and Test Commands

Important Build Notes

Version Tracking: This project uses Nerdbank.GitVersioning (nbgv) for version tracking, which requires a deep clone of the repository. Shallow clones will not work correctly with version generation.

NuGet Packages: The repository uses a custom nuget.config that points to a private Azure DevOps feed. If you need to restore packages and don't have access to the private feed, you may need to temporarily modify nuget.config to pull from nuget.org instead:

<packageSources>
  <clear />
  <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>

IMPORTANT: Never check in changes to nuget.config. The private feed configuration should remain in the repository.

Building

# Build debug version
dotnet build

# Build release version
dotnet build -c Release

# Platform-specific publish
dotnet publish -c Release -r win10-x64
dotnet publish -c Release -r linux-x64
dotnet publish -c Release -r osx-x64

Testing

# Run all tests
dotnet test

# Run specific test project
dotnet test AppInspector.Tests/AppInspector.Tests.csproj

# Run tests with verbose output
dotnet test --verbosity normal

Running the CLI

# Analyze code
dotnet run --project AppInspector.CLI -- analyze -s path/to/source

# Verify rules
dotnet run --project AppInspector.CLI -- verifyrules -r path/to/rules

# Export tags
dotnet run --project AppInspector.CLI -- exporttags

Coding Standards and Conventions

General C# Guidelines

  • Follow standard C# naming conventions (PascalCase for public members, camelCase for private fields)
  • Use meaningful, descriptive names for variables, methods, and classes
  • Keep methods focused and single-purpose
  • Add XML documentation comments for public APIs
  • Use nullable reference types where appropriate
  • Prefer var for local variables when the type is obvious
  • Use LINQ for collection operations when it improves readability

Specific Project Conventions

  • Namespace Structure: Follow the project name structure (e.g., Microsoft.ApplicationInspector.Commands)
  • Logging: Use the logging infrastructure from AppInspector.Logging namespace
  • Error Handling: Return structured result types rather than throwing exceptions for expected failures
  • Async/Await: Use async methods for I/O operations; follow the Task-based Asynchronous Pattern (TAP)

Rule Development Guidelines

Rule File Structure

Rules are JSON files located in AppInspector/rules/default/ organized by category:

  • cryptography/ - Cryptographic operations
  • security_feature/ - Security-related features (authentication, authorization, etc.)
  • data_handling/ - Database, serialization, deserialization
  • os/ - Operating system operations (file I/O, process execution, reflection)
  • cloud_services/ - Cloud platform APIs
  • frameworks/ - Framework detection
  • And more...

Rule Schema Requirements

The rule schema is defined in rule-schema-v1.json in the repository root.

Each rule must include:

  • id - Unique identifier (format: AI######, e.g., AI038900)
  • name - Human-readable name
  • tags - Array of tags describing the feature (e.g., "Authentication.Microsoft.Online")
  • patterns - Array of pattern objects for detection
  • description - Optional detailed description
  • severity - Optional: Critical, Important, Moderate, BestPractice, ManualReview, Unspecified
  • applies_to - Optional: array of language identifiers (e.g., ["csharp", "java"])

Pattern Types

  • string - Literal string match
  • regex - Regular expression
  • regexword - Regex with word boundaries automatically added
  • substring - Substring match

Pattern Best Practices

  1. Use specific patterns: Prefer specific API/class names over generic words to reduce false positives
  2. Word boundaries: Use \b in regex patterns or regexword type to prevent matching substrings
  3. Avoid catastrophic backtracking: Don't use unlimited repetition patterns like .* in regex
  4. Test cases: Include must-match and must-not-match test cases in rules for validation
  5. Confidence levels: Set appropriate confidence (high, medium, low) based on pattern specificity
  6. Scopes: Specify appropriate scopes (code, comment) to limit false positives
  7. Conditions: Use conditions with same-line search to ensure API methods are invoked, not just referenced
  8. Pattern for invocation: Use .Method( patterns instead of Class.Method to catch actual usage via variables

Example Rule Pattern

{
  "name": "Authentication: Microsoft (Identity)",
  "id": "AI038900",
  "description": "Authentication using Microsoft Identity Platform (ADAL/MSAL)",
  "tags": ["Authentication.Microsoft.Online"],
  "severity": "critical",
  "patterns": [
    {
      "pattern": "microsoft\\.msal",
      "type": "regexword",
      "scopes": ["code"],
      "confidence": "high"
    },
    {
      "pattern": "AcquireTokenForClient",
      "type": "regexword",
      "scopes": ["code"],
      "confidence": "high"
    }
  ]
}

Note: This is a simplified example. Real rules may use alternation (e.g., pattern1|pattern2) to match multiple alternatives in a single pattern.

Rule ID Conventions

  • Rule IDs follow consistent patterns within categories
  • Authentication rules: AI038900 - AI041999 range
  • Ensure new rule IDs don't conflict with existing ones
  • Sequential numbering within a category

Testing Conventions

Test Organization

  • Tests use xUnit framework
  • Test classes organized under AppInspector.Tests/Commands/
  • Test data located in AppInspector.Tests/TestData/
  • Use descriptive test method names that explain what is being tested
  • Use test fixtures (IClassFixture<>) for shared setup/teardown

Test Patterns

[Fact]
public void TestMethodName_Scenario_ExpectedBehavior()
{
    // Arrange
    var options = new AnalyzeOptions { /* ... */ };
    
    // Act
    var result = command.GetResult();
    
    // Assert
    Assert.True(result.ResultCode == AnalyzeResult.ExitCode.Success);
}

Security Considerations

  • No hardcoded secrets: Never commit credentials, API keys, or sensitive data
  • Input validation: Validate all user inputs, especially file paths and patterns
  • Safe regex: Avoid regex patterns that can cause catastrophic backtracking
  • Secure defaults: Use secure defaults for cryptographic operations
  • Sanitization: Use appropriate sanitizers (e.g., html_escape) to prevent injection vulnerabilities

Performance Considerations

  • Regex compilation: Consider caching compiled regex patterns for frequently used rules
  • File I/O: Use async I/O for file operations
  • Memory usage: Be mindful of memory when processing large codebases
  • Parallel processing: Leverage parallel processing where appropriate for scanning multiple files

Common Pitfalls to Avoid

  1. Rule regex performance: Avoid complex regex patterns that can cause performance issues on large files
  2. False positives: Test rules thoroughly to minimize false positive detections
  3. Breaking changes: Maintain backward compatibility in rule schema and command-line interface
  4. Platform dependencies: Ensure code works across Windows, Linux, and macOS
  5. Resource cleanup: Properly dispose of file handles and other resources

Code Review Checklist

Before submitting changes:

  • Code builds without errors (dotnet build)
  • All tests pass (dotnet test)
  • New rules include test cases (must-match and must-not-match)
  • New rules validate successfully (dotnet run --project AppInspector.CLI -- verifyrules)
  • XML documentation added for public APIs
  • No hardcoded secrets or sensitive data
  • Changes are backward compatible
  • Performance impact considered for rule changes

Useful Commands

# Verify rule syntax
dotnet run --project AppInspector.CLI -- verifyrules -r AppInspector/rules/default/

# Pack rules into single file
dotnet run --project AppInspector.CLI -- packrules -r AppInspector/rules/default/ -o packed-rules.json

# Run benchmarks
dotnet run --project AppInspector.Benchmarks -c Release

# Clean build artifacts
dotnet clean

Resources

Getting Help

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.