agentsclimarketplace

Software principles

Skill hilmifawwazsaad/NextJS-js-Boilerplate/.agents/software-principles

Engineering principles for all code in this Next.js JavaScript project. Required reading before any code generation.From its SKILL.md

Install
npx -y skills add hilmifawwazsaad/NextJS-js-Boilerplate --skill software-principles

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.6 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

Pre-Code Checklist

  1. One reason to change? If not — split (SRP)
  2. Simpler solution, same outcome? — use it (KISS)
  3. Building for a future need that doesn't exist? — delete it (YAGNI)
  4. Name reveals intent without generic words (and, data, info, manager, handle)? If not — rethink design

Principles

PrincipleRuleViolation SignalFix
SRP — Single ResponsibilityOne unit, one reason to change"and" in name · file > 200 lines · fn > 20 linesSplit into focused units
OCP — Open/Closed PrincipleExtend without modifying existingAdding variant by editing component internalsVariant props · composition · new component
DIP — Dependency InversionDepend on abstractionsnew ConcreteService() hardcoded inside logicInject dependencies
Composition > InheritanceCompose via hooks/propsClass chainsProps + custom hooks
DRY — Don't Repeat YourselfOne source of truth per logicCopy-paste logic across filesExtract to shared fn/module
KISS — Keep It Simple, StupidSimplest correct solutionUnnecessary abstraction · deep indirectionRemove layers · flatten
YAGNI — You Aren't Gonna Need ItBuild only what's needed nowUnused params · "might need later" codeDelete it
SoC — Separation of ConcernsEach module owns one concernUI + fetch + logic in one fileSeparate layers (page · hook · util)
LoD — Law of DemeterTalk only to direct collaboratorsa.b.c.method() chainsAdd intermediate method
Fail FastSurface errors at earliest pointSilent catch · late validationValidate at boundaries · throw early
SSOT — Single Source of TruthOne authoritative place per logicSame validation in multiple layersCentralize · import everywhere

Naming

Names must reveal intent. Generic names destroy readability.

ConceptPatternGoodBad
Functionsverb phrasegetUserById, validateEmail, hashPasswordhandle, process, doStuff, run
Booleansis/has/can prefixisActive, hasPermission, canDeleteactive, flag, check, status
Variablesnoun, specificuserId, paginatedUsers, hashedPassworddata, result, info, temp, val
ComponentsPascalCase nounUserCard, AuthGuard, ModalOverlayusercard, myComponent, Comp1
Hooksuse + verb phraseuseAuth, useFetchUser, useFormValidationauthHook, userData, myHook
Files[domain].[layer].jsuser.service.js, auth.middleware.jsutils2.js, misc.js, helpers.js

No abbreviations except: id, req, res, err, ctx. No single-letter names outside loop counters. Name length proportional to scope.

Function Design

RuleLimitWhen exceeded
Single responsibilityOne action per functionSplit into smaller functions
Length≤ 20 linesExtract inner logic to named helper
Parameters≤ 3Group into options object
Nesting≤ 2 levels deepExtract or use early return (guard clause)
Return pathsPrefer single exitGuard clauses at top, one return at bottom

Applied to This Project

PrincipleConcrete example
SRPUserCard renders one user — fetch lives in useUser hook, not the component
SoCPages fetch · UI components render · hooks own logic — never mix
DRYShared types in types/ · validation schema once in validations/
Fail Fastconfig/env.js throws at startup if env vars missing · validate API response at boundary
SSOTError messages → constants/errors.js · API base URL → one config file
YAGNINo global state until local state is proven insufficient
KISSComponent calls one hook — no multi-source data orchestration inside JSX
DIPComponents depend on hook interfaces, not fetch calls directly

Async Error Handling

  • Catch only where you can meaningfully recover
  • Never catch and return null/undefined — throw a typed error instead
  • React: use error boundaries or error.jsx for UI-level recovery

Testing

  • Unit test pure functions and hooks in isolation
  • Integration test at API route boundaries — not implementation details
  • Mock external services only — don't mock what you own
  • One assertion per test concept

Never Do

  • Name anything data, result, info, temp, manager, handleX, processX
  • Functions > 20 lines · params > 3 · nesting > 2 — split or group
  • Mutate state directly — always return new references ({ ...prev, key: value }, [...arr, item])
  • Business logic inside JSX or component body — extract to hook or utility

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,852. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.