Back to Prompts
Package 4 prompts

Modular Architecture Prompts

AI prompts for modular architecture from the LearnWithHasan AI Coding Building Blocks (Architecture).

#1 Coding Assistant

Analyze & Plan Module Structure

Start here to plan your refactoring From the Modular Architecture AI Coding Building Block.

Prompt
Analyze my codebase and propose a modular architecture. I want to restructure it so AI coding assistants can work more effectively with isolated, focused modules.

Current structure: [paste your folder structure or describe your app]

For each proposed module:
1. Name and single responsibility
2. What files/functions belong in it
3. What it exports (public interface)
4. What it imports from other modules
5. Estimated size (should be <500 lines ideally)

Goals:
- Each module should be small enough for AI to fully understand
- Clear boundaries so updates don't cascade
- Easy to test and debug in isolation

My stack: [your language/framework]

I'm learning, so explain each part simply.
#2 Coding Assistant

Extract a Module

For pulling a feature into its own module From the Modular Architecture AI Coding Building Block.

Prompt
Extract [feature name] into its own isolated module from my current codebase.

Current code location: [file path or paste relevant code]

Requirements:
1. Create a clean public interface (what other modules can call)
2. Hide implementation details (private functions/classes)
3. Define clear types/interfaces for inputs and outputs
4. Add a module-level docstring explaining its purpose
5. List all external dependencies this module needs
6. Ensure no circular imports with other modules

The module should be completely self-contained. I want to be able to:
- Ask AI to modify just this module without loading the rest of my codebase
- Run tests on this module in isolation
- Swap the implementation without changing calling code

My stack: [your language/framework]

I'm learning, so explain each part simply.
#3 Coding Assistant

Design Module Interfaces

For designing clean module boundaries From the Modular Architecture AI Coding Building Block.

Prompt
Design clean interfaces between my modules. I want to minimize coupling so each module can evolve independently.

My modules: [list your modules, e.g., auth, billing, notifications, users]

For each module boundary:
1. Define the contract (function signatures, types, what's promised)
2. Use dependency injection where appropriate
3. Create interfaces/protocols rather than concrete implementations
4. Document what can and cannot cross module boundaries
5. Suggest a pattern for inter-module communication (events, direct calls, message queue)

Goal: If I ask AI to "change how billing works," it should only need to understand the billing module, not touch auth, users, or notifications.

My stack: [your language/framework]

I'm learning, so explain each part simply.
#4 Coding Assistant

Add AI-Friendly Module Documentation

For making modules AI-readable From the Modular Architecture AI Coding Building Block.

Prompt
Add documentation to my module that helps AI coding assistants understand it quickly.

Module path: [folder/file path]

Create:
1. A MODULE_README.md with:
   - One-paragraph purpose statement
   - Public interface summary (what other modules should call)
   - Example usage snippets
   - What this module does NOT handle (boundaries)

2. Inline documentation:
   - Docstrings for all public functions
   - Type hints for all parameters and returns
   - Brief comments for non-obvious logic

3. An ARCHITECTURE.md if the module has multiple files explaining:
   - How files relate to each other
   - Data flow through the module
   - Key design decisions

Goal: An AI assistant should be able to read these docs and immediately understand how to work with this module without reading every line of code.

I'm learning, so explain each part simply.
44 views