improve-codebase-architecture
Skill5 starsChanged 4 months agoMITView on GitHub
สแกน codebase หาโอกาส deepening แล้วนำเสนอเป็น HTML report แบบ visual จากนั้น grill เจาะลึกตัวที่คุณเลือก
195 other projects use a version of this.
Adopted by
Most recently taken up by
- chrysogonus/power-agentstheir own version, first seen Nov 8, 2026
- caidanw/skillstheir own version, first seen Nov 8, 2026
- domengabrovsek/agent-configtheir own version, first seen Nov 8, 2026
- domengabrovsek/claudetheir own version, first seen Nov 8, 2026
- The-Vibe-Company/quivrtheir own version, first seen Nov 8, 2026
- miklschmidt/archboardtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use decision-mapping.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
FabienDehopreSkilldecision-mapping
Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.
Also in 8 projects that use this
Other versions195 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 195
- mattpocock/skills★ 309ksame name
- danny-avila/LibreChat★ 47ksame name
- LibreChat-AI/LibreChat★ 47ksame name
- QuivrHQ/quivr★ 40ksame name
- The-Vibe-Company/quivr★ 40ksame name
- windmill-labs/windmill★ 18ksame name
- GreyDGL/PentestGPT★ 16ksame name
- humanlayer/humanlayer★ 13ksame name
- sanity-io/sanity★ 6.4ksame name
- ArcReel/ArcReel★ 6.3ksame name
185 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- design-an-interfaceSkill
- qaSkill
- request-refactor-planSkill
- ubiquitous-languageSkill
- ask-mattSkill
- codebase-designSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- grill-with-docsSkill
- implementSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- setup-matt-pocock-skillsSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wayfinderSkill
- claude-handoffSkill
- loop-meSkill
- setup-ts-deep-modulesSkill
- wizardSkill
- writing-beatsSkill
- writing-fragmentsSkill
- writing-shapeSkill
- git-guardrails-claude-codeSkill
- migrate-to-shoehornSkill
- scaffold-exercisesSkill
- setup-pre-commitSkill
- edit-articleSkill
- obsidian-vaultSkill
- grillingSkill
- grill-meSkill
- handoffSkill
- teachSkill
- writing-great-skillsSkill
The file
Files
Improve Codebase Architecture
ขุดหาจุดฝืดเชิงสถาปัตยกรรม แล้วเสนอ โอกาส deepening — refactor ที่เปลี่ยน module ตื้น ๆ ให้กลายเป็น deep module เป้าหมายคือให้ test ได้ง่ายและให้ AI นำทางใน codebase ได้สะดวก
คำสั่งนี้_อิง_ domain model ของโปรเจกต์ และสร้างบนคลังคำศัพท์ด้าน design ที่ใช้ร่วมกัน:
- รัน skill
/codebase-designเพื่อโหลดคำศัพท์ด้านสถาปัตยกรรม (module, interface, depth, seam, adapter, leverage, locality) และหลักการของมัน (deletion test, "the interface is the test surface", "one adapter = hypothetical seam, two = real") ใช้คำเหล่านี้ให้ตรงเป๊ะในทุกข้อเสนอ — อย่าเผลอไปใช้คำอย่าง "component," "service," "API," หรือ "boundary" - ภาษา domain ใน
CONTEXT.mdช่วยตั้งชื่อให้ seam ที่ดี ส่วน ADR ในdocs/adr/บันทึกการตัดสินใจที่คำสั่งนี้ไม่ควรหยิบมาถกใหม่
ขั้นตอนการทำงาน
1. Explore
อ่าน domain glossary ของโปรเจกต์ (CONTEXT.md) และ ADR ในบริเวณที่กำลังจะแตะก่อน
จากนั้นใช้ Agent tool แบบ subagent_type=Explore เดินสำรวจ codebase อย่ายึด heuristic ตายตัว — สำรวจแบบเป็นธรรมชาติ แล้วจดจุดที่รู้สึกฝืด:
- ตรงไหนที่การทำความเข้าใจ concept เดียวต้องกระโดดไปมาระหว่าง module เล็ก ๆ หลายตัว?
- ตรงไหนที่ module ตื้น — interface ซับซ้อนแทบเท่าตัว implementation เอง?
- ตรงไหนที่แยก pure function ออกมาเพียงเพื่อให้ test ได้ แต่บั๊กจริง ๆ ซ่อนอยู่ในวิธีที่มันถูกเรียก (ไม่มี locality)?
- ตรงไหนที่ module ซึ่งผูกกันแน่นรั่วข้าม seam ของตัวเอง?
- ส่วนไหนของ codebase ที่ไม่มี test หรือ test ผ่าน interface ปัจจุบันได้ยาก?
ใช้ deletion test กับทุกอย่างที่สงสัยว่าตื้น: ถ้าลบมันทิ้ง ความซับซ้อนจะถูกรวมศูนย์ หรือแค่ย้ายที่? คำตอบ "ใช่ รวมศูนย์" คือสัญญาณที่เราต้องการ
2. นำเสนอ candidate เป็น HTML report
เขียนไฟล์ HTML แบบ self-contained ลง temp directory ของ OS เพื่อไม่ให้อะไรหลุดเข้าไปใน repo หา temp dir จาก $TMPDIR ถ้าไม่มีให้ fallback เป็น /tmp (หรือ %TEMP% บน Windows) แล้วเขียนไปที่ <tmpdir>/architecture-review-<timestamp>.html เพื่อให้แต่ละรอบได้ไฟล์ใหม่เสมอ เปิดไฟล์ให้ผู้ใช้ดู — xdg-open <path> บน Linux, open <path> บน macOS, start <path> บน Windows — แล้วบอก absolute path ให้เขาด้วย
report ใช้ Tailwind ผ่าน CDN สำหรับ layout และ styling และ Mermaid ผ่าน CDN สำหรับ diagram ในจุดที่ graph/flow/sequence สื่อโครงสร้างได้ชัดกว่า ผสม Mermaid กับ visual ที่วาดเองด้วย CSS/SVG — ใช้ Mermaid เมื่อความสัมพันธ์มีรูปทรงแบบ graph (call graph, dependency, sequence) และใช้ div/SVG ที่ประกอบเองเมื่ออยากได้อะไรที่ editorial กว่า (mass diagram, cross-section, animation การยุบรวม) candidate แต่ละตัวต้องมี before/after visualisation เน้น visual เข้าไว้
candidate แต่ละตัว render เป็น card ที่มี:
- Files — ไฟล์/module ไหนบ้างที่เกี่ยวข้อง
- Problem — ทำไมสถาปัตยกรรมปัจจุบันถึงสร้างความฝืด
- Solution — อธิบายเป็นภาษาคนว่าอะไรจะเปลี่ยนไป
- Benefits — อธิบายในแง่ locality กับ leverage และ test จะดีขึ้นอย่างไร
- Before / After diagram — วางคู่กัน วาดเอง แสดงให้เห็นความตื้นและการ deepen
- Recommendation strength — หนึ่งใน
Strong,Worth exploring,Speculativeแสดงเป็น badge
ปิดท้าย report ด้วยส่วน Top recommendation: candidate ตัวไหนที่ควรลงมือก่อน และเพราะอะไร
ใช้คำศัพท์จาก CONTEXT.md สำหรับฝั่ง domain และคำศัพท์จาก /codebase-design สำหรับฝั่งสถาปัตยกรรม ถ้า CONTEXT.md นิยามคำว่า "Order" ก็พูดว่า "the Order intake module" — ไม่ใช่ "the FooBarHandler" และไม่ใช่ "the Order service"
ความขัดแย้งกับ ADR: ถ้า candidate ขัดกับ ADR ที่มีอยู่ ให้ยกขึ้นมาเฉพาะเมื่อความฝืดนั้นจริงจังพอที่จะคุ้มกับการเปิด ADR มาทบทวนใหม่ ทำเครื่องหมายให้ชัดใน card (เช่น warning callout: "ขัดกับ ADR-0007 — แต่ควรเปิดมาคุยใหม่เพราะ…") อย่าไล่ลิสต์ refactor เชิงทฤษฎีทุกตัวที่ ADR ห้ามไว้
ดู HTML-REPORT.md สำหรับ HTML scaffold ฉบับเต็ม pattern ของ diagram และแนวทาง styling
อย่าเพิ่งเสนอ interface ในขั้นนี้ หลังเขียนไฟล์เสร็จ ถามผู้ใช้ว่า: "อยากเจาะลึกตัวไหนต่อ?"
3. Grilling loop
พอผู้ใช้เลือก candidate แล้ว รัน skill /grilling เพื่อเดิน design tree ไปกับเขา — ข้อจำกัด, dependency, รูปทรงของ module ที่ deepen แล้ว, อะไรอยู่หลัง seam, test ตัวไหนรอด
side effect เกิดขึ้นระหว่างทางทันทีที่การตัดสินใจตกผลึก — รัน skill /domain-modeling เพื่อให้ domain model ทันสมัยอยู่เสมอ:
- ตั้งชื่อ module ที่ deepen แล้วตาม concept ที่ไม่มีใน
CONTEXT.md? เพิ่มคำนั้นลงCONTEXT.mdถ้าไฟล์ยังไม่มีค่อยสร้างตอนนั้นเลย - คำที่คลุมเครือคมขึ้นระหว่างคุยกัน? อัปเดต
CONTEXT.mdตรงนั้นทันที - ผู้ใช้ปัด candidate ทิ้งด้วยเหตุผลที่มีน้ำหนัก? เสนอทำ ADR โดยถามว่า: "อยากให้บันทึกเรื่องนี้เป็น ADR ไหม เพื่อให้ architecture review รอบหน้าไม่เสนอซ้ำอีก?" เสนอเฉพาะเมื่อเหตุผลนั้นจำเป็นจริง ๆ สำหรับคนที่มาสำรวจในอนาคตเพื่อไม่ให้เสนอเรื่องเดิมซ้ำ — ข้ามเหตุผลชั่วคราว ("ตอนนี้ยังไม่คุ้ม") และเหตุผลที่ชัดในตัวเองอยู่แล้ว
- อยากลองสำรวจ interface ทางเลือกสำหรับ module ที่ deepen แล้ว? รัน skill
/codebase-designแล้วใช้ pattern design-it-twice แบบ sub-agent ขนานของมัน
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

