# Send Clean Code to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "clean-code-review",
    "name": "Clean Code",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/wpank/clean-code-review",
    "canonicalUrl": "https://clawhub.ai/wpank/clean-code-review",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/clean-code-review",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=clean-code-review",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "templates/platforms/claude-knowledge.md",
      "templates/platforms/copilot-instructions.md",
      "templates/platforms/cursorrules.md",
      "references/code-smells.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "clean-code-review",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T19:07:35.245Z",
      "expiresAt": "2026-05-08T19:07:35.245Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=clean-code-review",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=clean-code-review",
        "contentDisposition": "attachment; filename=\"clean-code-review-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "clean-code-review"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/clean-code-review"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/clean-code-review",
    "downloadUrl": "https://openagent3.xyz/downloads/clean-code-review",
    "agentUrl": "https://openagent3.xyz/skills/clean-code-review/agent",
    "manifestUrl": "https://openagent3.xyz/skills/clean-code-review/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/clean-code-review/agent.md"
  }
}
```
## Documentation

### 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.

### OpenClaw / Moltbot / Clawbot

npx clawhub@latest install clean-code

### Core Principles

PrincipleRulePractical TestSRPSingle 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.

ElementConventionBadGoodVariablesReveal intentn, d, tmpuserCount, elapsed, activeUsersFunctionsVerb + nounuser(), calc()getUserById(), calculateTotal()BooleansQuestion formactive, flagisActive, hasPermission, canEditConstantsSCREAMING_SNAKEmax, timeoutMAX_RETRY_COUNT, REQUEST_TIMEOUT_MSClassesNoun, singularManager, DataUserRepository, OrderServiceEnumsPascalCase values'pending' stringStatus.Pending

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

### Naming Anti-Patterns

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

### Function Rules

RuleGuidelineWhySmallMax 20 lines, ideally 5-10Fits in your headOne ThingDoes one thing, does it wellTestable and nameableOne LevelOne level of abstraction per functionReadable top to bottomFew ArgsMax 3 arguments, prefer 0-2Easy to call correctlyNo 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', 'john@example.com', 'secret', 'admin', 'Engineering');

// GOOD — self-documenting options object
createUser({
  firstName: 'John',
  lastName: 'Doe',
  email: 'john@example.com',
  password: 'secret',
  role: 'admin',
  department: 'Engineering',
});

### Code Structure Patterns

PatternWhen to ApplyBenefitGuard ClausesEdge cases at function startFlat, readable flowFlat > NestedAny nesting beyond 2 levelsReduced cognitive loadCompositionComplex operationsSmall, testable piecesColocationRelated code across filesEasier to find and changeExtract 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-PatternProblemFixComment every lineNoise obscures signalDelete obvious comments; comment why, not whatHelper for one-linerUnnecessary indirectionInline the codeFactory for 2 objectsOver-engineeringDirect instantiationutils.ts with 1 functionJunk drawer filePut code where it's usedDeep nestingUnreadable flowGuard clauses and early returnsMagic numbersUnclear intentNamed constantsGod functionsUntestable, unreadableSplit by responsibilityCommented-out codeDead code confusionDelete it; git remembersTODO sprawlNever gets doneTrack in issue tracker, not codePremature abstractionWrong abstraction is worse than noneWait for 3+ duplicates before abstractingCopy-paste programmingDuplicated bugsExtract shared logicException-driven control flowSlow and confusingUse explicit conditionalsStringly-typed codeTypos and missed casesUse enums or union typesCallback hellPyramid of doomUse async/await

### Pre-Edit Safety Check

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

QuestionWhyWhat imports this file?Dependents might break on interface changesWhat does this file import?You might need to update the contractWhat tests cover this?Tests might fail — update them alongside codeIs 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:

CheckQuestionGoal 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

NEVER add comments that restate the code — if the code needs a comment to explain what it does, rename things until it doesn't
NEVER create abstractions for fewer than 3 use cases — premature abstraction is worse than duplication
NEVER leave commented-out code in the codebase — delete it; version control exists for history
NEVER write functions longer than 20 lines — extract sub-functions until each does one thing
NEVER nest deeper than 2 levels — use guard clauses, early returns, or extract functions
NEVER use magic numbers or strings — define named constants with clear semantics
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
NEVER leave a task with failing lint or type checks — fix all errors before marking complete

### References

Detailed guides for specific clean code topics:

ReferenceDescriptionAnti-Patterns21 common mistakes with bad/good code examples across naming, functions, structure, and commentsCode SmellsClassic code smells catalog with detection patterns — Bloaters, OO Abusers, Change Preventers, Dispensables, CouplersRefactoring CatalogEssential refactoring patterns with before/after examples and step-by-step mechanics
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: wpank
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-01T19:07:35.245Z
- Expires at: 2026-05-08T19:07:35.245Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/clean-code-review)
- [Send to Agent page](https://openagent3.xyz/skills/clean-code-review/agent)
- [JSON manifest](https://openagent3.xyz/skills/clean-code-review/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/clean-code-review/agent.md)
- [Download page](https://openagent3.xyz/downloads/clean-code-review)