pm-arch
PM Manager /pm-arch
SKILL.mdadapters/cursor/skills/pm-arch/SKILL.md
GitHub--- description: Scan project structure and generate Mermaid architecture diagrams + flowcharts under .pm/architecture/. handoffs:
- label: Status agent: pm.status prompt: Summarize after architecture scan send: true
User Input
$ARGUMENTS
Outline
- Require
.pm/initialized; else recommend/pm-init. - 若已有
map.json,先读它。定位文件用pm map <关键词>,禁止无过滤全库递归。 - Run
pm archfrom the project root (preferred). This writes:.pm/architecture/map.json— 导航地图(modules / key_files / capabilities / hotspots / lookup).pm/architecture/tree.md— 带注解目录树.pm/architecture/overview.md— 中文总览 + Mermaid.pm/architecture/layer.mmd— 分层架构.pm/architecture/system-context.mmd/service-dependencies.mmd/request-flow.mmd/deploy-flow.mmd.pm/architecture/scan.json
- If a valid
map.jsonalready exists and nothing changed, CLI reuses the map (timestamp only). Skipnode_modules, build, logs, andscan.exclude_dirs. - If CLI is unavailable, generate the same files yourself by scanning (still skip ignore dirs; isolate per-file read failures). If the repo is Vue (
vue/nuxtin package.json deps): include.vuefiles; draw Browser → Vue Router → Page → Component → API (not API Gateway); layer by pages/views, components, composables/stores, api. Non-Vue repos keep the existing heuristics. - Review diagrams: fix wrong edges, rename nodes, add missing externals. Prefer editing the
.mmdfiles then refreshing the Mermaid blocks inoverview.md. - Optional charter compare: mark out-of-scope services or missing in-scope capabilities in
architecture/findings.md(with confidence) only if charter is approved. - Default: write only under
.pm/architecture/. If the user asks to land diagrams in the application tree, show the draft and wait for confirm. - Closing:
_closing.md完整档;只列已生成的架构文件。中文摘要。
Done When
-
map.jsonhas path-basedkey_filesand non-empty module paths;layer.mmdexists - Diagrams reflect this repo (not generic placeholders)
- Ignore dirs were skipped; no secrets in diagram labels or findings
Shared Workflow (all /pm-* commands)
Follow this order when the command mutates .pm/ state:
- Read
.pm/config/project.yamland.pm/config/local.yaml(if missing and command is not init → recommend/pm-init). - If
.pm/metadata is valid, load it; do not force a full-repo rescan. On-demand incremental scan usingsources+extra_scan_roots+--path+ conversation paste (highest priority for/pm-fix). Prefer.pm/architecture/map.jsonand the document index before walking the tree. - Desensitize evidence →
.pm/evidence/scans/{command}-{timestamp}.json(secrets →***). Never persist raw secrets. - Optional charter compare only when
charter.status == approved(attachconfidence). Draft PRD/charter MUST NOT be used as the baseline. - Incremental merge into module
findings.md/todo.md; sync authoritativestate/todo.md. - Refresh
state/overview.mdwith all open/in_progress blocking+high todos (no 3-item cap). Medium/low: counts only unless--verbose. - Append audit to
.pm/state/audit.jsonl(command, time, input/output summary; include reasoning when the step was AI-produced). - Output risk summary + recommended next step (≤20 lines). Never auto-write source/SQL/cloud or land generated docs/rules without explicit user confirmation.
- Closing:
_closing.md完整档。
Design baseline: docs/prd.md + 宪章。