{"data":{"slug":"discovered-4586e584925aa850f1e97841bb5856414d3384aea594b871","title":"Repo Analysis \u2014 Cross-Repository Architecture Audit & Pattern Absorption","summary":"Extract design patterns from external repositories, map them onto your own system's architecture, and produce a gap analysis with optional fix code. Core principle: Don't copy implementations. Extract patterns \u2192 derive principles \u2192 design your own implementation.","url":"https:\/\/skillshunter.net\/skills\/discovered-4586e584925aa850f1e97841bb5856414d3384aea594b871","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-4586e584925aa850f1e97841bb5856414d3384aea594b871","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-4586e584925aa850f1e97841bb5856414d3384aea594b871.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-4586e584925aa850f1e97841bb5856414d3384aea594b871\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before starting, ensure you have access to the external repository and its source code. Prepare a structured summary template for each repo (\u2264 500 words) with sections for positioning, core abstractions, architecture pattern, worth attention, and risks. Use the provided markdown format for consistency.","instructions":"---\nname: repo-analysis\ndescription: 'Cross-repository architecture audit and pattern absorption methodology. Use when analyzing external repos to extract design patterns, map them onto YOUR system''s architecture, and produce design documents with gap analysis and optional fix code. Covers 5 phases: repo scan, pattern extraction, mapping, value judgment, and structured output. \u9002\u7528\u4e8e\u5916\u90e8\u4ed3\u5e93\u8c03\u7814\u3001\u67b6\u6784\u5ba1\u8ba1\u3001\u6a21\u5f0f\u5bf9\u6bd4\u3001\u8bbe\u8ba1\u6587\u6863\u4ea7\u51fa\u4e0e\u4fee\u590d\u4ee3\u7801\u3002'\nkeywords: [repo, analysis, architecture, audit, pattern, \u4ed3\u5e93, \u8c03\u7814, \u5ba1\u8ba1, \u67b6\u6784, \u6a21\u5f0f]\n---\n# Repo Analysis \u2014 Cross-Repository Architecture Audit & Pattern Absorption\n\nExtract design patterns from external repositories, map them onto your own system's architecture, and produce a gap analysis with optional fix code. Core principle:\n\n> **Don't copy implementations. Extract patterns \u2192 derive principles \u2192 design your own implementation.**\n\n---\n\n## Phase 1 \u2014 Repo scan (15\u201330 min\/repo)\n\n### 1.1 Fast structural assessment\n\nFor each external repo answer 5 questions without going deep:\n\n| Dimension | Key question |\n|---|---|\n| **Positioning** | What problem does it solve? One-sentence core value |\n| **Scale** | Code volume (files\/lines), language stack, dependency complexity |\n| **Core abstraction** | What new concepts does it introduce? (RLM, Harness, Skill, Evidence Graph...) |\n| **Architecture pattern** | Monolith \/ microservices \/ plugin \/ Kernel+Extension? |\n| **Maturity** | prototype \/ early-stage \/ production-ready? stars, maintenance activity |\n\n### 1.2 Output\n\nOne structured summary per repo (\u2264 500 words):\n\n```markdown\n## {Repo Name}\n- **Positioning**: one sentence\n- **Core abstractions**: {2-3 key concepts}\n- **Architecture pattern**: {pattern name, with key directory tree}\n- **Worth attention**: {yes\/no, one-sentence reason}\n- **Risks**: {license, dependencies, maturity}\n```\n\n---\n\n## Phase 2 \u2014 Pattern extraction (cross-repo comparison)\n\n### 2.1 Recognition dimensions\n\nClassify each repo's patterns against a generic agent-system primitive taxonomy:\n\n| Primitive | What to look for | External examples |\n|-----------|-----------------|-------------------|\n| **Intent** | How intent is expressed (natural language \/ structured \/ DSL) | structured problem definition; spec generation |\n| **Context** | Context management (prompt injection \/ RAG \/ persistent REPL \/ knowledge graph) | RLM + persistent REPL; code graph |\n| **Policy** | Constraint enforcement (RBAC \/ approval gates \/ cost quotas \/ constitution) | quality gates; governance layer |\n| **Execution** | Agent runtime (tool use \/ sub-agents \/ sandbox \/ task queue) | Kernel+Extension; sub-agent recursion |\n| **Evidence** | Verification mechanisms (test gates \/ data diff \/ audit logs \/ approval chains) | CI evidence; evidence gates |\n| **Evaluation** | Quality assessment (metric-driven \/ LLM-as-judge \/ human review) | critique loops; metric ratchets |\n| **Learning** | Continuous improvement (memory distillation \/ skill extraction \/ refine loops) | continual harness; interpretable memory |\n\n### 2.2 Traps to avoid\n\n- **Don't be misled by names**: a project called \"Agent Framework\" may have its core value in its evidence model, not its runtime\n- **Don't classify whole repos**: the same repo can inspire multiple primitives (a repo = Context + Execution + Learning)\n- **Distinguish \"what it does\" from \"its design principles\"**: the pattern may be Kernel+Extension, but the principle is \"keep kernel small, everything else plugin\" \u2014 the principle matters more than the implementation\n\n---\n\n## Phase 3 \u2014 Mapping to your system\n\n### 3.1 Gap classification\n\nFor every identified pattern use a three-level marker:\n\n| Marker | Meaning | Condition |\n|--------|---------|-----------|\n| \u2705 **Implemented** | your system already has an equivalent | source path + functional comparison |\n| \u26a0\ufe0f **Partially implemented** | baseline exists but a key dimension is missing | point out what exists + what is missing |\n| \u274c **Not implemented** | a real gap | no equivalent in your system |\n\nEvery judgment MUST be backed by source path and line number.\n\n### 3.2 Mapping template\n\n```markdown\n### Pattern: {Pattern Name} (source: {Repo})\n\n**Current status**: {\u2705\/\u26a0\ufe0f\/\u274c}\n**Existing implementation** (if any):\n  - `path\/to\/file.py:L{line}` \u2014 {functional description}\n**Missing dimensions**:\n  1. {missing item 1}\n  2. {missing item 2}\n**Conflict\/overlap risk**:\n  - overlaps with existing {module}: {conflict \/ complementary \/ independent}\n  - duplicates an existing module or ticket? {yes \/ no \/ partial}\n```\n\n---\n\n## Phase 4 \u2014 Value judgment (absorb or not)\n\n### 4.1 Decision matrix\n\nFor every \u26a0\ufe0f or \u274c pattern:\n\n| Dimension | Weight | Assessment question |\n|-----------|--------|---------------------|\n| **Architecture fit** | high | Does it fit your system's Work Model (Intent\u2192Plan\u2192Execute\u2192Evidence\u2192Validate\u2192Approve)? |\n| **Irreplaceability** | high | If absent, would it become a critical weakness? |\n| **Implementation cost** | medium | How many new modules? How much existing code changes? |\n| **Maintenance cost** | medium | Long-term complexity? New external dependencies? |\n| **Overlap with existing modules** | high | Does an existing module already do 80%? (cross-directory check, not just same dir) |\n| **Phase fit** | medium | Which roadmap phase does it belong to (reliable workflow \/ intelligence \/ continual agent)? |\n\n### 4.2 Decision outcomes\n\n- **Absorb**: architecture fit + irreplaceable \u2192 enter design phase\n- **Stage**: valuable but not in the current phase \u2192 write a staged note, \"wait for phase X\"\n- **Reference**: inspiring but not worth implementing \u2192 record in the knowledge base\n- **Skip**: overlaps, conflicts, or cost far exceeds value \u2192 record the reason and skip\n\n---\n\n## Phase 5 \u2014 Output\n\n### 5.1 Design document\n\nWrite one design document per absorbed pattern, using your repo's design-doc convention. Required sections: motivation, external reference, current-status mapping, design, change impact, risks & verification, phase ownership.\n\n### 5.2 Fix code\n\nIf code changes are included:\n\n- one-off scripts (audit, migration, verification) as standalone `.py` files with an `if __name__ == \"__main__\":` entry\n- patch-level changes via a patch tool rather than new files\n- code must be self-contained; use `print()` not a logging framework for one-off scripts\n\n---\n\n## Hard constraints\n\n### Must do\n\n1. **Every judgment carries source evidence** \u2014 no speculation; every \u2705\/\u26a0\ufe0f\/\u274c has a file path + line\n2. **Cross-domain audit** \u2014 before judging, check whether an existing module (including outside the same directory) already does 80%\n3. **Separate principle from implementation** \u2014 the document's first half discusses the pattern (principle), the second half the concrete implementation plan\n4. **Structured output** \u2014 design docs are designs, not production code; don't modify production source while designing\n\n### Must not do\n\n1. **Do not execute the external repo's code** \u2014 read, analyze, compare only\n2. **Do not judge without looking at your own source** \u2014 \"it probably doesn't exist\" is not evidence\n3. **Do not ignore overlap** \u2014 when an existing implementation is found, first evaluate enhancing it before building new\n4. **Do not stop at positioning narrative** \u2014 \"our system is an X\" is a story, not a technical design. Technical design must answer \"why must these primitives live together\"\n\n---\n\n## Multi-repo batch flow\n\nWhen the input is multiple repos:\n\n```\nPhase 1 (parallel)      each repo scanned independently, structured summaries\n    \u2193\nPhase 2 (cross)         all repos compared, common patterns identified\n    \u2193\nPhase 3 (per pattern)   each pattern mapped against your system\n    \u2193\nPhase 4 (aggregate)     all gaps judged together, prioritized\n    \u2193\nPhase 5 (output)        merged into 1-3 design docs grouped by primitive, not by repo\n```\n\n**Multi-repo output differs from single-repo**: a single repo yields one design doc; a batch (5+) yields docs merged by primitive \u2014 e.g. one doc covering every repo's findings on the Execution primitive.\n","use_cases":["External repository\u8c03\u7814","Architecture audit","Pattern comparison","Design document production","Gap analysis","Fix code generation"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/chenyinrusi\/dsh-engineering-skills\/blob\/86d622bfbebb228269ad2b906c44069fd492397f\/skills\/repo-analysis\/SKILL.md","source_commit":"86d622bfbebb228269ad2b906c44069fd492397f","license":null,"version":null,"listing_approved_at":"2026-11-28","created_at":"2026-11-28T07:59:21.000000Z","updated_at":"2026-11-28T18:37:41.000000Z","seo_title":"Repo Analysis \u2014 Cross-Repository Architecture Audit & Pattern Absorb","seo_description":"Extract design patterns from external repositories, map them onto your own system's architecture, and produce a gap analysis with optional fix code. Core principle: Don't","seo_keywords":["repo","analysis","architecture","audit","pattern","\u4ed3\u5e93","\u8c03\u7814","\u5ba1\u8ba1"]}}