Get the FREE Ultimate OpenClaw Setup Guide →

coding-guidelines

Scanned
npx machina-cli add skill tech-leads-club/agent-skills/coding-guidelines --openclaw
Files (1)
SKILL.md
2.5 KB

Coding Guidelines

Behavioral guidelines to reduce common LLM coding mistakes. These principles bias toward caution over speed—for trivial tasks, use judgment.

1. Think Before Coding

Don't assume. Don't hide confusion. Surface tradeoffs.

Before implementing:

  • State assumptions explicitly. If uncertain, ask.
  • If multiple interpretations exist, present them—don't pick silently.
  • If a simpler approach exists, say so. Push back when warranted.
  • If something is unclear, stop. Name what's confusing. Ask.
  • Disagree honestly. If the user's approach seems wrong, say so—don't be sycophantic.

2. Simplicity First

Minimum code that solves the problem. Nothing speculative.

  • No features beyond what was asked.
  • No abstractions for single-use code.
  • No "flexibility" or "configurability" that wasn't requested.
  • No error handling for impossible scenarios.
  • If you write 200 lines and it could be 50, rewrite it.

Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.

3. Surgical Changes

Touch only what you must. Clean up only your own mess.

When editing existing code:

  • Don't "improve" adjacent code, comments, or formatting.
  • Don't refactor things that aren't broken.
  • Match existing style, even if you'd do it differently.
  • If you notice unrelated dead code, mention it—don't delete it.

When your changes create orphans:

  • Remove imports/variables/functions that YOUR changes made unused.
  • Don't remove pre-existing dead code unless asked.

The test: Every changed line should trace directly to the user's request.

4. Goal-Driven Execution

Define success criteria. Loop until verified.

Transform tasks into verifiable goals:

  • "Add validation" → "Write tests for invalid inputs, then make them pass"
  • "Fix the bug" → "Write a test that reproduces it, then make it pass"
  • "Refactor X" → "Ensure tests pass before and after"

For multi-step tasks, state a brief plan:

1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]

Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.

Source

git clone https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(development)/coding-guidelines/SKILL.mdView on GitHub

Overview

Behavioral guidelines to curb common LLM coding mistakes. They prioritize caution over speed, promoting explicit assumptions, minimal code, and surgical edits. Use during code writing, modification, or review; not for architecture design, documentation, or non-code tasks.

How This Skill Works

Transform tasks into verifiable goals: write tests to reproduce issues, ensure tests pass before and after, and produce a brief multi-step plan. Apply four core principles—Think Before Coding, Simplicity First, Surgical Changes, and Goal-Driven Execution. For every changed line, trace it back to the user request.

When to Use It

  • When requirements are unclear or multiple interpretations exist.
  • During editing or refactoring where you should touch only what's necessary.
  • When reviewing PRs to avoid feature creep or unnecessary changes.
  • When debugging or fixing bugs where a test would reproduce the issue.
  • When planning multi-step tasks that require explicit success criteria and verifiability.

Quick Start

  1. Step 1: Read the task and surface all assumptions
  2. Step 2: Define a minimal solution and a verification plan with tests
  3. Step 3: Implement changes and run tests, iterating as needed

Best Practices

  • State assumptions explicitly before coding
  • Aim for the minimum viable solution (simplicity first)
  • Touch only what you must; don't refactor unrelated code
  • Define verifiable success criteria and write tests first
  • Surface tradeoffs and ask clarifying questions when uncertain

Example Use Cases

  • Writing a small function with clear inputs and tests
  • Reviewing a PR to catch over-engineering and unnecessary changes
  • Refactoring legacy code by preserving interfaces and behavior
  • Adding tests to reproduce and fix a bug
  • Planning a feature with a step-by-step plan and exit criteria

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers