Plan

From garagon/nanostack · View interactive version

Plan is an AI agent skill from the GitHub repository garagon/nanostack. Use when starting non-trivial work (touching 3+ files, new features, refactors, bug investigations). Produces a scoped, actionable implementation plan before any code is written. Triggers on /nano.

How to use this skill

Skill file

/nano — Implementation Planning

You turn validated ideas into executable steps. Every file gets named. Every step gets a verification. Every unknown gets surfaced. The plan is a contract: if it says 4 files, the PR should touch 4 files.

Telemetry preamble

Defensive telemetry init. No-op if telemetry is disabled via NANOSTACK_NO_TELEMETRY=1, ~/.nanostack/.telemetry-disabled, or if the helpers are removed.

_P="$HOME/.claude/skills/nanostack/bin/lib/skill-preamble.sh"
[ -f "$_P" ] && . "$_P" nano
unset _P

Session

If no active session exists, initialize one:

~/.claude/skills/nanostack/bin/session.sh status

If the output shows "active":false, create a session:

~/.claude/skills/nanostack/bin/session.sh init development

Then run session.sh phase-start plan.

Plan approval mode. This skill reads plan_approval from the session to decide whether to pause. The field has three values:

Read the value with v1-compat fallback (older sessions may only have autopilot):

PLAN_APPROVAL=$(jq -r '.plan_approval // (if .autopilot then "auto" else "manual" end)' .nanostack/session.json 2>/dev/null)

If the file is missing entirely, treat as manual.

Local mode: Run source bin/lib/git-context.sh && detect_git_mode. If result is local, adapt language: "implementation plan" → "paso a paso", "files to modify" → "archivos que vamos a crear", "architecture checkpoint" → skip (overkill for non-technical users). Present the plan as a simple numbered list of what you'll build, not a spec document. Same rigor, accessible words. In the "Next Step" section, do NOT list slash commands (/review, /security, /qa, /ship). Instead say: "Cuando termine, reviso la calidad y te aviso si hay algo que ajustar."

Plain-language contract. When profile == "guided" (or local mode), follow reference/plain-language-contract.md. The plan summary uses the four-block skeleton:

<!-- guided-output:start -->

Resultado: Voy a armar la herramienta en 3 archivos chicos.

Como verlo:
1. Cuando termine cada paso, te muestro lo que cambio.

Que revise:
- La forma mas simple de cumplir lo que pediste.
- Que cada cambio se pueda probar por separado.
- Que no rompa nada que ya estaba funcionando.

Pendiente:
- No probe en una computadora distinta a la tuya.

<!-- guided-output:end -->

Process

1. Understand the Request

```bash

~/.claude/skills/nanostack/bin/resolve.sh plan

```

The output is JSON with upstream_artifacts (think artifact path if recent), solutions (ranked matches), config, and sprint_metrics (git stats + cycle time from last sprint). Use what's relevant:

If think artifact is missing but /think ran, use the visible Think Summary as planning context and disclose the missing artifact. Do not use --from-session or enable the legacy artifact bypass. Ask for missing scope information rather than inventing a brief or marking discovery complete retroactively.

1. Read .nanostack/stack.json if it exists (project-level preferences)

2. Read ~/.nanostack/stack.json if it exists (user-level preferences)

3. Read plan/references/stack-defaults.md for anything not covered above

4. If the project already has a stack (check package.json, go.mod, requirements.txt), use what's there regardless of any config.

Suggest, don't impose. The user always has the final say.

Graduated Rules

<!-- Auto-maintained by bin/graduate.sh. Do not edit manually. -->

<!-- Each rule was promoted from a solution with 3+ applications and validation. -->

<!-- END GRADUATED RULES -->

Apply these constraints during planning. Each one represents a proven pattern or decision from past sprints.

2. Evaluate Scope

Classify the work:

| Scope | Criteria | Output |

|-------|----------|--------|

| Small | 1-3 files, single concern, clear path | Implementation steps only |

| Medium | 4-10 files, multiple concerns, some unknowns | Product spec + implementation steps + risks |

| Large | 10+ files, cross-cutting, architectural impact | Product spec + technical spec + implementation steps + phased execution |

For small scope: produce a brief plan and move on. Do not over-plan trivial work.

3. Specs (Medium/Large scope only)

Before writing implementation steps, produce the specs that define what you're building. Skip this for Small scope.

Medium scope: Product Spec only.

Use plan/templates/product-spec.md. Cover: problem, solution, user stories, acceptance criteria, user flow, edge cases, out of scope. Keep it to 1-2 pages. This is what the team reads to understand what "done" looks like.

Large scope: Product Spec + Technical Spec.

Also use plan/templates/technical-spec.md. Cover: architecture, data model, API contracts, integrations, technical decisions, security considerations, migration/rollback. This is what the team reads to understand how the system works.

Present the specs to the user before writing implementation steps. Specs are the contract. If the spec is wrong, the plan will be wrong and the code will be wrong. Get alignment here.

4. Write the Implementation Plan

Use the template at plan/templates/plan-template.md as your output structure. Fill in every section that applies to the scope level.

Key requirements:

5. Architecture Checkpoint (Medium/Large scope only)

Before presenting, validate the plan against these engineering concerns:

Skip this for Small scope — it's overkill for a 3-file change.

6. Product Standards (if the plan includes user-facing output)

If the plan produces anything a user will see or interact with, apply the standards in plan/references/product-standards.md. They are not optional — they cover UI/frontend (shadcn + Tailwind, dark mode, mobile, no AI slop), SEO, LLM SEO, and CLI/TUI defaults per language.

If the plan is a pure library with no user-facing output, skip this section.

7. Present and Confirm

Behavior depends on PLAN_APPROVAL (read above):

After the plan is approved (or auto-approved), do these two steps in order:

Step 1: Save the artifact. Run this command now — do not skip it. The save is validated against the per-phase schema (see reference/artifact-schema.md); a plan artifact requires summary.planned_files (array), summary.plan_approval, and context_checkpoint. /review uses planned_files for scope drift.

PLAN_JSON=$(jq -n \
  --argjson planned_files '["file1.ts","file2.ts"]' \
  --arg     plan_approval "$PLAN_APPROVAL" \
  --arg     checkpoint_summary "Plan for <feature>: N files, key decisions X and Y." \
  '{
     phase: "plan",
     summary: {
       planned_files: $planned_files,
       plan_approval: $plan_approval
     },
     context_checkpoint: {
       summary: $checkpoint_summary,
       key_files: $planned_files,
       decisions_made: [],
       open_questions: []
     }
   }')
~/.claude/skills/nanostack/bin/save-artifact.sh plan "$PLAN_JSON"

Step 2: Return the plan.

Next Step

After the plan artifact is saved:

If PLAN_APPROVAL is auto:

Return the approved plan to the caller. Do not build or invoke downstream specialists. /feature owns the full sprint; a standalone /nano call ends with the plan even when approval is automatic.

Otherwise (manual or not_required):

Tell the user:

Plan ready. Next steps in the sprint:

- Build the approved plan

- /review to run a two-pass code review with scope drift detection

- /security to audit for vulnerabilities

- /qa to test that everything works

These three can run in any order. After all pass, /ship to create the PR.

Wait for the user to invoke each one.

Telemetry finalize

Before returning control:

_F="$HOME/.claude/skills/nanostack/bin/lib/skill-finalize.sh"
[ -f "$_F" ] && . "$_F" nano success
unset _F

Pass abort or error instead of success if the plan did not complete normally.

Gotchas

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.