← Back to Skills Marketplace
wujiaming88

Software Engineering Discipline

by Garming · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ Security Clean
48
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install software-engineering-discipline
Description
Engineering discipline for coding agents on large, complex codebases. Apply when writing, refactoring, or reviewing non-trivial code in real systems — enforc...
README (SKILL.md)

Software Engineering Discipline

Constraints for coding agents working in large, complex, real systems. The goal is not to complete the task — it is to leave the system more coherent, not less.

A passing test is necessary, not sufficient. Code that works but corrodes the architecture is a defect.

Skip this skill when: the change is \x3C~50 LOC, single-file, throwaway prototype/spike, or glue/script code with no existing tests. This enforces a Clean-Architecture / SOLID / DDD bias that is overkill for small jobs — use judgment.

0. Understand Before You Touch

Before writing in an existing codebase:

  • Read the module you're changing AND its callers/callees. Trace the data flow in and out.
  • Find the existing pattern for this kind of work (grep a sibling feature) and follow it. Match existing style even if you'd do it differently.
  • Name the architectural layer you're in (domain / application / infrastructure / UI) and its rules.
  • Read the existing tests; they encode the intended behavior and contracts.

Self-check: Can you name the layer, the convention, and who depends on this code? If not, stop and investigate.

1. Boundaries & Dependency Direction

  • Don't reach across a layer to grab internals — call the public interface.
  • DIP: depend on abstractions, not concretions. High-level policy must not import low-level detail.
  • Dependencies should also point toward the more stable module (Stable Dependencies Principle).
  • No new circular dependencies. No domain logic importing framework/IO.
  • (This skill's style) keep business rules out of controllers/handlers; if your framework's idiom differs, follow the codebase's existing convention.
  • If the clean change requires crossing a boundary, surface it and propose the seam — don't smuggle it through.

Self-check: Does your new code import from the IO/framework/UI layer into core logic? If yes, you're inverting the wrong way.

2. Cohesion & Single Responsibility

  • A unit should do one coherent thing. If its name or docstring needs an "and", split it.
  • Separate policy vs mechanism, decision vs side-effect.
  • One responsibility lives in one place; don't smear it across files, don't pile unrelated ones into one class.
  • Prefer adding a new code path over threading a special-case if deep into stable core logic — but a plain if is often the correct, simplest answer; don't add inheritance/strategy ceremony just to honor OCP.

Self-check: Does one conceptual change land in one place? If it forces edits in many unrelated spots, your seams are wrong (unless it's a genuine cross-cutting concern).

3. Abstractions That Earn Their Keep

  • DRY is about knowledge, not text. Two copies of the same rule/decision → extract immediately. Code that merely looks similar → leave it; premature DRY couples unrelated things.
  • Rule of three applies only to coincidentally similar code: wait for the third before extracting.
  • YAGNI: build for today's known requirements. No speculative generality, no "framework" for one caller, no config knobs nobody asked for.
  • Prefer a clear name + small function over a clever one-liner. Code is read far more than written.

Self-check: Does this abstraction let a reader change more while understanding less? If they must learn the machinery first, it's the wrong abstraction.

4. Design by Contract & Edges

  • State the contract before the body: inputs, outputs, preconditions, postconditions, invariants, error modes.
  • Validate untrusted input at the system edge (API/UI/IO). Don't re-validate the same thing in every inner function.
  • Assert invariants that should be impossible to violate (programmer errors) — fail fast and loud. Validation ≠ assertion: edges validate, core asserts; don't sprinkle asserts everywhere.
  • Handle expected operational errors deliberately. Don't swallow exceptions.
  • Don't break a published contract silently. A signature/behavior/wire-format change is an API change — find callers; version, deprecate with a window, or migrate them.

Self-check: Can a caller use this from the signature + types + name alone, without reading the body?

5. Testable, Observable, Evolvable

  • If something is hard to test, the design is usually too coupled — inject dependencies, isolate side-effects, separate pure logic from IO. Fix the design, not the test. (Exception: difficulty intrinsic to the domain — real concurrency, time, external IO.)
  • Pin the behavior you implement, or reproduce the bug with a failing test first, then fix.
  • Emit observability where it matters: structured logs + correlation/request IDs at boundaries and failure paths; right log levels; never log secrets or PII. Not noise everywhere.
  • Keep config out of logic; name constants; leave seams for the next edit.

Self-check: Could a teammate test this in isolation and diagnose a production failure from the signals you left?

6. Bounded Blast Radius

  • The diff size should match the request size. Touch only what the change requires.
  • Don't opportunistically refactor/reformat/"improve" unrelated code in the same change — note it separately.
  • A refactor and a feature don't share one commit. One logical change per commit; message says why, not just what.
  • Before a wide change, state the impact surface (files/modules, callers, contracts that move) and confirm if it's large.
  • After changing a contract, follow every caller. Don't leave half-migrated state.

Self-check: Every changed line traces to the request, and the reviewer can follow the diff without a map of the whole repo.

7. Large-System Hazards (where LLMs ship the most bugs)

  • Concurrency & ordering: name the transaction boundary. Guard shared state. Assume requests race, retries duplicate, and messages arrive out of order.
  • Idempotency: any retried/at-least-once operation (payments, webhooks, jobs) needs an idempotency key or a natural unique constraint. "Exactly once" is a lie at the wire level.
  • Data migrations: schema changes are expand → migrate → contract across releases. Never drop/rename a column in the same release as the code that stops using it. Plan backward-compatible reads.
  • Backward compatibility: additive changes for live APIs/events; gate risky behavior behind a feature flag; remove only after the deprecation window.
  • Failure design: every remote call has a timeout + a defined behavior on partial failure (retry-with-backoff, fallback, or fail closed). Don't assume the network/dependency succeeds.
  • Performance budget: know the Big-O and the hot path. No N+1 queries, no unbounded fetch/allocation in a loop, bound payload sizes.
  • Security edges: authenticate and authorize at the boundary (not just validate shape). Parameterize queries; escape at sinks; keep secrets out of code and logs; treat all external input as hostile.

Self-check: For this change — what races, what gets retried, what migrates, who's authorized, what's the cost on the hot path?

Operating Loop (non-trivial changes)

1. Understand → layer, convention, callers, existing tests
2. Design     → contract + seam + blast radius + §7 hazards; pick the simplest fit
3. Confirm    → if radius is large or a boundary/contract/migration moves, surface it first
4. Implement  → smallest change that fits the architecture; follow existing patterns
5. Verify     → new behavior pinned by tests; existing tests green; diff bounded
6. Self-review→ run the self-checks; if one fails, fix the design, not the symptom
Usage Guidance
Install this if you want Codex-style agents to apply stricter software engineering practices on larger code changes. It may make the agent spend more time reading surrounding code and proposing design checks, but the artifact does not show hidden execution, credential handling, or unrelated access.
Capability Assessment
Purpose & Capability
The skill provides coding-agent discipline for larger software changes: reading relevant code, respecting architecture boundaries, testing, observability, migration safety, and security checks. These capabilities are coherent with the published description.
Instruction Scope
Instructions are scoped to non-trivial coding, refactoring, and review work, with explicit skip conditions for small or throwaway changes. The advice to inspect callers, callees, and tests is expected for software engineering work.
Install Mechanism
The package contains a single markdown SKILL.md file and no executable scripts, dependency installers, hooks, or external fetch steps.
Credentials
The skill asks the agent to examine codebase context when making code changes, which is proportionate to its purpose. It does not ask for credentials, browser profiles, broad local indexing, or unrelated private data.
Persistence & Privilege
No background processes, persistence mechanisms, privilege escalation, destructive commands, or automatic mutation outside normal user-directed coding workflows were found.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install software-engineering-discipline
  3. After installation, invoke the skill by name or use /software-engineering-discipline
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
v1.1: trimmed lecture into observable constraints; fixed SDP-vs-DIP, OCP/if, rule-of-three, validation-vs-assertion; added §7 Large-System Hazards (concurrency/idempotency, data migrations, backward-compat, failure design, perf budget, security edges); added concrete skip conditions; commit hygiene + naming + observability detail.
v1.0.0
Initial release: 7-section engineering discipline for coding agents on large complex codebases.
Metadata
Slug software-engineering-discipline
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Software Engineering Discipline?

Engineering discipline for coding agents on large, complex codebases. Apply when writing, refactoring, or reviewing non-trivial code in real systems — enforc... It is an AI Agent Skill for Claude Code / OpenClaw, with 48 downloads so far.

How do I install Software Engineering Discipline?

Run "/install software-engineering-discipline" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Software Engineering Discipline free?

Yes, Software Engineering Discipline is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Software Engineering Discipline support?

Software Engineering Discipline is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Software Engineering Discipline?

It is built and maintained by Garming (@wujiaming88); the current version is v1.1.0.

💬 Comments