← Back to Thinking

Agent Product Development SOP (AI Coding Edition)

A personal SOP for building agent products with AI coding — from framework selection and design through development, debugging to delivery, plus a Claude Code + Superpowers quick reference

  • AI-Coding
  • Agent
  • SOP

Scope

A personal SOP for building agent products with AI Coding. Currently in the PoC accumulation phase: validating techniques, capturing processes and recording experience. Useful as a personal quick reference, or as a step-by-step guide for newcomers.

0. Core principles

  1. Discuss thoroughly before starting: writing code before the plan is confirmed usually means rework.
  2. Framework first, details later, iterate incrementally: go PoC → MVP → V1.0, adding features on top of the existing framework each step.
  3. AI output must be reviewed by a human: the developer must review what AI produces.
  4. Debug systematically: no guess-fixes; verify layer by layer, then fix the root cause.

1. Tooling foundation: Claude Code + Superpowers

1.1 Core commands

CommandWhat it doesBest time to use
/compactProactively compact context to free spaceAfter finishing a task; when context exceeds ~60%. Say what to keep: current goal, completed items, remaining TODOs
/security-reviewSecurity reviewWhen there’s SQL injection, XSS, auth/authz, unsafe data handling, dependency-vulnerability risk
/contextCheck context usageWhen tasks slow down or the model starts drifting

1.2 Bundled skills

CommandMechanismUsage
/simplifyThree-agent parallel review: reusability, quality, efficiency/simplify for everything; /simplify ClassName for a specific module
/loopScheduled or autonomous iteration until the goal is reached/loop 30m /review; /loop "fix all tests until they pass"
/debugDiagnose Claude Code itselfOn MCP connection, tool-call or permission issues; run first when CC hangs or errors

1.3 Usage habits

TrickUsageTip
@file / @folder/Pin contextUse confirmed material dirs; avoid vague instructions and cut token use
btw questionsSide conversationsLook up API usage or syntax without polluting the current task context
--dangerously-skip-permissionsSkip confirmationFor personal practice only
/compact + keep-scopeProactive compactionUse past 60% context, explicitly keep current goal, done items and TODOs

1.4 Superpowers skills quick reference

If there’s even a 1% chance it applies, you must invoke it. Use process skills (e.g. brainstorming, debugging) to decide “how”, then implementation skills (e.g. TDD, writing-plans) to guide execution. Rigid skills like TDD, debugging and verification must not be skipped.

SkillWhenOne-liner
brainstormingBefore any new feature, design or creative workClarify → compare 2–3 options → pick → output a spec
systematic-debuggingBugs, exceptions, unexpected behaviorRoot cause → pattern → hypothesis → fix; no guess-fixes
test-driven-developmentBefore implementing a feature or fixing a bugRED → GREEN → REFACTOR, write a failing test first
writing-plansSpec exists, about to codeA step-by-step plan with file layout, steps and test strategy
subagent-driven-developmentExecuting a planEach task done by an independent subagent, with two-phase review
dispatching-parallel-agentsTwo+ independent tasks can run in parallelOne agent per problem domain, no interference
executing-plansExecuting a plan without subagentsLoad plan → run task by task → verify
verification-before-completionAbout to claim doneWithout verification evidence, you can’t say “passed”
requesting-code-reviewFeature done or before mergeAn independent reviewer removes author blind spots
receiving-code-reviewWhen you get review feedbackUnderstand → verify → assess → implement; no emotional or blind acceptance
finishing-a-development-branchImplementation done, ready to integrateAfter tests pass, choose merge / PR / cleanup
using-git-worktreesWhen you need isolationDetect existing isolation, prefer native tools, fall back to worktrees
writing-skillsCreating or editing skill filesApply TDD to docs: write scenarios → see failure → write the skill
using-superpowersAt the start of every conversationEstablish skill-discovery rules to avoid missing one

1.5 Choosing between /simplify and code review

ScenarioPreferWhy
Just refactored a function, want to confirm no redundancy/simplifyRuns reusability/quality/efficiency checks, fixes dead imports, duplicate logic
Finished a complex module, about to merge into mainrequesting-code-reviewAn independent reviewer reduces author blind spots
A teammate left multiple PR commentsreceiving-code-reviewVerify each and assess technically; accept or push back
Finishing code late at night, want a self-check/simplifyNo human needed, AI self-checks

Common workflow combos:

  • New feature: brainstorming → writing-plans → subagent-driven-development → verification
  • Bug fix: systematic-debugging → test-driven-development → verification
  • Refactor: writing-plans → subagent-driven-development → requesting-code-review

2. Before coding: research and design

2.1 A methodology for AI-assisted framework selection

Step 1 — Clarify requirements and constraints (align inputs): turn the business scenario into selection criteria. Describe business context, team stack, deployment environment and performance/security needs; ask AI to extract dimensions (language ecosystem, multi-agent, MCP support, production readiness, community activity) and flag any “deal-breaker”.

Step 2 — Cast a wide net (information gathering): without pre-committing to a language, ask AI to collect mainstream and emerging frameworks grouped by language, list 6–8 candidates (commercial or open source), and produce an initial screen on multi-agent collaboration, MCP/A2A ecosystem, production readiness and learning curve.

Step 3 — Deep compare and business mapping (analysis): provide user roles, core flows and growth expectations; ask AI to map each candidate to your business, do a gap analysis, propose an architecture and recommend inclusions/exclusions with a fit score.

Step 4 — Cross-validate and challenge (elimination): actively challenge the recommendation (“why not X?”), distinguish native/community/demo/production capabilities, and ask AI to draw an architecture diagram to check coherence.

Step 5 — Produce the decision doc (close the loop): a reportable, executable conclusion — candidate comparison, recommendation, risks, rollout roadmap, one-line conclusion and reasons for exclusions.

Key principles:

PrincipleMeaning
Diverge then convergeStep 2 doesn’t constrain languages; Step 3 filters by business
Use AI skepticallyAI may confuse community vs. official editions; require sources for key claims
Mix text and diagramsUse Mermaid for complex architectures; easier to spot contradictions
Iterate and digWhen one round is insufficient, keep researching docs/source for key frameworks

2.2 PRD and design

PRD follows: north star → PoC → MVP → release.

The /brainstorming design SOP:

TaskToolNotes
Map product needs and feasibility/brainstormingAI advises, the developer gates
Provide background material@docs/ for files/dirsInclude relevant design docs, API docs and competitor material
Discuss and pick among 2–3 approachesbrainstorming guideFocus on extensibility and cost
Output the technical design/writing-plans + human reviewReview, revise, archive

Steps: drop background into docs/ → load requirements with @docs/... → /brainstorming → confirm scope, selection, module split, interfaces → /writing-plans for the design doc.

Practice notes: use progressive plans for complex problems (PoC with zero infra → MVP with light infra → V1.0 with platform collaboration); raise security/performance constraints during brainstorming; save designs to docs/.

3. During development: coding, integration and debugging

3.1 The dev flow

TaskToolNotes
Implement module by module/subagent-driven-developmentEach task in its own subagent
Provide background knowledge@docs/Load docs, designs and pitfall records
Gate code quality/requesting-code-review + /receiving-code-review + /simplifyMake it correct first, then clean it up

Steps: generate a plan from the design with writing-plans → execute with /subagent-driven-development → per module, run tests + /review → use /verification-before-completion at key points → run /simplify every 3–5 tasks → switch to the debugging SOP on bugs → record key decisions to docs/.

Incremental principles: add to the existing framework, never rebuild from scratch; humans lock the interface contract, AI handles implementation details; get the happy path working first, then edge cases.

3.2 Debugging: /systematic-debugging

The core path: root cause → pattern analysis → hypothesis → fix.

StageActionHard rule
1. Root causeRead the full error; test layer by layer; trace the data flowNo fix before finding the root cause
2. Pattern analysisFind a working example and compare, locate the differenceDon’t assume “that doesn’t matter”
3. HypothesisForm one hypothesis, test with a minimal changeOne change at a time
4. Implement the fixSingle-point fix → verify; 3 consecutive failures → question the architectureNo stacking fixes

MCP / API extras: curl the MCP endpoint raw first to confirm the protocol layer, then debug business logic; mind the Accept header; watch session management (some MCP servers need an initialize handshake).

3.3 Project lifecycle

StageGoalKey deliverable
PoCValidate feasibility, run the core path end-to-endTechnical design + runnable demo
MVPComplete the core features, usable internallyFull core features + basic monitoring
V1.0Production-ready for performance, security and opsFull deployment + SLA + complete docs

Start each stage with /brainstorming to confirm the approach; finish with full archiving.

4. After development: delivery and archiving

TaskAcceptanceNotes
Confirm build/tests passgo build ./..., go test ./...Must actually run green
Docs completeCheck docs/ subdirsAt least README, design doc, pitfalls guide
Tidy git historySplit commits logicallyfeat / fix / docs / chore separated
Environment docCheck .env.exampleCommented well enough for a newcomer to copy

Commit conventions: feat: new feature | fix: fix | docs: docs | chore: build/config.

Appendix: quick decision tree

Yes

Yes

Yes

No

Yes

Yes

New requirement arrives

/brainstorming to discuss the approach

Approach confirmed?

writing-plans to generate a plan

Plan confirmed?

/subagent-driven-development to execute

Bug encountered?

/systematic-debugging

Dev complete?

/simplify or Code Review

Run tests and commit

Stage complete?

Tidy docs + commit + deliver