generator.equals
Guidance for using Generator.Equals — a C# source generator for auto-generating Equals, GetHashCode, operators, and Diff/Inequalities methods via attributes.
Install / Use
npx skills add diegofrata/Generator.Equals --skill skillsInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of generator.equals
generator.equals scores 79/100 on our quality scale, 871st of 1,937 Development & Engineering skills we index (top 45%).
Its SKILL.md is 6.8 KB long, well organised into 20 sections with 13 code examples: a thorough specification that gives an agent plenty to work with.
It has no GitHub stars yet, so there is no community track record; judge it on its content.
Maintenance, license and trust
- The repository was last updated 13 days ago, so generator.equals is actively maintained.
- Our last check on 2026-09-24 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 80/100, with 2 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
generator.equals compared with similar skills
All 4 of these similar skills score higher than generator.equals; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| generator.equals (this skill)by diegofrata | 79 | 0 | 13d ago | SKILL.md |
| ai-job-searchby MadsLorentzen | 100 | 44.0k | 4d ago | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | 6d ago | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 3d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 3d ago | SKILL.md |
Frequently asked questions
- How do I install generator.equals?
- Run
npx skills add diegofrata/Generator.Equals --skill generator.equals. The install tabs above show the steps for each supported agent. - Which AI agents does generator.equals work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is generator.equals safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 80/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is generator.equals still maintained?
- The repository was last updated 13 days ago, so generator.equals is actively maintained.
Skill content
View source on GitHubname: generator.equals description: Guidance for using Generator.Equals — a C# source generator for auto-generating Equals, GetHashCode, operators, and Diff/Inequalities methods via attributes. packages: Generator.Equals
Generator.Equals
C# source generator that auto-implements IEquatable<T>, Equals(), GetHashCode(), ==/!= operators, and an Inequalities() diff method at compile time using attributes. No runtime reflection.
Setup
Add both packages:
<PackageReference Include="Generator.Equals" PrivateAssets="all" />
<PackageReference Include="Generator.Equals.Runtime" />
Requires C# 9.0+. The type must be partial.
Attributes Quick Reference
Type-level
| Attribute | Purpose |
|-----------|---------|
| [Equatable] | Generates equality members for the type |
| [Equatable(Explicit = true)] | Only compare properties with explicit equality attributes |
| [Equatable(IgnoreInheritedMembers = true)] | Skip base class members entirely |
Property/Field-level
| Attribute | Use When |
|-----------|----------|
| [DefaultEquality] | Default comparer. Required on fields (fields are excluded by default). |
| [IgnoreEquality] | Skip this member |
| [OrderedEquality] | Compare collection elements in order (like SequenceEqual) |
| [UnorderedEquality] | Compare collection elements ignoring order |
| [SetEquality] | Compare as sets (duplicates ignored) |
| [ReferenceEquality] | Compare by reference only |
| [StringEquality(StringComparison.X)] | String-specific comparison (string props only) |
| [PrecisionEquality(0.001)] | Tolerance-based numeric comparison |
| [CustomEquality(typeof(MyComparer))] | Custom IEqualityComparer<T> |
Comparer constructor patterns (for collection and custom attributes)
[OrderedEquality] // Default comparer
[OrderedEquality(typeof(MyComparer))] // Type with static Default member
[OrderedEquality(typeof(StringComparer), nameof(StringComparer.Ordinal))] // Named static member
[OrderedEquality(StringComparison.OrdinalIgnoreCase)] // StringComparison shorthand
Best Practices
Always annotate collection properties
// WRONG - produces diagnostic GE001
public List<int> Items { get; set; }
// RIGHT
[OrderedEquality]
public List<int> Items { get; set; }
Two exceptions: a collection type that is itself [Equatable] already compares structurally, so no
attribute is needed. And [DefaultEquality] opts the member into the type's own Equals — use it for
collections that implement their own value equality.
[DefaultEquality]
public MyImmutableList<int> Items { get; set; } // MyImmutableList compares structurally itself
Use Explicit mode when only a few properties matter
[Equatable(Explicit = true)]
partial class User
{
[DefaultEquality] public string Id { get; set; } // Compared
public string DisplayName { get; set; } // Ignored
public DateTime LastLogin { get; set; } // Ignored
}
Mark fields explicitly
Fields are not included by default. You must annotate them:
[DefaultEquality]
private int _version;
Use the generated EqualityComparer
Every [Equatable] type gets a nested EqualityComparer class:
// Use in dictionaries, HashSets, LINQ
var dict = new Dictionary<MyType, string>(MyType.EqualityComparer.Default);
var distinct = items.Distinct(MyType.EqualityComparer.Default);
Use Inequalities for diff/audit
foreach (var diff in MyType.EqualityComparer.Default.Inequalities(oldObj, newObj))
Console.WriteLine(diff);
// Output: Name: John -> Jane
// Output: Addresses["home"].Street: 123 Main St -> 456 Oak Ave
Nested [Equatable] objects in collections are auto-drilled — you get per-field diffs, not "entire object changed".
Common Pitfalls
-
Non-partial type (GE006) — The type MUST be declared
partial. -
Manual Equals/GetHashCode (GE005) — Do NOT override
Equals()orGetHashCode()manually on an[Equatable]type. The generator owns these. -
Conflicting collection attributes (GE007) — Only ONE of
[OrderedEquality],[UnorderedEquality],[SetEquality]per property. -
Hash code instability —
[UnorderedEquality],[SetEquality], and[PrecisionEquality]return hash code 0 or exclude from hashing. Types using these are poor dictionary keys. -
Inheritance with [Equatable] — The generator walks the full inheritance chain. If any ancestor has
[Equatable]or overridesEquals(), it callsbase.Equals(). UseIgnoreInheritedMembers = trueto opt out. -
Overriding properties inherits attributes — A
Childoverriding aParent's[OrderedEquality] virtual int[] Valuesautomatically inherits[OrderedEquality]. Do NOT re-annotate unless you want to change behavior. -
[StringEquality]on non-string (GE008) — Only valid onstringproperties. -
[PrecisionEquality]types (GE010) — Onlyfloat,double,decimal,int,long,short,sbyteand their nullable variants.
Examples
Basic class
[Equatable]
partial class Person
{
public string Name { get; set; }
public int Age { get; set; }
[IgnoreEquality]
public DateTime LastUpdated { get; set; }
}
Record with collections
[Equatable]
partial record Customer(
string Id,
string Name,
[property: OrderedEquality] ImmutableArray<Address> Addresses,
[property: UnorderedEquality] ImmutableDictionary<string, string> Tags
);
Struct with custom comparer
[Equatable]
partial struct Coordinate
{
[PrecisionEquality(0.0001)]
public double Latitude { get; set; }
[PrecisionEquality(0.0001)]
public double Longitude { get; set; }
}
Inheritance
[Equatable]
partial class Animal
{
public string Species { get; set; }
}
[Equatable]
partial class Pet : Animal
{
public string Name { get; set; }
// Species is also compared via base.Equals()
}
Diff / Inequalities
var diffs = Customer.EqualityComparer.Default.Inequalities(before, after);
foreach (var d in diffs)
{
// d.Path — e.g., "Addresses[0].Street"
// d.Left — old value
// d.Right — new value
Console.WriteLine(d);
}
Diagnostics
| Code | Description |
|------|-------------|
| GE001 | Collection missing equality attribute |
| GE002 | Complex property missing [Equatable] |
| GE003 | Collection element missing [Equatable] |
| GE005 | Manual Equals/GetHashCode with [Equatable] |
| GE006 | [Equatable] on non-partial type |
| GE007 | Conflicting equality attributes |
| GE008 | [StringEquality] on non-string |
| GE009 | Collection attribute on non-collection |
| GE010 | [PrecisionEquality] on unsupported type |
All diagnostics have automatic code fixes.
Related Skills
ai-job-search
44.0kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
