sam
Design and review software architecture with SAM. Use for architectural drivers, ADD design, documentation, ADR approval or reopening, approved project context, architecture change review, and delivery handoff.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- sam
- description
- Design and review software architecture with SAM. Use for architectural drivers, ADD design, documentation, ADR approval or reopening, approved project context, architecture change review, and delivery handoff.
02 资源文件 12
- 资产文件assets/github-actions.yml656 B
- 资产文件assets/templates/architecture-document.md3.6 KB
- 资产文件assets/templates/architecture-drivers.md2.0 KB
- 资产文件assets/templates/design-decisions.md2.1 KB
- 资产文件assets/templates/design-system.md1.6 KB
- 资产文件assets/templates/implementation-plan.md1.9 KB
- 资产文件assets/templates/iteration-plan.md1.1 KB
- 资产文件assets/templates/project-brief.md1.9 KB
- 参考文档references/delivery.md980 B
- 参考文档references/phase-one.md1.4 KB
- 参考文档references/phase-three.md1.2 KB
- 参考文档references/phase-two.md1.7 KB
03 SKILL.md 正文
SAM Workflow
Use the user's language for conversation. Keep canonical filenames, stable IDs, metadata fields, and generated artifacts in English.
Core Rules
- Treat SAM as three architecture phases: requirements, design, and documentation.
- Treat delivery planning as an optional handoff, never as phase 4.
- Let the agent draft and analyze; require the architect to approve drivers, material tradeoffs, ADRs, and accepted risks.
- Treat Draft and In Review artifacts as proposals. Only Approved artifacts constrain implementation.
- Write architecture artifacts under
docs/architecture/; additionally maintain only the managed SAM block in rootAGENTS.md. - Preserve existing user content and stop on ambiguous migrations.
- Use
REQ,QA,CON,DRV,ADR,STORY,SLICE, andCHECKidentifiers. - Use
Addressed,Pending, orAccepted Riskduring design. UseVerifiedorFailedonly with executed evidence metadata. - Ask only when an unresolved answer would change a primary driver, hard constraint, irreversible decision, or critical risk.
State Helper
Use tools/sam/scripts/sam_state.py when installed in the project. Otherwise resolve ../../scripts/sam_state.py relative to this skill and invoke that absolute path from the project root. Use the same CLI for all clients.
python ../../scripts/sam_state.py init --name "Project"
python ../../scripts/sam_state.py status
python ../../scripts/sam_state.py next
python ../../scripts/sam_state.py can-run step-one
python ../../scripts/sam_state.py mark-draft phase-1-drivers
python ../../scripts/sam_state.py approve phase-1-drivers --approved-by "Architect"
python ../../scripts/sam_state.py reopen phase-2-design --reason "Driver changed"
python ../../scripts/sam_state.py handoff
If the helper cannot be resolved, report the missing installation before claiming current approval or recording a transition.
Commands
@sam init NAME="project"
Run init. It creates the three-phase base files, docs/architecture/README.md, state v3, and an idempotent SAM block in root AGENTS.md. Ask the user to complete and review project-brief.md; its blank scaffold cannot be approved.
@sam status and @sam next
Run the matching helper command. Report drift, artifact authority, current core gate, optional delivery status, and one concrete next action. Never treat Superseded or drifted content as current.
Architecture change review
Run status and read the relevant approved drivers and ADRs. Use check --path <project-relative-path> for planned edits and check for the resulting diff. Compare the intent with approved contracts and boundaries even when no path rule matches. A review trigger needs impact assessment. A failed check needs a fix or an approved change to the governing decision. Cite the IDs and pause the affected work for a decision when the impact is material. Local review and CI use the same policy and checker.
@sam step-one
Run can-run step-one. Read references/phase-one.md and the generated base files. Produce a complete driver proposal without architecture choices, update architecture-drivers.md, then run mark-draft phase-1-drivers.
@sam step-two
Run can-run step-two. Read references/phase-two.md. Update the iteration plan and design decisions with bounded alternatives, instantiation, useful provisional views, ADR proposals, risks, and checks. Pause for material authority decisions; otherwise complete the coherent draft. Mark both artifacts Draft.
@sam step-three
Run can-run step-three. Read references/phase-three.md. Select views from stakeholder questions, consolidate approved design information, complete traceability and agent guidance, then mark the architecture document Draft.
@sam approve GATE="..."
Run helper approval only after the named human explicitly approves. Supported gates are brief, phase-1-drivers, phase-2-design, phase-3-document, optional delivery, and optional design-system. Validation, source hashes, order, and drift can block approval.
@sam reopen GATE="..." REASON="..."
Run helper reopen. Preserve the reason, set the selected artifact Draft, and make dependent artifacts Superseded. Never edit an approved artifact silently.
@sam handoff
Require phase 3 approval, run handoff, then read references/delivery.md. Generate the optional delivery plan. Create design-system.md from its asset only when a user interface needs shared design guidance and product/design ownership is known.
@sam step-four
Treat as a deprecated alias for @sam handoff. Tell the user it is no longer a fourth architecture phase, then follow the handoff behavior.
@sam slice N
Require an Approved delivery plan. Emit only the requested slice prompt with authoritative sources, boundaries, criteria, checks, tests, risks, and rollback. Do not implement it.
Resources
- Read
references/phase-one.md,phase-two.md,phase-three.md, ordelivery.mdonly for the active workflow. - Use
assets/templates/as executable artifact scaffolds. Do not invent alternate required sections.
04 同仓库更多 Skills
sam-step-two
Generate or revise SAM phase 2 ADD design drafts. Trigger on /sam-step-two, @sam-step-two, or SAM step two.
sam-step-three
Generate or revise the SAM phase 3 architecture document draft. Trigger on /sam-step-three, @sam-step-three, or SAM step three.
sam-step-one
Generate or revise the SAM phase 1 architecture drivers draft. Trigger on /sam-step-one, @sam-step-one, or SAM step one.
sam-step-four
Compatibility alias for the optional SAM delivery handoff. Trigger on /sam-step-four, @sam-step-four, or legacy SAM step four requests; explain that SAM now has three architecture phases.
sam-status
Show SAM gate and artifact status from docs/architecture. Trigger on /sam-status, @sam-status, or SAM status requests.
sam-slice
Emit the code-agent prompt for one slice from an approved optional SAM delivery handoff. Trigger on /sam-slice, @sam-slice, or SAM slice requests.