r/dotnet • • 20d ago

Promotion Wrote an agent skill so AI coding tools stop hallucinating API's for my WPF UIKIT.

I have been building and maintaining UI-Framework a small declarative C# framework and WPF on .NET 10 (MIT). The project was based on my love for swiftui.

Full Disclosure i did use ai tools to help me build it.

After my first initial releases i attempted to use my lib with other tools and it quickly became annoying. The frustration came in when using tools like Claude code or Cursor with a small niche lib, the ais quickly started spitting out code that looked right but either the API's didn't exist or for example they kept treating VStack/Hstack like css flexbox. Creating state<T> inside a Body leading to so any change would then cause a rebuild leaving stable keys off list rows and making up methods that did not exist.

This led me to write an agent skill that exposes the real contract (skills/ui-framework/SKILL.md, install steps in docs/agent-skill.md):

  • VStack/HStack size to their content. They aren't flexbox.

  • Keep State<T> out of Body().

  • Give list rows stable .Id() keys so identity survives updates and reorders.

  • Check signatures against the installed package version instead of guessing.

Repo: https://github.com/signalnotnoise/ui-framework Install: dotnet add package SignalNotNoise.UI.Wpf --version 1.0

For those maintaining lib, are you utilizing this method.

0 Upvotes

8 comments sorted by

3

u/OccassionalBaker 20d ago

A considered workspace - it looks like every single AI generated UI!

5

u/kassett43 20d ago

Isn't it interesting that AI has been trained on all the known code on the Internet, often in violation of copyright, yet it is only capable of generating one style of UI that is so obviously recognizable?

4

u/chucker23n 20d ago

it is only capable of generating one style of UI that is so obviously recognizable?

Yeah, one of the fundamental limitations of LLMs is that they’re stochastic. Ultimately, they’re going to trend towards the mean. They’re not gonna invent anything new, just remix what’s already out there.

1

u/CertifiedNoob5455 20d ago

I guess all the training in the world can’t give it taste 😅

0

u/CertifiedNoob5455 20d ago

Yeah that’s a fair assessment, the demo uses pretty default styling. The part I was trying to target was the API not the theme. The skill just keeps ai tools from inventing methods that don’t exist, I could make something a little fancier if that would help.

1

u/Discordbothost 20d ago

tiny typo in the install command: --vesion should be --version. worth fixing before people copy it and get stuck at the install step.

1

u/CertifiedNoob5455 19d ago

I’ll get it fixed asap 🙏

1

u/AutoModerator 20d ago

Thanks for your post CertifiedNoob5455. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.