implementation-structure-design

Designs internal implementation structure before code is written.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill implementation-structure-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implementation-structure-design
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/implementation-structure-design
Command: npx skills add https://github.com/machenjie/rd-skills --skill implementation-structure-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents AI-assisted or manual changes from landing as messy, duplicated, poorly placed, low-cohesion code by forcing an explicit implementation-structure decision before any edits are written.

Core Features & Use Cases

  • Reuse-first placement decisions: Decide whether to reuse an existing function/class/module/service/repository/component before introducing anything new.
  • Object vs function modeling guidance: Choose between functions, records, services, adapters, strategies, and classes based on identity, invariants, encapsulation needs, and lifecycle boundaries.
  • File and directory boundary enforcement: Place new files/directories according to cohesion and real layer/capability boundaries, avoiding dumping-ground structure.
  • Test placement rule: Ensure tests are placed next to the observable boundary so the chosen structure is provably usable.

Quick Start

Ask for a pre-implementation plan that explains what existing code will be reused (or why not), what new functions/classes/files/directories are needed (or which are rejected), and exactly where the tests will live to prove the structure works.

Frequently Asked Questions about implementation-structure-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide between reusing existing code or creating a new module before coding?

To decide on code reuse versus new module creation before coding, enforce a reuse-first placement decision that evaluates existing functions, classes, or services for suitability, rejecting speculative abstractions and only introducing new structures when reuse is proven impossible.

How do I choose between object modeling and functions for new code structure?

Choosing between object modeling and functions for code structure requires evaluating identity, invariants, encapsulation needs, and lifecycle boundaries to decide between records, services, adapters, strategies, and classes, enforcing single-responsibility decisions for the new implementation.

What is the best way to enforce directory boundaries and file placement for clean architecture?

The best way to enforce directory boundaries and file placement for clean architecture is to group new files by cohesion and real layer capabilities, avoiding dumping-ground structures while preserving architectural dependency direction across backend and frontend capabilities.

Where should I place tests to prove my code structure works correctly?

To prove your code structure works correctly, place tests at observable behavior boundaries next to the capability being tested, ensuring the chosen structure is provably usable and that internal modeling decisions support clear, observable interactions.

When should I not use speculative abstractions during code refactoring?

You should not use speculative abstractions during code refactoring when extracting or moving code, because forcing an explicit implementation-structure decision rejects premature generalizations and limits shared utilities to pure technical helpers to maintain high cohesion.

Can I apply implementation structure design to both frontend and backend capabilities?

Yes, you can apply implementation structure design to both frontend and backend capabilities, as the process evaluates abstraction placement and responsibility boundaries for new additions, moves, extractions, and reorganizations across the entire stack before code is written.