agentleFS
QuantConnectQuantConnect/Documentation/skills/csharp/code-quality/SKILL.md

code-quality

Skill268 starsChanged 48 days agoApache-2.0View on GitHub

Use when writing, reviewing, or refactoring QuantConnect/LEAN algorithm code for style correctness. Triggers: new algorithm code, code review, cleanup, "fix code style", "review code quality", "clean up the algorithm", redundant imports, subscription variable usage, comment format, blank-line rules, multi-line boolean layout, or catch-all error handling. Skip when only debugging runtime behavior or performance, unless the fix also changes style.

77 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use spring-boot, logging-patterns and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ffsshhttiikkSkill

    spring-boot

    Spring Boot framework and Java enterprise patterns

    Also in 3 projects that use this

  • DIL8654Skill

    logging-patterns

    Keep logs structured, correlated, low-noise, and safe for production support. Use when adding operational logging, reviewing observability, or improving diagnostics in .NET services.

    Also in 3 projects that use this

  • mstuder-slalomSkill

    jpa-patterns

    JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    design-patterns

    Practical application and coding skills for Design Patterns

    Also in 4 projects that use this

  • glommerSkill

    pr-workflow

    General guidelines for Commits, formatting, CI, dependencies, security

    Also in 4 projects that use this

  • vm0-aiSkill

    cli-design

    Design patterns and conventions for the Okou CLI user experience

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 71 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Slice.ContainsKey(symbol) or slice.Get<T>(symbol) consistently with the stored Symbol.

    line 24
  2. Distinctive:

    Use comments to clarify intent, not restate code.

    line 26
  3. Distinctive:

    Put && or || at the beginning of each continued line.

    line 36
  4. Distinctive:

    Use one blank line between methods, no blank lines inside method bodies, and standard C# brace style.

    line 38
  5. Very specific:

    Do not wrap algorithm logic in try / catch blocks.

    line 40

“Common” is measured: kept by at least 6 in 10 of the 71 edited versions of this file we could read. “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
SKILL.md

QuantConnect Algorithm Code Quality

Apply these rules to Main.cs and custom data classes. The goal is compiling code that does not hide real failures.

Imports

Preserve template using statements. Add or remove them only when a compile error proves one is needed.

Subscription Variables

Store the Symbol returned by AddData(...).Symbol or AddEquity(...).Symbol. Pass the Symbol directly.

// Bad
private Security _customBtc;
// Good
private Symbol _customSymbol;
_customSymbol = AddData<MyData>("TICKER", Resolution.Daily).Symbol;

Use Slice.ContainsKey(symbol) or slice.Get<T>(symbol) consistently with the stored Symbol.

Comments

Use comments to clarify intent, not restate code. Full-line comments start with // plus a space, use sentence form, and start with a capital letter.

// Bad
// schedule the monthly insight
var x = 1; //calculate price
// Good
// Schedule a monthly insight event.
var x = 1; // Calculate the weighted price.

Multi-Line Boolean Expressions

Put && or || at the beginning of each continued line.

Blank Lines

Use one blank line between methods, no blank lines inside method bodies, and standard C# brace style.

Error Handling

Do not wrap algorithm logic in try / catch blocks. Exceptions reveal invalid state, missing data, and incorrect assumptions; catch-all handlers make bugs invisible.

// Bad
try
{
    SetHoldings(_spy, targetWeight);
}
catch
{
}
// Good
if (targetWeight != 0)
{
    SetHoldings(_spy, targetWeight);
}

Checklist

  1. Template using statements are preserved.
  2. Stored subscription variables are Symbol values.
  3. Comments follow language-specific rules.
  4. Multi-line boolean expressions follow language-specific continuation style.
  5. Blank lines match language rules.
  6. Algorithm code has no try / catch; it uses explicit guards for expected conditions.

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.

Reviews can't be read right now.

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.