# lean-code

Adopt this skill: https://proskills.md/skills/other/lean-llm-lean-agents-skills-lean-code

Page: https://proskills.md/skills/other/lean-llm-lean-agents-skills-lean-code
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/lean-code/SKILL.md
size: 2559
sha: 15e38cdc57958bba2e2625067adb40ae2644bcc2
upstream: https://github.com/lean-llm/lean-agents/blob/main/skills/lean-code/SKILL.md

```text
---
name: lean-code
description: "Load lean-code for all coding-related tasks: implementing, fixing, refactoring, reviewing, testing, or optimizing code."
---

# Lean Code

## Core
Work like a lazy senior dev: solve the full task with the least clear code. Prefer, in order: remove needless work; reuse existing project code; use standard/platform APIs; reuse installed dependencies; write minimal new code. Keep repo conventions. Avoid speculative features, options, wrappers, extra types, config and one-use abstractions; don't add a dependency for a few lines. Fix a shared root cause once, not every symptom. Never cut requested behavior, compatibility, validation, security, error handling, data integrity, accessibility or ownership/thread safety. Prefer understandable code over compressed tricks. Test changed nontrivial behavior with a focused regression check; compilation alone is not proof. If taking a deliberate shortcut, mark `shortcut: <limit>; revisit when <trigger>`. Report what actually ran and remaining risks; never invent verification.

## Required lean pass after coding
Once behavior works, review your diff and nearby callers. Ask: **same behavior, fewer lines or moving parts?** If yes, simplify now, then rerun affected checks. Remove dead branches, duplicate conditions/loops, unnecessary state, arguments, wrappers and boilerplate; inline trivial one-use helpers when clearer. Prefer deleting over adding. Preserve public APIs and behavior unless the task explicitly changes them.

## Dedup & shared behavior
When **2+ real objects/classes** repeat the same rule, put that rule in one reusable owner instead of copying fixes. Prefer an existing method, focused utility/service, or composition. Use **inheritance/base class** only for a genuine *is-a* relationship with stable shared state, lifecycle and behavior; share protected logic where appropriate. Prefer composition/strategy for unrelated objects or differing behavior. No deep inheritance, god helpers, speculative generic frameworks, or abstractions used once. Do not merge lookalike code with different semantics.

## Safety gate
Smaller LOC is a **tie-breaker**, not permission to degrade clarity, time/space complexity, event ordering, error handling, compatibility or thread ownership. Keep scope local. Check affected callers/tests, compare before/after behavior and rerun focused tests after simplification. If equivalence cannot be established, keep the clear working version. In review-only tasks, **propose** simplifications; never edit without authorization.
```

## File: README.md
upstream: https://github.com/lean-llm/lean-agents/blob/main/README.md

```text
# Lean Agents

Short prompts for coding agents. Less text per turn, one clear rule set.

See `BENCHMARK.md` for the tests so far.

## How it works

`AGENTS.md` is the one shared policy. Two roles:

| Role | Who | Does |
| --- | --- | --- |
| `ORCHESTRATOR` | Primary agent (`build`) | Small single fixes itself. Features, refactors and multi-file work go to a worker, one per independent task. |
| `CODER` | Worker (`general`, or `worker` on Codex) | Investigates, edits, tests, repairs inside its scope. Never delegates. |

Up to 10 workers run in parallel on independent tasks; the primary waits for all. Agents never ask the user questions; they resolve things themselves. Delete the `## Questions` section in `AGENTS.md` if you want questions back.

## What's inside

| Path | What |
| --- | --- |
| `AGENTS.md` | Shared policy: roles, routing, engineering, output. |
| `agents/` | Agent files: `build.md` (primary), `general.md` / `worker.toml` (CODER), plus optional `lean-*` and `explore` helpers. |
| `skills/lean-code` | Smallest complete change, lean pass after coding, dedup. Load for all coding. |
| `skills/lean-java` | Java/JVM: Maven, Gradle, JUnit, concurrency, Spring. |
| `skills/lean-web` | JS/TS, Node, React/Next.js, Fastify, auth, tests. |
| `skills/lean-plan` | Plan a feature from scratch. |
| `extensions/` | Pi: `subagent` tool for `general`. |
| `mods/` | Command Code: loads the `build` prompt. |
| `plugins/` | Legacy OpenCode no-op, kept so old installs get overwritten. |
| `.chatgpt/` | Prompt for ChatGPT projects that write plans for coding agents. |

Agents load the skills that fit the task and workspace.

## Install

Put `AGENTS.md` at the repo root (or the host's global instructions path). Start a fresh session and check it loaded. Merge with existing config; don't overwrite.

- **OpenCode:** copy `agents/build.md` and `agents/general.md` to `.opencode/agents/` or `~/.config/opencode/agents/`. Set `default_agent: "build"`.
- **Claude Code:** copy the same two files to `.claude/agents/` or `~/.claude/agents/`. Run `claude --agent build`. Add `@AGENTS.md` to `CLAUDE.md` if needed.
- **Codex:** copy `agents/worker.toml` to `.codex/agents/`. Turn on multi-agent. Root `AGENTS.md` makes Codex the orchestrator.
- **Command Code:** reads `AGENTS.md`. Optional: install `mods/lean-primary.ts` (keep `agents/build.md` beside it). Its built-in `general` can't be overridden, so give `Role: CODER` in the handoff.
- **Pi:** use `extensions/lean-subagents.ts` (keep `agents/general.md` beside it). Load `AGENTS.md` yourself if the host doesn't.

## Limits

Prompts are not enforcement. The model may skip delegation. Check the first tool calls of a fresh session.

## License

MIT. See `LICENSE`.
```
