Hoc classes constructor

From openreachtech/hora-skills-ort-core · View interactive version

Hoc classes constructor is an AI agent skill from the GitHub repository openreachtech/hora-skills-ort-core. Conventions for class constructors. Constructor parameters must not have default values.

How to use this skill

Skill file

Classes: Constructor

Conventions related to class constructors.

Do not assign default values to parameters

assigned to the property of the same name, and no value is decided here.

(...)` first among them. A default the constructor does not apply is applied there.

// NG: assigning a default value to a parameter
constructor ({
  delimiter = ',',
}) {
  this.delimiter = delimiter
}

// OK: no default value
constructor ({
  delimiter,
}) {
  this.delimiter = delimiter
}

Separate what goes up to the base from what this class keeps

**Where a constructor hands part of its parameters to the base class and keeps the rest,

a blank line divides the two in the parameter list.** The reader then sees, without

following super(), which of the properties this class is responsible for.

constructor ({
  ErrorCtor,

  maxDocumentDepth,
}) {
  super({
    ErrorCtor,
  })

  this.maxDocumentDepth = maxDocumentDepth
}

new this({ ... }) they assemble. A class states the split in one shape wherever the

list appears, so a reader meeting .create() first learns the same thing.

lists only the base's share, and nothing is separated inside it.

divide with, and the *-only line that stands in for one is spent between the description

and the first tag — see the JSDoc convention. The type literal stays a flat list of the

same properties.

building a value, not declaring what the class is made of, so the argument object it

writes carries no blank line.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.