Turn your AI coding agent into a Windows-aware, token-lean programmer.
English Docs | Chinese Docs | SKILL.md | AGENTS.md
WinLean is not another Windows setup guide. It is a reusable Coding Skill that changes how an AI agent behaves inside Windows-heavy repositories.
Clear first, then act. Read less. Patch smaller. Reuse more. Verify every change.
The inspiration is simple: Windows agents often fail commands, corrupt text, read too much context, and hand-write code that should have been reused. Instead of explaining those rules in every prompt, put the operating discipline into a skill.
WinLean makes the agent do four things before it writes code:
- Clear the environment: OS, shell, paths, encoding, newline risk.
- Control context: avoid dependency/generated folders and open only files that matter.
- Reuse first: framework features, public libraries, existing dependencies, project utilities.
- Patch small: local changes, UTF-8-safe edits, minimal verification, diff review.
| Project pain | What WinLean makes the agent do | Practical benefit |
|---|---|---|
| PowerShell one-liners break or behave differently from Unix shells | Detect Windows shells and enter Windows Safe Mode for risky text edits | Fewer failed commands and fewer uncontrolled file edits |
| Chinese, emoji, Markdown, prompts, or i18n files get corrupted | Avoid piping non-ASCII text through PowerShell; use patch edits or explicit UTF-8 I/O | Less mojibake, safer prompt/docs/localization changes |
| Exact replacements fail because of CRLF/LF | Treat replacements as newline-sensitive and preserve file style | Fewer broken patches and retry loops |
Agents read node_modules, dist, .next, coverage, caches, or binaries |
Gate context before reading; prefer manifests, entry points, related source, nearby tests | Lower input tokens and less distraction |
| Agents write large native implementations for solved problems | Run Dependency Scout before custom code, including Public Library Scout for common domains | Shorter, safer, more maintainable solutions |
| Small tasks become helper/type/service sprawl | Prefer one-file local patches and no future-facing abstractions | Cleaner diffs and easier reviews |
| The final answer hides what was reused or avoided | Require a final report with Changed, Dependency Decision, Reused, Avoided, Verified, Risks | Better reviewability and accountability |
WinLean is designed as two layers:
| Layer | Role |
|---|---|
SKILL.md |
Runtime method: how the agent should reason, edit, reuse, and verify |
examples/AGENTS.md |
Project memory: copy it into a repository root so the agent remembers WinLean rules every time |
Use the skill when you want the agent to follow the full workflow for a task. Use AGENTS.md when you want a project to keep the same guardrails across future sessions.
Yes, this repository is enough to use directly.
- Codex-style skill loaders can use the repository root because
SKILL.mdis at the top level. agents/openai.yamlprovides Codex UI metadata.examples/AGENTS.mdcan be copied into a project root for instruction-only agents.examples/safe-replace.mjsandscripts/validate-skill.mjsuse only Node.js built-ins.- No npm install is required.
Windows PowerShell:
git clone https://github.com/ziguishian/winlean-coding-skill.git "$env:USERPROFILE\.codex\skills\winlean-coding"macOS / Linux:
git clone https://github.com/ziguishian/winlean-coding-skill.git ~/.codex/skills/winlean-codingThen start a new Codex session:
Use winlean-coding full. Read only relevant files, check dependency options before custom code, make the smallest Windows-safe patch, and verify the diff.
For a project-wide default, copy the example policy:
Copy examples/AGENTS.md into your project root as AGENTS.md.
| mode | use when | behavior |
|---|---|---|
lite |
small, low-risk edits | context gate, smallest patch, minimal verification |
full |
normal coding work | Windows Safe Mode, Dependency Scout, Safe Patch Agent, Diff Reviewer |
audit |
reviewing a plan or diff | no edits; reports Windows risk, token waste, dependency decisions, and overbuilding |
Ponytail is a strong lean-coding project with broad agent/plugin coverage and a larger public benchmark. WinLean is narrower by design: it focuses on Windows-safe coding, context discipline, dependency decisions, and UTF-8/LF-safe patching for Codex-style coding agents.
This is a local Codex CLI smoke run, not a Ponytail official benchmark and not a universal claim. The Ponytail arm used a compact Ponytail-style prompt, not Ponytail's full public evaluation harness. The result is useful as a signal, not proof.
Same Codex CLI project-build smoke task, same model, same prompt shape, measured on 2026-06-30. Lower is better for token metrics.
| metric | Ponytail-style prompt | WinLean prompt | result |
|---|---|---|---|
| processed input+output | 123,027 | 116,387 | WinLean used 5.4% fewer |
| uncached+output | 18,067 | 16,419 | WinLean used 9.1% fewer |
| output tokens | 6,802 | 6,067 | WinLean used 10.8% fewer |
| reasoning tokens | 3,496 | 2,251 | WinLean used 35.6% fewer |
| generated LOC | 305 | 344 | Ponytail-style generated fewer LOC |
The honest takeaway: Ponytail is excellent at general code minimalism. WinLean's advantage is a more specific operating model for Windows repositories: avoid fragile commands, avoid bad text edits, read less irrelevant context, make dependency decisions explicit, then patch and verify narrowly.
| dimension | Ponytail | WinLean |
|---|---|---|
| Primary goal | Universal minimalism: write only what is needed | Windows-safe minimalism: read less, reuse more, patch smaller, verify |
| Token strategy | Avoid unnecessary code by climbing a minimalism ladder | Block waste before generation: context gate + dependency scout + small patches |
| Windows safety | General agent rules | Explicit PowerShell, UTF-8/GBK/CP936, CRLF/LF, path, and non-ASCII safeguards |
| Dependency decisions | Prefer existing/native/simple options | Adds Public Library Scout and reports dependency decisions explicitly |
| Portability | Broad plugin ecosystem across many agents | Codex-first standalone skill, plus AGENTS.md fallback for other agents |
| Best fit | General overbuilding prevention | Windows repos, multilingual text, prompt/Markdown/i18n edits, precise replacements |
WinLean borrows the best idea from Ponytail: code should justify its existence. It adds the Windows and context-safety layer needed when the problem is not just too much code, but fragile agent execution.
If your agent does not support Codex skills directly:
- Put this repository somewhere the agent can read.
- Point the agent at
SKILL.md. - Copy
examples/AGENTS.mdinto the target project root if your agent reads project-level instructions. - Use
examples/safe-replace.mjsfor exact UTF-8 replacements when needed.
Auto-discovery depends on each agent's conventions, but the content is plain Markdown and can be used by any code agent that accepts project guidance.
node scripts/validate-skill.mjs .Expected output:
WinLean skill validation passed: .
| path | purpose |
|---|---|
SKILL.md |
Main skill instructions loaded by Codex |
agents/openai.yaml |
Codex UI metadata |
assets/winlean-logo.png |
Generated logo used by this README |
assets/winlean-banner.png |
Generated banner used by this README |
README.en.md |
Full English documentation |
README.zh-CN.md |
Full Chinese documentation |
examples/AGENTS.md |
Project-root instruction example |
examples/safe-replace.mjs |
Safe UTF-8 exact replacement helper |
checklists/windows-safe-checklist.md |
Windows safety checklist |
checklists/lean-code-checklist.md |
Lean coding checklist |
scripts/validate-skill.mjs |
Zero-dependency validator |
MIT. See LICENSE.

