pmm-modular

项目模块化管理。自动发现项目架构,将文件映射到带 11 位层级编码的模块,并跟踪变更。适用于探索不熟悉的项目、按模块定位代码或跟踪代码变动时调用。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "pmm-modular":https://skillpi.com/zh/skills/deepskill-ce8b2ad7a4eabd3122705bad7be352c69a2cc0a511292152a08d0141aa5b3e65。安装前核对上游来源和版本:https://skillhub.cn/skills/user_568e7d7c/pmm-modular。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

项目模块化管理。自动发现项目架构,将文件映射到带 11 位层级编码的模块,并跟踪变更。适用于探索不熟悉的项目、按模块定位代码或跟踪代码变动时调用。

0 下载

介绍来源: third_party · user_568e7d7c · 1.0.2 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
限制与区别
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: PMM-modular
description: "Project Modular Management. Auto-discovers project architecture, maps files to modules with 11-digit hierarchical codes, tracks changes. Invoke when exploring unfamiliar projects, locating code by module, or tracking code changes."

Project Modular Management (PM2)

Zero-configuration project structure analyzer with 11-digit hierarchical encoding. Drop it into any project, run once, get a complete module map with change tracking.

Features

Feature Description
11-digit hierarchical encoding L PPP OOO FFFF — encodes full directory tree depth and ordering
Append-only coding New items get next available number; deleted items become tombstones (never re-assigned)
Virtual grouping Root-level non-source files (e.g., 300+ .md files) automatically grouped into a virtual "Documentation" directory
Auto-discovery Scans project tree, respects .gitignore, auto-categorizes files
Framework detection Recognizes React, Vue, Next.js, Node, Go, Python, PHP, Java
Change tracking Compares snapshots, logs added/removed/modified files with size/LoC deltas
Multiple formats Text tree, Markdown, JSON output
Self-healing Delete data/ dir anytime — auto-rebuilds on next run
Configurable .modularrc.json for custom skip patterns per project
Enhanced error handling Friendly error messages with error codes and troubleshooting tips
Boundary detection Warns when project exceeds recommended size limits

11-Digit Encoding Scheme

L PPP OOO FFFF
│ ─┬─  ─┬─  ─┬─
│  │    │    └── File index (0000 = directory or standalone file)
│  │    │         0001+ = file inside a directory (sub-index)
│  │    └────── Fixed separator "000"
│  └────────── Level sequential number (001-999), global per level
└──────────── Level letter (A = root depth 1, B = depth 2, C = depth 3, ...)

Encoding Rules

Rule Description
DFS pre-order Codes assigned by depth-first traversal: root → children in order
Shared PPP pool Directories and files at the same level share the PPP number space
Append-only New modules/files get the next available PPP; deleted codes are never recycled
Tombstones Deleted items retain their code entry marked with deleted_at; PPP stays consumed
Virtual grouping Root files not matching config patterns are grouped under a virtual "Documentation" node (B-level)

Example

yunheiku/
├── api/                     A0010000000
│   ├── .env                   B0010000000
│   ├── routes/                B0020000000
│   │   ├── query.js             C0010000000
│   │   └── submit.js            C0020000000
│   └── services/              B0030000000
│       └── token-cache.js       C0030000000
├── src/                      A0020000000
│   ├── App.tsx                 B0040000000
│   └── components/             B0050000000
│       └── Header.tsx            C0040000000
└── docs/                     A0030000000
    └── README.md               B0060000000

When to Use This Tool

Recommended Scenarios

Scenario Description
New project onboarding Run once to get a bird's-eye view of the architecture
Before coding Check the module map to understand which files to touch
After coding Run again to confirm the change scope matches expectations
Code review Use the change log to understand what was modified and why
CI integration Generate a Markdown report as a build artifact
Team alignment Share .modularrc.json to ensure consistent module boundaries
Project handover Document the project structure for new team members
Refactoring planning Understand the current structure before restructuring

Not Recommended For

Scenario Reason
Projects with >5000 files May be slow and consume significant memory
Projects with >15 levels of nesting Deep nesting can cause performance issues
Read-only or network drives Permission restrictions may cause errors
Temporary or throwaway projects Overhead not justified for short-lived projects
Projects with highly dynamic file structures Frequent changes may overwhelm the change log

Quick Start

# First run — auto-discovers module structure
python generate_module_map.py

# Subsequent runs — stable codes, detects changes
python generate_module_map.py

# Generate a Markdown report
python generate_module_map.py --format md -o modules.md

# JSON export
python generate_module_map.py --format json -o modules.json

# Force re-discovery (discard existing codes)
python generate_module_map.py --reset

# Run on a specific project
python generate_module_map.py /path/to/project

# Suppress progress messages
python generate_module_map.py --quiet

# Force run even if project exceeds recommended limits
python generate_module_map.py --force

Output Example

======================================================================
  React Project Module Map
  Project : D:\.workbuddy\yunheiku
  Generated: 2026-07-16 21:30:00 | Files: 962 | LoC: 251.8k
======================================================================

|-- [D] api                              A0010000000
|   |-- [F] .env                             B0010000000  110B
|   |-- [D] routes                           B0020000000
|   |   +-- [F] query.js                         C0010000000  6.8KB
|   +-- [D] services                         B0030000000
|       +-- [F] token-cache.js                   C0020000000  2.9KB
|-- [D] src                              A0020000000
|   |-- [F] App.tsx                          B0040000000  1.2KB
|   +-- [D] components                       B0050000000
|       +-- [F] Header.tsx                       C0030000000  892B
+-- [D] Documentation                    A0030000000
    |-- [F] README.md                        B0060000000  2.1KB
    +-- [F] SETUP.md                          B0070000000  3.5KB

======================================================================
  Change Log
======================================================================
  + Added [A0040000000] new-module/index.ts (1.2KB, 45 lines)
  - Removed [B0080000000] old-file.ts (tombstoned)
  ~ Modified [C0030000000] components/Header.tsx (892B -> 1.2KB)

  Total: 3 change(s)

  Data: .../yunheiku-modular/data/a43bf6a5

Configuration (.modularrc.json)

Place in your project root to customize behavior:

{
  "skip_dirs": ["generated", "fixtures"],
  "skip_files": ["*.gen.ts"]
}
Key Type Default Description
skip_dirs string[] — Additional directories to ignore
skip_files string[] — Additional file patterns to ignore

Data Storage

All data is kept inside the skill directory, isolated per project (MD5 hash of project path):

skills/yunheiku-modular/
├── SKILL.md
├── generate_module_map.py
└── data/                          # Safe to delete — auto-rebuilds
    └── a43bf6a5/                  # One folder per project
        ├── tree-config.json       # Stable code assignments + tombstones
        ├── snapshot.json          # Full file metadata snapshot
        └── change-log.json        # Last 50 change entries

Why Append-Only + Tombstones?

  • Stability: A file's code never changes once assigned, so external references (docs, tickets, PRs) stay valid
  • Traceability: Tombstones show what was deleted and when
  • No cascading renumbers: Adding a file never shifts codes of other files
  • Git-friendly: Predictable, merge-conflict-free encoding

Error Codes

Code Type Description Troubleshooting
E001 ProjectNotFound No project markers detected Ensure you're in a project directory with package.json, go.mod, etc.
E002 PermissionDenied Insufficient permissions Run with appropriate permissions or check directory access
E003 PathError Invalid or non-existent path Verify the path exists and is accessible
E004 ConfigError Error loading configuration Check .modularrc.json for valid JSON syntax
E005 DataError Error reading/writing project data Check data directory permissions
E006 EncodingError File encoding issue File may have unsupported encoding; check file contents
E007 ProjectTooLarge Project exceeds recommended limits Use --force to override or consider filtering more files
E008 UnknownError Unexpected error Check error details for more information

Warnings

Code Type Description Action
W001 LargeProject Project has many files Consider using --force or reducing scope
W002 DeepNesting Deep directory nesting Consider simplifying project structure
W003 SpecialCharacters Files with special characters Rename files to avoid special characters
W004 LongPaths Paths exceeding recommended length Shorten directory names or reorganize
W005 EmptyProject No source files found Verify skip patterns aren't too aggressive

Best Practices

Do's

  1. New project onboarding: Run once to get a bird's-eye view of the architecture
  2. Before coding: Check the module map to understand which files to touch
  3. After coding: Run again to confirm the change scope matches expectations
  4. Code review: Use the change log to understand what was modified and why
  5. CI integration: Generate a Markdown report as a build artifact
  6. Team alignment: Share .modularrc.json to ensure consistent module boundaries
  7. When adding files: Just create them — PM2 auto-assigns the next available code on next run
  8. When deleting files: Safe to delete — PM2 tombstones the old code, new files won't reuse it

Don'ts (Anti-Patterns)

  1. Don't run on extremely large projects (>5000 files) — it will be slow and memory-intensive
  2. Don't expect real-time updates — PM2 runs on-demand, not continuously
  3. Don't modify the data directory manually — let PM2 manage it
  4. Don't use for temporary directories — overhead not justified
  5. Don't rely on module codes for runtime logic — codes are for reference only
  6. Don't panic if you see warnings — warnings don't prevent analysis from completing

FAQ

Q: What does the error "Project exceeds recommended size limits" mean?

A: PM2 limits projects to 5000 files by default to ensure reasonable performance. If your project has more files, you can either:

  • Use --force flag to override the limit
  • Add more directories to .modularrc.json's skip_dirs to reduce scope
  • Run PM2 on subdirectories separately

Q: Why do deleted files still show up in the codes?

A: PM2 uses a "tombstone" system — deleted files retain their codes but are marked as deleted. This ensures:

  • References to those codes remain valid (e.g., in documentation or tickets)
  • New files don't accidentally reuse old codes
  • You can see what was deleted and when

Q: Can I integrate PM2 into my CI pipeline?

A: Yes! Add this to your CI workflow:

python generate_module_map.py --format md -o module-report.md

Then upload module-report.md as an artifact.

Q: How do I reset all codes and start fresh?

A: Run with --reset flag:

python generate_module_map.py --reset

This will discard all existing codes and re-discover the project from scratch.

Q: My project has no source files after filtering. What's wrong?

A: Check your .modularrc.json — you may have over-aggressive skip patterns. Also verify that your .gitignore isn't excluding too much.

Q: Can I use PM2 on network drives or read-only directories?

A: PM2 requires write access to its data/ directory for storing snapshots and configs. Read-only project directories should work as long as the data directory is writable.

Q: What happens if PM2 encounters a file it can't read?

A: PM2 will skip unreadable files with a warning and continue processing. The file will show "N/A" for size and line count in the output.

Q: How do I handle special characters in file paths?

A: PM2 will warn about files with special characters but will still process them. For best results, rename files to use only alphanumeric characters, underscores, and hyphens.

Q: Can I use PM2 with other tools?

A: Yes! PM2 can be integrated with:

  • VS Code: Add a task to run PM2 on save
  • Git hooks: Run on pre-commit to verify change scope
  • Project management tools: Export JSON and parse in your workflow
  • Documentation generators: Use Markdown output in your docs

Q: How often should I run PM2?

A: It depends on your workflow:

  • Daily: For active development to track changes
  • Before/after major changes: To document scope
  • On demand: When you need to understand the current structure

Q: What if I move a file?

A: Moving a file is treated as deleting the old path and adding a new path. The old code becomes a tombstone, and the new location gets a new code. To preserve the code, you would need to manually update tree-config.json.

Tool Integration Examples

VS Code Task

Add this to .vscode/tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Generate Module Map",
      "type": "shell",
      "command": "python generate_module_map.py --format md -o MODULE_MAP.md",
      "group": "build",
      "presentation": {
        "reveal": "always",
        "panel": "new"
      }
    }
  ]
}

Git Pre-Commit Hook

Create .git/hooks/pre-commit:

#!/bin/bash
python generate_module_map.py --format md -o MODULE_MAP.md
git add MODULE_MAP.md

GitHub Actions Workflow

Create .github/workflows/module-map.yml:

name: Generate Module Map
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: python generate_module_map.py --format md -o module-report.md
      - uses: actions/upload-artifact@v4
        with:
          name: module-report
          path: module-report.md

Limitations

  • Performance: Best for projects under 5000 files and 15 directory levels deep
  • Memory: Large projects may consume significant memory during analysis
  • Real-time: PM2 runs on-demand; it doesn't monitor for file changes automatically
  • Encoding: Files with non-UTF-8 encoding may not be processed correctly
  • Permissions: Requires read access to project files and write access to data directory

当前收录版本

1.0.2

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 解决项目开发中的核心痛点:架构发现、代码定位、变更追踪
  • 支持多种输出格式和CI集成,具备高频刚需特性
  • 11位层级编码系统提供稳定可追溯的模块标识
触发精准95/100

亮点

  • 触发词精准覆盖项目探索、代码定位、变更追踪等核心场景
  • 明确区分推荐与不推荐使用场景,边界清晰
  • description位置正确,内容完整无截断
结构规范93/100

亮点

  • 结构完整:包含功能特性、编码方案、使用场景、配置说明等
  • 提供完整的Quick Start和端到端示例
  • frontmatter完整,文档长度适中,排版规范
执行可靠91/100

亮点

  • 提供完整的错误码和警告码系统,包含详细排查建议
  • 支持多种命令行参数,覆盖主要异常场景
  • 数据目录自管理,支持重置和强制运行等安全机制
证据可验 (前四项均值)93/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。