{"skill":{"slug":"small-context-coding","displayName":"Small Context Coding","summary":"Efficient coding workflow for small-context models working on medium or large codebases. Use when the user wants to develop, debug, refactor, or analyze code...","description":"---\nname: small-context-coding\ndescription: Efficient coding workflow for small-context models working on medium or large codebases. Use when the user wants to develop, debug, refactor, or analyze code with limited context windows, when tasks should be split into smaller verified steps, when sub-agents may help isolate work, or when long coding sessions need plan files, checkpoints, and strict context discipline.\n---\n\n# Small Context Coding\n\nUse this skill to keep coding work effective when the model context is limited.\n\n## Core operating mode\n\nTreat the model as a short-working-memory engineer.\nDo not try to keep the whole project in chat context.\nStore project state in files and retrieve only what is needed for the current step.\n\n## Default workflow\n\n1. Classify the task size.\n2. Create or update a task plan file before broad changes.\n3. Read only the minimum files needed to decide the next step.\n4. Split the work into small closed loops: inspect -> change -> verify.\n5. Use sub-agents only to isolate distinct subproblems.\n6. Write checkpoints after each meaningful phase.\n\n## Task size heuristic\n\n### Small\n- One file or one obvious fix\n- No sub-agent\n- No extra planning file unless requested\n\n### Medium\n- A few files or one subsystem\n- Make a short plan\n- Consider one sub-agent for investigation only\n\n### Large\n- Multiple modules, unclear root cause, or feature work across boundaries\n- Create plan + todo + checkpoint files\n- Delegate investigation or isolated implementation to sub-agents\n- Keep main session focused on orchestration and decisions\n\n## Required file-based state\n\nFor medium or large tasks, create these under a working notes folder such as `notes/<task-slug>/`:\n\n- `plan.md` — goal, constraints, phases\n- `todo.md` — actionable checklist\n- `checkpoint.md` — current state, decisions, next step\n\nKeep each file short and current.\nDo not duplicate long chat history into these files.\n\n## Planning rules\n\nA plan should contain:\n- task goal\n- current understanding\n- files/modules likely involved\n- ordered steps\n- verification method\n\nIf the task changes materially, update the plan before continuing broad edits.\n\n## Context discipline rules\n\n- Never read whole directories into context without a reason.\n- Prefer targeted reads and searches.\n- Summarize findings into notes instead of carrying raw outputs forward.\n- After a phase is complete, compress it into a checkpoint and move on.\n- Do not mix unrelated problem threads in one run when avoidable.\n\n## Sub-agent rules\n\nUse a sub-agent when one of these is true:\n- investigation can be isolated from implementation\n- one subsystem can be analyzed independently\n- you need a clean context for an experiment\n- the main session is becoming an overloaded coordinator\n\nDo not use sub-agents for trivial single-file edits.\nDo not spawn many sub-agents unless there are clearly separate workstreams.\n\n### Good sub-agent tasks\n- trace a call chain for one feature\n- inspect one module and summarize risks\n- draft a patch for one bounded component\n- write or repair one test area\n\nGenerate brief files with:\n\n```bash\npython3 /home/nick/.openclaw/workspace/skills/small-context-coding/scripts/generate_subagent_brief.py \"<task-name>\" \"<scope>\" \"<verification>\" <repo-root>\n```\n\nRead `references/subagent-patterns.md` for prompt shapes and `references/usage-guide.md` for a concrete example.\n\n### Main session responsibilities\n- define task boundaries\n- decide delegation\n- merge findings\n- choose final implementation direction\n- verify final result\n\n## Verification rules\n\nAfter each implementation step, run the smallest meaningful check:\n- targeted test\n- lint/typecheck for changed area\n- build of affected package\n- direct inspection if no automated check exists\n\nRead `references/verification-defaults.md` for stack-specific defaults before choosing a verification command.\nNever claim completion without a verification step or explicit blocker.\n\nA task is only done when these are true:\n- the requested change is implemented or explicitly blocked\n- the notes reflect the current state\n- one meaningful verification step has run, or the blocker is named clearly\n- the next follow-up is obvious from `checkpoint.md` if more work remains\n\n## Recommended note templates\n\nIf notes do not exist, create them from the bundled templates in `references/templates.md`.\nFor a real task, prefer initializing them with `scripts/init_task.py`.\nRead `references/usage-guide.md` when you want a concrete flow for medium or large tasks.\nRead `references/verification-defaults.md` when selecting the smallest useful validation command for a stack.\n\n## Anti-patterns\n\nAvoid:\n- giant upfront context dumps\n- broad refactors without a written plan\n- keeping important state only in chat\n- asking one session to investigate, design, implement, and validate many unrelated things at once\n- using sub-agents just because they exist\n\n## Initialization\n\nTo set up a task workspace for medium or large work, run:\n\n```bash\npython3 /home/nick/.openclaw/workspace/skills/small-context-coding/scripts/init_task.py \"<task-name>\" <repo-root>\n```\n\nThis creates `notes/<task-slug>/plan.md`, `todo.md`, and `checkpoint.md` if they do not already exist.\n\nTo verify the helper workflow end to end, run:\n\n```bash\npython3 /home/nick/.openclaw/workspace/skills/small-context-coding/scripts/smoke_test.py\n```\n\n## Iteration guidance\n\nKeep the skill lean.\nImprove it after real use by refining:\n- task size thresholds\n- sub-agent delegation patterns\n- note templates\n- verification defaults per language or framework\n","topics":["Coding"],"tags":{"latest":"1.0.1"},"stats":{"comments":0,"downloads":363,"installsAllTime":13,"installsCurrent":1,"stars":0,"versions":2},"createdAt":1777830433434,"updatedAt":1778492838254},"latestVersion":{"version":"1.0.1","createdAt":1777830598957,"changelog":"Add MIT LICENSE file to the published package and align license metadata.","license":"MIT-0"},"metadata":null,"owner":{"handle":"ambitioncn","userId":"s176403v6056szwqp2hd324dpx857gdh","displayName":"ambitioncn","image":"https://avatars.githubusercontent.com/u/36698505?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780090738002}}