- (vibe coding). 
 


-     ,       ,    ,        .   ,        ,    .





- (vibe coding).  



 



  , 2026



ISBN 978-5-0070-0909-6

     Ridero


- (vibe coding)   

-     ,       ,    ,        .   ,        ,     [1] [2].

  

   :

  ,   : ,     email,   .

        .

   ,  ,  .

            [1] [3].

  -    ,    ,         [4] [3].




  


-     , MVP, ,  -   .              [1] [5].

   :    ,       ,         [2] [6].




  


     .    ,   ,   ,    ,      [3] [7].

  ,   ,   ,      . -     ,        [3] [8].




 


  -  :

  .

   .

    -.

   UI  -.

      [5] [8].

   :

  backend-.

     .

    .

 ,        [3] [7].

  

 -    ,    :   ,     ,             [1] [9].

  ,       ,      React   ,  email    .   ,    [3] [6].




 


  , -      ,        Ȼ [2] [4].

  ,      ,          [1] [7].

  :

  -  ;

    ;

  -    .



?



        -   ,    

    -    ,      ,      ,       ,    ,     [11] [12].




  


    :     ,   ,   ;          ,    refactoring [11] [13].

 TDD-,   ,    Red-Green-Refactor:  ,   ,     


.

    -,    ,      [14] [12].

 

   :

   -.

       .

    ,   .

         .

 ,     ,      [12] [11].

         small steps:      ,   [15] [11].

-   ,     , ,     [14] [13].

  

    ,  -.

:  ,  ,  -  ,     ,      [13] [16].

    :

    ,   .

   ,    .

     .

    .

 ,     [12] [11].

     :      ,     [17] [18].




   


     -,   :

 Refactoring   ,       [11] [13].

      [12] [19].

      [15] [11].

   legacy  seams,    ,           [17] [18].

  code smells  ,    ,      [16] [13].

  

          :

  .

   .

  .

  code smells    [14] [16].

       .

     :   ,  ,  ,    , ,   seam  legacy- [17] [13].




 


     :

  .

    .

   .

 .

   .

  [12] [11].

:      ,      ,        ,        [16] [13].

  -    ,      [11] [17].







  ,    :

 Martin Fowler, Refactoring: Improving the Design of Existing Code [11] [20].

 Martin Fowler, Catalog of Refactorings


.

 Martin Fowler, Test-Driven Development


.

 Martin Fowler, The Practical Test Pyramid [19] [21].

 Michael Feathers, Working Effectively with Legacy Code


.

 Martin Fowler, Legacy Seam


.

 Martin Fowler, Refactoring to Patterns


.

 

   :

 https://martinfowler.com/books/refactoring.html (https://martinfowler.com/books/refactoring.html)




 https://refactoring.com/catalog/ (https://refactoring.com/catalog/)




 https://martinfowler.com/bliki/TestDrivenDevelopment.html (https://ridero.ru/link/1dyIbgFRU4Smc7YLXx1G5)




 https://martinfowler.com/articles/practical-test-pyramid.html (https://ridero.ru/link/hJeZLzIRsaaAwoimuEDE7)




 https://martinfowler.com/bliki/LegacySeam.html (https://martinfowler.com/bliki/LegacySeam.html)




 http://objectmentor.com/resources/articles/WorkingEffectivelyWithLegacyCode.pdf (https://ridero.ru/link/CR6hE8-b6v2BWYm0MwYCE)




 ,          workflow vibe coding + Fowler     Python/TypeScript.



?



      

       :      ,     ,  ,  ,    [40] [41].




 


      :

 :       .

 :   .

 :   ,    ,  API.

  :  ,   ,  .

  : , , ,  [40] [42].

 :

    legacy-.         ,   .   ,   ,  ,     .     [43] [40].

  

   ,        .

   ,      .    ,  ,    .    [40] [44].

     TDD-:  ,  ,   .          [41] [40].

 

   .

      .      ,  .      ,      [40] [42].

 code smells   :  , , -,     .         ,    [45] [42].

  refactoring-by-steps:  1,  2,  3.         [46] [40].

 legacy-

      legacy,     seams   .

  legacy-   .  seam,      ,   .        [43] [47].

    ,     - .    ,      [43] [44].

       :   ,     ,       [47] [40].

   

        .

    .    3  ,     ,      [48] [41].

  ,  :   ,   ,     [41] [40].

    ,    ,    .        [40] [42].




 TDD


    .

 ,       ,   .    ,     [41] [44].

  failing test   ,    production-code fix,        [41] [40].

,       .   , ,       [44] [43].




 


     ,    .

     ,       UI   API.       dependency injection [40] [44].

 ,        .  seams     ,    [43] [40].




 


 ,    :

   .

      .

    .

  ,  .

   .

 ,   .

   .

    [41] [40].

 

  :

  .

   .

   .

  enterprise-grade [40] [45].

  ,                [42] [40].

-  

    .

: [ ].

:   ,    ,    .

  ,    .

     .

,  code smell       [41] [40] [42].







     :

 Martin Fowler, Refactoring: Improving the Design of Existing Code


.

 Martin Fowler, Catalog of Refactorings


.

 Martin Fowler, Test-Driven Development


.

 Martin Fowler, The Practical Test Pyramid


.

 Michael Feathers, Working Effectively with Legacy Code


.

 Martin Fowler, Legacy Seam


.

    20     Python, TypeScript  Java/Spring.



?



      legacy 

     legacy-    ,      :   ,    ,      [58] [59] [60].

 

     legacy-      :   , , code smells,      seam [60] [59].

      ,    ,   edge-cases,       [61] [60].

        :  ,  ,  ,  ,   [58] [62].

     ,  ,         git [60] [63].

  

   legacy-    : , ,     [60] [58].

:   .  ,   .   .      ,    ,  ,  smell   [60] [64].

    ,   ,        - [60] [61].

 

   :

 .

    .

  .

  .

    [60] [58].

      :    ,      [58] [61].

   ,     seam  ,         [59] [63].

 

1.  legacy  

    . ,   ,    ,   code smells,           seam   [60] [59].

2.  

  ,      ,      edge-cases.   ,      [61] [60].

3.   

      .    .    ,  ,  ,  smell  [58] [62].

4.   

      ,      .    API [59] [63].

5.  

     legacy-:   ,  ,        [60] [63].

   

 legacy      ,   .

    :  ,   ,   ,     [61] [58].

  ,          ,         [60] [62].




 


    :

    legacy-.

      .

     TDD.

     seams   [59] [61].

    :   ,          [58] [60].




  


      :

 Martin Fowler, Refactoring: Improving the Design of Existing Code


.

 Martin Fowler, Catalog of Refactorings


.

 Martin Fowler, Test-Driven Development


.

 Martin Fowler, Legacy Seam


.

 Michael Feathers, Working Effectively with Legacy Code


.

 ,       -   legacy-,      ChatGPT/Claude/Cursor.



?



  FastAPI legacy    

      legacy FastAPI-   :  ,    ,   seams   -  fat endpoints [74] [75] [76].




  FastAPI


 legacy FastAPI    :  route handlers,  HTTP-  -,           endpoint- [76] [77].

       ,     ,   seam,     service/repository-    API [74] [75].



 1: fat endpoint


		@router.post (/orders/ {order_id} /approve)
		async def approve_order (
		order_id: int,
		db: Session = Depends (get_db),
		user: User = Depends (get_current_user),
		):
		order = db.query(Order).filter(Order.id == order_id).first ()
		if not order:
		raise HTTPException (status_code=404, detail=Order not found)

		if order.status!= pending:
		raise HTTPException (status_code=400, detail=Invalid status)

		if user.role!= manager:
		raise HTTPException (status_code=403, detail=Forbidden)

		order.status = approved
		order. approved_by = user.id
		db.commit ()
		db.refresh (order)

		send_email(order.customer_email, approved)
		audit_log (order_approved, order.id, user.id)

		return {id: order.id, status: order.status}

   HTTP-, , -,          ,       [76] [78].




  


  FastAPI endpoint.   .

  

		class OrderService:
		def __init__ (self, db: Session):
		self. db = db

		def approve (self, order_id: int, user: User):
		order = self.db.query(Order).filter(Order.id == order_id).first ()
		if not order:
		raise OrderNotFound ()
		if order.status!= pending:
		raise InvalidOrderStatus ()
		if user.role!= manager:
		raise PermissionDenied ()

		order.status = approved
		order. approved_by = user.id
		self.db.commit ()
		self.db.refresh (order)
		return order

		def get_order_service (db: Session = Depends (get_db)) -> OrderService:
		return OrderService (db)

		@router.post (/orders/ {order_id} /approve)
		async def approve_order (
		order_id: int,
		user: User = Depends (get_current_user),
		service: OrderService = Depends (get_order_service),
		):
		order = service. approve (order_id, user)
		send_email(order.customer_email, approved)
		audit_log (order_approved, order.id, user.id)
		return {id: order.id, status: order.status}

  ,   endpoint    ,  -   service-,       HTTP [76] [77].

-    : ,     [75] [79].



 2:  seam


  legacy FastAPI    email, Kafka, Redis,  API  audit-  -.          [74] [80].




  


   FastAPI service  ,  .

 seam   email  audit-.

   :      NotificationPort  AuditPort,     [74] [81].







		class NotificationPort (Protocol):
		def order_approved (self, email: str) -> None:

		class AuditPort (Protocol):
		def order_approved (self, order_id: int, user_id: int) -> None:

		class OrderService:
		def __init__ (
		self,
		db: Session,
		notifications: NotificationPort,
		audit: AuditPort,
		):
		self. db = db
		self.notifications = notifications
		self.audit = audit

		def approve (self, order_id: int, user: User):
		order = self.db.query(Order).filter(Order.id == order_id).first ()
		if not order:
		raise OrderNotFound ()
		if order.status!= pending:
		raise InvalidOrderStatus ()
		if user.role!= manager:
		raise PermissionDenied ()

		order.status = approved
		order. approved_by = user.id
		self.db.commit ()
		self.db.refresh (order)

		self.notifications.order_approved(order.customer_email)
		self.audit.order_approved(order.id, user.id)
		return order

  seam:     fake-     -     [74] [80].

   :    legacy-  ,         [74] [75].

 3:   Depends

  FastAPI legacy- endpoint     ,      .   ,         [82] [76].







		@router.get (/ {order_id})
		async def get_order (
		order_id: int,
		session: Session = Depends (get_db),
		actor_service: ActorService = Depends (get_actor_service),
		event_service: EventService = Depends (get_event_service),
		item_service: ItemService = Depends (get_item_service),
		comment_service: CommentService = Depends (get_comment_service),
		):
		service = OrderService (
		session=session,
		actor_service=actor_service,
		event_service=event_service,
		item_service=item_service,
		comment_service=comment_service,
		)
		return service.get_order (order_id)




  


 FastAPI endpoint  legacy-.

  .

   OrderService  dependency provider,  endpoint      [82] [76] [77].







		def get_order_service (
		session: Session = Depends (get_db),
		actor_service: ActorService = Depends (get_actor_service),
		event_service: EventService = Depends (get_event_service),
		item_service: ItemService = Depends (get_item_service),
		comment_service: CommentService = Depends (get_comment_service),
		) -> OrderService:
		return OrderService (
		session=session,
		actor_service=actor_service,
		event_service=event_service,
		item_service=item_service,
		comment_service=comment_service,
		)

		@router.get (/ {order_id})
		async def get_order (
		order_id: int,
		service: OrderService = Depends (get_order_service),
		):
		return service.get_order (order_id)

    HTTP-   endpoint      [76] [77].

     ,     ,       [79] [75].

 4:   

 legacy FastAPI-  ,       unit-  .         API  service-,       [81] [83].




  


 characterization tests   FastAPI endpoint.

    ,     edge-cases.

  ,         TestClient    ,    [81] [83].

 ,   characterization tests    ,   -       [81] [75].




 


     FastAPI legacy:

   endpoint   HTTP-, -,      .        [75] [76].

  characterization tests   FastAPI route,       [81] [83].

  seam    API//,         [74] [80].

  -  fat endpoint  service-,     response shape [76] [77].

  dependency graph: endpoint     ,       [82] [76].

      FastAPI-  35  ,       [84] [75].

   

   :

   endpoint   service-.

      .

      .

      .

           [75] [83].

 ,          FastAPI legacy endpoint:  ?  ?  ? .



?



  FastAPI      lobeHub

:   LobeHub     FastAPI-   API ? Application/Use Cases ? Domain ? Infrastructure,  endpoint  , -   FastAPI,    ,    [89] [90] [91].

    LobeHub

  skill fastapi-clean-architecture  LobeHub      , dependency injection, repository pattern  ,  API-     , Domain     ,  Infrastructure       [89] [90].

     :      ,    use cases,   ,    [92] [93].




 legacy FastAPI


 legacy FastAPI-  : route     SQLAlchemy,   ,   -     .          FastAPI  ORM [94] [91].

  :

@router.post (/users/ {user_id} /deactivate)

def deactivate_user (

user_id: int,

db: Session = Depends (get_db),

current_user: User = Depends (get_current_user),

):

user = db.query(UserModel).filter(UserModel.id == user_id).first ()

if not user:

raise HTTPException (404, User not found)

if current_user.role!= admin:

raise HTTPException (403, Forbidden)

if user.status == inactive:

raise HTTPException (400, Already inactive)



user.status = inactive

db.commit ()

send_email (user. email, Your account was deactivated)

return {id: user.id, status: user.status}



  presentation, application logic, persistence  integration side effects,       [94] [91].




 


 clean architecture   LobeHub    :








 : -     FastAPI,      ,      application- [89] [91].




 


      ,        endpoint      [92] [97].

  :

    .

  -  use case.

      repository interface + implementation.

     .

  router    HTTP ? use case [98] [89] [91].

 

Domain

		from dataclasses import dataclass
		from typing import Protocol, Optional

		@dataclass
		class User:
		id: int
		email: str
		status: str

		class UserRepository (Protocol):
		def get_by_id (self, user_id: int) -> Optional [User]:
		def save (self, user: User) -> None:

		class NotificationPort (Protocol):
		def send_deactivated (self, email: str) -> None:

 domain    ,  FastAPI, SQLAlchemy   SDK [89] [90].

Application

		class UserNotFoundError (Exception): pass
		class ForbiddenError (Exception): pass
		class AlreadyInactiveError (Exception): pass

		class DeactivateUserUseCase:
		def __init__ (self, users: UserRepository, notifications: NotificationPort):
		self.users = users
		self.notifications = notifications

		def execute (self, actor_role: str, user_id: int) -> User:
		user = self.users.get_by_id (user_id)
		if not user:
		raise UserNotFoundError ()

		if actor_role!= admin:
		raise ForbiddenError ()




  .


   .

   ,     (https://www.litres.ru/pages/biblio_book/?art=74150962)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


