Source profileQuality 75/100Review permissions

yun520-1/mark-heartflow-skill/skills/clean-code-review/SKILL.md

clean-code

Pragmatic coding standards for writing clean, maintainable code — naming, functions, structure, anti-patterns, and pre-edit safety checks. Use when writing new code, refactoring existing code, reviewing code quality, or establishing coding standards.

Source repository stars
36
Declared platforms
0
Static risk flags
2
Last source update
2026-07-28
Source checked
2026-07-28

Decision brief

What it does—and where it fits

Be concise, direct, and solution-focused. Clean code reads like well-written prose — every name reveals intent, every function does one thing, and every abstraction earns its place.

Best for

  • Use when writing new code, refactoring existing code, reviewing code quality, or establishing coding standards.

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/yun520-1/mark-heartflow-skill --skill "skills/clean-code-review"
Safe inspection promptEditorial

Inspect the Agent Skill "clean-code" from https://github.com/yun520-1/mark-heartflow-skill/blob/20bbbb4eacf56c941ddc3420dcbc81c04d55ec5c/skills/clean-code-review/SKILL.md at commit 20bbbb4eacf56c941ddc3420dcbc81c04d55ec5c. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Installation

    Review the “Installation” section in the pinned source before continuing.

    Review and apply the “Installation” source section.
  2. 02

    OpenClaw / Moltbot / Clawbot

    Review the “OpenClaw / Moltbot / Clawbot” section in the pinned source before continuing.

    Review and apply the “OpenClaw / Moltbot / Clawbot” source section.
  3. 03

    Core Principles

    Review the “Core Principles” section in the pinned source before continuing.

    Review and apply the “Core Principles” source section.
  4. 04

    Naming Rules

    Names are the most important documentation. A good name eliminates the need for a comment.

    Names are the most important documentation. A good name eliminates the need for a comment.Rule: If you need a comment to explain a name, rename it.
  5. 05

    Naming Anti-Patterns

    Review the “Naming Anti-Patterns” section in the pinned source before continuing.

    Review and apply the “Naming Anti-Patterns” source section.

Permission review

Static risk signals and limitations

Runs scripts

medium · line 11

The documentation asks the agent to run terminal commands or scripts.

npx clawhub@latest install clean-code

Writes files

medium · line 220

The documentation asks the agent to create, modify, or delete local files.

**Rule:** Edit the file + all dependent files in the SAME task. Never leave broken imports or missing updates.

Writes files

medium · line 246

The documentation asks the agent to create, modify, or delete local files.

**NEVER edit a file without checking what depends on it** — broken imports and missing updates are the most common source of bugs in multi-file changes

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score75/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars36SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
yun520-1/mark-heartflow-skill
Skill path
skills/clean-code-review/SKILL.md
Commit
20bbbb4eacf56c941ddc3420dcbc81c04d55ec5c
License
Not declared
Collected
2026-07-28
Default branch
main
View the original SKILL.md

Clean Code

Be concise, direct, and solution-focused. Clean code reads like well-written prose — every name reveals intent, every function does one thing, and every abstraction earns its place.

Installation

OpenClaw / Moltbot / Clawbot

npx clawhub@latest install clean-code

Core Principles

PrincipleRulePractical Test
SRPSingle Responsibility — each function/class does ONE thing"Can I describe what this does without using 'and'?"
DRYDon't Repeat Yourself — extract duplicates, reuse"Have I written this logic before?"
KISSKeep It Simple — simplest solution that works"Is there a simpler way to achieve this?"
YAGNIYou Aren't Gonna Need It — don't build unused features"Does anyone need this right now?"
Boy ScoutLeave code cleaner than you found it"Is this file better after my change?"

Naming Rules

Names are the most important documentation. A good name eliminates the need for a comment.

ElementConventionBadGood
VariablesReveal intentn, d, tmpuserCount, elapsed, activeUsers
FunctionsVerb + nounuser(), calc()getUserById(), calculateTotal()
BooleansQuestion formactive, flagisActive, hasPermission, canEdit
ConstantsSCREAMING_SNAKEmax, timeoutMAX_RETRY_COUNT, REQUEST_TIMEOUT_MS
ClassesNoun, singularManager, DataUserRepository, OrderService
EnumsPascalCase values'pending' stringStatus.Pending

Rule: If you need a comment to explain a name, rename it.

Naming Anti-Patterns

Anti-PatternProblemFix
Cryptic abbreviations (usrMgr, cfg)Unreadable in 6 monthsSpell it out — IDE autocomplete makes long names free
Generic names (data, info, item, handler)Says nothing about purposeUse domain-specific names that reveal intent
Misleading names (getUserList returns one user)Actively deceives readersMatch name to behavior, or change the behavior
Hungarian notation (strName, nCount, IUser)Redundant with type systemLet TypeScript/IDE show types; names describe purpose

Function Rules

RuleGuidelineWhy
SmallMax 20 lines, ideally 5-10Fits in your head
One ThingDoes one thing, does it wellTestable and nameable
One LevelOne level of abstraction per functionReadable top to bottom
Few ArgsMax 3 arguments, prefer 0-2Easy to call correctly
No Side EffectsDon't mutate inputs unexpectedlyPredictable behavior

Guard Clauses

Flatten nested conditionals with early returns. Never nest deeper than 2 levels.

// BAD — 5 levels deep
function processOrder(order: Order) {
  if (order) {
    if (order.items.length > 0) {
      if (order.customer) {
        if (order.customer.isVerified) {
          return submitOrder(order);
        }
      }
    }
  }
  throw new Error('Invalid order');
}

// GOOD — guard clauses flatten the structure
function processOrder(order: Order) {
  if (!order) throw new Error('No order');
  if (!order.items.length) throw new Error('No items');
  if (!order.customer) throw new Error('No customer');
  if (!order.customer.isVerified) throw new Error('Customer not verified');

  return submitOrder(order);
}

Parameter Objects

When a function needs more than 3 arguments, use an options object.

// BAD — too many parameters, order matters
createUser('John', 'Doe', '[email protected]', 'secret', 'admin', 'Engineering');

// GOOD — self-documenting options object
createUser({
  firstName: 'John',
  lastName: 'Doe',
  email: '[email protected]',
  password: 'secret',
  role: 'admin',
  department: 'Engineering',
});

Code Structure Patterns

PatternWhen to ApplyBenefit
Guard ClausesEdge cases at function startFlat, readable flow
Flat > NestedAny nesting beyond 2 levelsReduced cognitive load
CompositionComplex operationsSmall, testable pieces
ColocationRelated code across filesEasier to find and change
Extract FunctionComments separating "sections"Self-documenting code

Composition Over God Functions

// BAD — god function doing everything
async function processOrder(order: Order) {
  // Validate... (15 lines)
  // Calculate totals... (15 lines)
  // Process payment... (10 lines)
  // Send notifications... (10 lines)
  // Update inventory... (10 lines)
  return { success: true };
}

// GOOD — composed of small, focused functions
async function processOrder(order: Order) {
  validateOrder(order);
  const totals = calculateOrderTotals(order);
  const payment = await processPayment(order.customer, totals);
  await sendOrderConfirmation(order, payment);
  await updateInventory(order.items);
  return { success: true, orderId: payment.orderId };
}

Return Type Consistency

Functions should return consistent types. Use discriminated unions for multiple outcomes.

// BAD — returns different types
function getUser(id: string) {
  const user = database.find(id);
  if (!user) return false;     // boolean
  if (user.isDeleted) return null; // null
  return user;                 // User
}

// GOOD — discriminated union
type GetUserResult =
  | { status: 'found'; user: User }
  | { status: 'not_found' }
  | { status: 'deleted' };

function getUser(id: string): GetUserResult {
  const user = database.find(id);
  if (!user) return { status: 'not_found' };
  if (user.isDeleted) return { status: 'deleted' };
  return { status: 'found', user };
}

Anti-Patterns

Anti-PatternProblemFix
Comment every lineNoise obscures signalDelete obvious comments; comment why, not what
Helper for one-linerUnnecessary indirectionInline the code
Factory for 2 objectsOver-engineeringDirect instantiation
utils.ts with 1 functionJunk drawer filePut code where it's used
Deep nestingUnreadable flowGuard clauses and early returns
Magic numbersUnclear intentNamed constants
God functionsUntestable, unreadableSplit by responsibility
Commented-out codeDead code confusionDelete it; git remembers
TODO sprawlNever gets doneTrack in issue tracker, not code
Premature abstractionWrong abstraction is worse than noneWait for 3+ duplicates before abstracting
Copy-paste programmingDuplicated bugsExtract shared logic
Exception-driven control flowSlow and confusingUse explicit conditionals
Stringly-typed codeTypos and missed casesUse enums or union types
Callback hellPyramid of doomUse async/await

Pre-Edit Safety Check

Before changing any file, answer these questions to avoid cascading breakage:

QuestionWhy
What imports this file?Dependents might break on interface changes
What does this file import?You might need to update the contract
What tests cover this?Tests might fail — update them alongside code
Is this a shared component?Multiple consumers means wider blast radius
File to edit: UserService.ts
├── Who imports this? → UserController.ts, AuthController.ts
├── Do they need changes too? → Check function signatures
└── What tests cover this? → UserService.test.ts

Rule: Edit the file + all dependent files in the SAME task. Never leave broken imports or missing updates.


Self-Check Before Completing

Before marking any task complete, verify:

CheckQuestion
Goal met?Did I do exactly what was asked?
Files edited?Did I modify all necessary files, including dependents?
Code works?Did I verify the change compiles and runs?
No errors?Do lint and type checks pass?
Nothing forgotten?Any edge cases or dependent files missed?

NEVER Do

  1. NEVER add comments that restate the code — if the code needs a comment to explain what it does, rename things until it doesn't
  2. NEVER create abstractions for fewer than 3 use cases — premature abstraction is worse than duplication
  3. NEVER leave commented-out code in the codebase — delete it; version control exists for history
  4. NEVER write functions longer than 20 lines — extract sub-functions until each does one thing
  5. NEVER nest deeper than 2 levels — use guard clauses, early returns, or extract functions
  6. NEVER use magic numbers or strings — define named constants with clear semantics
  7. NEVER edit a file without checking what depends on it — broken imports and missing updates are the most common source of bugs in multi-file changes
  8. NEVER leave a task with failing lint or type checks — fix all errors before marking complete

References

Detailed guides for specific clean code topics:

ReferenceDescription
Anti-Patterns21 common mistakes with bad/good code examples across naming, functions, structure, and comments
Code SmellsClassic code smells catalog with detection patterns — Bloaters, OO Abusers, Change Preventers, Dispensables, Couplers
Refactoring CatalogEssential refactoring patterns with before/after examples and step-by-step mechanics

Alternatives

Compare before choosing