improve-codebase-architecture

द्वारा sanity-io

कोडबेस का अन्वेषण करें ताकि वास्तुशिल्प सुधार के अवसर खोजे जा सकें, विशेष रूप से उथले मॉड्यूल को गहरा करके कोडबेस को अधिक परीक्षण योग्य बनाने पर ध्यान केंद्रित करें। इसका उपयोग तब करें जब...

npx skills add https://github.com/sanity-io/sanity --skill improve-codebase-architecture

Improve Codebase Architecture

Explore a codebase like an AI would, surface architectural friction, discover opportunities for improving testability, and propose module-deepening refactors as GitHub issue RFCs.

A deep module (John Ousterhout, "A Philosophy of Software Design") has a small interface hiding a large implementation. Deep modules are more testable, more AI-navigable, and let you test at the boundary instead of inside.

Process

1. Explore the codebase

Use the Agent tool with subagent_type=Explore to navigate the codebase naturally. Do NOT follow rigid heuristics — explore organically and note where you experience friction:

  • Where does understanding one concept require bouncing between many small files?
  • Where are modules so shallow that the interface is nearly as complex as the implementation?
  • Where have pure functions been extracted just for testability, but the real bugs hide in how they're called?
  • Where do tightly-coupled modules create integration risk in the seams between them?
  • Which parts of the codebase are untested, or hard to test?

The friction you encounter IS the signal.

2. Present candidates

Present a numbered list of deepening opportunities. For each candidate, show:

  • Cluster: Which modules/concepts are involved
  • Why they're coupled: Shared types, call patterns, co-ownership of a concept
  • Dependency category: See REFERENCE.md for the four categories
  • Test impact: What existing tests would be replaced by boundary tests

Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"

3. User picks a candidate

4. Frame the problem space

Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:

  • The constraints any new interface would need to satisfy
  • The dependencies it would need to rely on
  • A rough illustrative code sketch to make the constraints concrete — this is not a proposal, just a way to ground the constraints

Show this to the user, then immediately proceed to Step 5. The user reads and thinks about the problem while the sub-agents work in parallel.

5. Design multiple interfaces

Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a radically different interface for the deepened module.

Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category, what's being hidden). This brief is independent of the user-facing explanation in Step 4. Give each agent a different design constraint:

  • Agent 1: "Minimize the interface — aim for 1-3 entry points max"
  • Agent 2: "Maximize flexibility — support many use cases and extension"
  • Agent 3: "Optimize for the most common caller — make the default case trivial"
  • Agent 4 (if applicable): "Design around the ports & adapters pattern for cross-boundary dependencies"

Each sub-agent outputs:

  1. Interface signature (types, methods, params)
  2. Usage example showing how callers use it
  3. What complexity it hides internally
  4. Dependency strategy (how deps are handled — see REFERENCE.md)
  5. Trade-offs

Present designs sequentially, then compare them in prose.

After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not just a menu.

6. User picks an interface (or accepts recommendation)

7. Create GitHub issue

Create a refactor RFC as a GitHub issue using gh issue create. Use the template in REFERENCE.md. Do NOT ask the user to review before creating — just create it and share the URL.

sanity-io की और Skills

sanity-migration
sanity-io
अन्य CMS और सामग्री प्रणालियों से Sanity में माइग्रेशन की योजना बनाता है, उन्हें कार्यान्वित करता है और उनकी समीक्षा करता है। AEM, Adobe Experience Manager, Contentful, Strapi, Webflow, WordPress, Payload, Drupal, Markdown/MDX/frontmatter फ़ाइलों, WXR/XML निर्यात, CMS API, डेटाबेस डंप, स्थिर HTML से Sanity में माइग्रेट या रीप्लेटफ़ॉर्म करते समय, या निष्कर्षण, रूपांतरण, Portable Text रूपांतरण, एसेट माइग्रेशन, रीडायरेक्ट, सत्यापन और कटओवर वर्कफ़्लो डिज़
officialdevelopmentdatabase
create-agent-with-sanity-context
sanity-io
एजेंट कॉन्टेक्स्ट के माध्यम से सैनिटी सामग्री तक संरचित पहुंच के साथ AI एजेंट बनाएं। सैनिटी-संचालित चैटबॉट सेट अप करते समय, AI सहायक को सैनिटी से कनेक्ट करते समय उपयोग करें…
official
dial-your-context
sanity-io
सैनिटी एजेंट कॉन्टेक्स्ट MCP के लिए इंस्ट्रक्शंस फील्ड सामग्री बनाने हेतु इंटरैक्टिव सत्र। इस कौशल का उपयोग तब करें जब उपयोगकर्ता एजेंट कॉन्टेक्स्ट को ट्यून करने, सुधारने का उल्लेख करें…
official
optimize-agent-prompt
sanity-io
अपने Sanity Agent Context एजेंट को निर्देशित वार्तालाप के माध्यम से ट्यून करें। अन्वेषण डेटा को उत्पादन-तैयार निर्देशों में बदलता है और एक सिस्टम प्रॉम्प्ट तैयार करता है…
official
shape-your-agent
sanity-io
सैनिटी एजेंट कॉन्टेक्स्ट MCP द्वारा संचालित AI एजेंट के लिए सिस्टम प्रॉम्प्ट तैयार करने हेतु इंटरैक्टिव सत्र। इस कौशल का उपयोग तब करें जब उपयोगकर्ता एजेंट के व्यक्तित्व को परिभाषित करना चाहते हैं,…
official
content-experimentation-best-practices
sanity-io
सामग्री प्रयोगों को डिज़ाइन करने, निष्पादित करने और विश्लेषण करने के लिए संरचित मार्गदर्शन, जो रूपांतरण और जुड़ाव को बेहतर बनाने में सहायक हो। इसमें परिकल्पना ढाँचे, मीट्रिक चयन, नमूना आकार गणना, और A/B तथा बहुभिन्नरूपी प्रयोगों में सांख्यिकीय महत्व परीक्षण शामिल है। p-मान, विश्वास अंतराल, शक्ति विश्लेषण, और परिणामों की व्याख्या के लिए बायेसियन विधियों पर विस्तृत संसाधन प्रदान करता है। फ़ील्ड स्तर पर वे
official
content-modeling-best-practices
sanity-io
संरचित सामग्री मॉडलिंग मार्गदर्शन: स्कीमा डिज़ाइन, पुन: प्रयोज्यता और बहु-चैनल वितरण के लिए। मुख्य सिद्धांतों को शामिल करता है: सामग्री को पृष्ठों के बजाय डेटा के रूप में मानना, एकल स्रोत सत्य बनाए रखना, भविष्य के चैनलों के लिए डिज़ाइन करना और संपादक वर्कफ़्लो को अनुकूलित करना। संदर्भ बनाम एम्बेडेड ऑब्जेक्ट, चिंताओं का पृथक्करण और सामग्री पुन: उपयोग पैटर्न के लिए निर्ण
official
portable-text-conversion
sanity-io
HTML और Markdown सामग्री को Sanity के लिए Portable Text ब्लॉक में बदलें। लीगेसी CMS से सामग्री माइग्रेट करते समय, Sanity में HTML या Markdown आयात करते समय उपयोग करें,…
official