Tools

PostSharp 2027.0 gives AI coding agents the real API and build facts

PostSharp 2027.0 adds tooling that helps AI coding agents work correctly in PostSharp projects, including a plugin for Claude Code and Codex. The release also brings CLI commands that show which aspects were applied to a declaration after a build, per-message error documentation, and an aspect test framework. These are useful for .NET developers who write or maintain aspects.

Metalama / PostSharp Blog Gaël Fraiteur
Published
Reading time
4 min read
agent run #15
agent run #15
Go to original postsharp.net

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Key points

  • For Claude Code, add the marketplace with /plugin marketplace add https://github.com/postsharp/PostSharp.AI.Skills, then run /plugin install postsharp
  • Use postsharp introspect show declaration <file:line> to list the aspects applied to a method and the order in which they ran
  • The introspect commands read projects built with PostSharp 2023.0 through 2026.0 on Windows, Linux and macOS
  • Install the PostSharp.Tool global tool with --prerelease to get the introspect commands, available from 2027.0.7-preview
  • The Errors and Warnings reference has one article per message code, such as PS0215, with its cause and fix, from 2027.0.5-preview
  • The aspect test framework compares program output, build messages and woven code snapshots (.t.cs files) for each test

When an AI agent works on a PostSharp project, it cannot see the logging, caching or thread safety code that the compiler adds during the build, so it reasons from incomplete information. PostSharp 2027.0 tackles this with three additions: a plugin for Claude Code and Codex, postsharp introspect commands that report which aspects apply to a declaration after a build, and a documentation page for every build message code. The plugin gives the agent the API reference and examples, and tells it to check the API before writing code and to verify the result with a build.

The introspect commands print stable JSON, cap long lists to fit a context window, and support batched queries. The new PostSharp.Testing.AspectTesting package, built on xunit.v3, compiles each test file, weaves it, verifies the IL and compares the output with expected files. These features are in preview releases and are not supported for production use yet.

Real-world use

  • An enterprise .NET service where logging and authorization aspects are shared across teams and the AI agent must apply them correctly
  • A team writing its own aspect library that wants the agent to fix build messages from the documentation instead of removing the aspect
  • Library development where aspect behavior is checked with output tests and woven-code snapshots

Why it matters

Agents working on PostSharp code can check the real API and the applied aspects after each build instead of guessing, which makes their output easier to review. The features are still in preview, so check the release status before relying on them in production.

This summary was generated by the agent from the original post on Metalama / PostSharp Blog. The full text and all rights belong to its author and publisher. Go to original

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message