agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/architecture/monolith/SKILL.md

monolith

Skill15 starsChanged 43 days agoMITView on GitHub

Expert Monolithic architecture assistance covering single-deployment architectures, vertical slice organization, database migrations, and operational simplicity. Use when bootstrapping greenfield applications, optimizing delivery velocity for small teams, or scaling monolithic applications.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All features share a single repository, database connection, and deployment lifecycle:

    line 43
  2. Distinctive:

    Use Feature Flags for Continuous Deployment: Deploy code dark behind feature toggles to uncouple deployment from feature release.

    line 107
  3. Distinctive:

    Write blocking long-running background jobs in HTTP threads: Offload background jobs to BullMQ/Sidekiq queues.

    line 115

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Monolith (Traditional)

A Monolithic architecture is built as a single unit. All functional components (UI, Business Logic, Data Access) are tightly integrated using a shared database and running in the same process.

When to Use

  • Greenfield Startup Development: Prioritizing rapid product discovery, iteration speed, and developer onboarding above all else.
  • Small-to-Medium Engineering Teams: Teams of 1-30 developers where overhead from microservices infrastructure would divert from product building.
  • ACID Transaction Guarantees: Applications requiring absolute transactional consistency across financial or relational operations.
  • Low Operational Overhead: Deploying to single PaaS platforms (Render, Fly.io, Railway) or unified Kubernetes clusters with minimal DevOps complexity.

Quick Start

# Django/Rails/Laravel Style
# Everything in one place:
# - models/
# - views/
# - controllers/
# - utils/

def create_order(request):
    user = User.objects.get(id=request.user_id) # Direct DB access
    product = Product.objects.get(id=request.product_id) # Direct DB access

    order = Order.create(user=user, product=product)

    # Direct sync call within same transaction
    EmailService.send_confirmation(user)

    return Response("Order Created")

Core Concepts

Unified Codebase & Atomic Deployments

All features share a single repository, database connection, and deployment lifecycle:

[ Monolithic Application (Next.js / Rails / Django / Spring) ]
              │
              ▼
    ( Unified Database )

Vertical Slice Architecture

Organizes code by business feature rather than technical layer:

src/features/
  ├── authentication/
  │   ├── auth.controller.ts
  │   ├── auth.service.ts
  │   └── auth.schema.ts
  └── checkout/
      ├── checkout.controller.ts
      ├── checkout.service.ts
      └── checkout.schema.ts

In-Memory Transactions & Locks

Executes multi-table updates within native database transactions without distributed coordinator complexity:

await db.transaction(async (tx) => {
  const [order] = await tx.insert(orders).values(orderData).returning();
  await tx
    .update(inventory)
    .set({ stock: sql`stock - 1` })
    .where(eq(inventory.itemId, itemId));
  await tx.insert(payments).values({ orderId: order.id, amount: order.total });
});

Common Patterns

Vertical Slice Architecture in Monoliths

Problem: Layered architecture (Controllers, Services, Repositories) scatters single-feature code across dozens of folders.
Solution: Group by business capability (feature folder contains handler, model, schema, and UI).

src/features/
  ├── auth/
  │   ├── login.command.ts
  │   ├── login.validator.ts
  │   └── auth.router.ts
  └── invoicing/
      ├── create-invoice.command.ts
      ├── invoice.entity.ts
      └── invoice.router.ts

Best Practices

Do:

  • Structure Code by Features (Vertical Slices): Avoid flat technical folders (controllers/, models/) with hundreds of unrelated files.
  • Use Feature Flags for Continuous Deployment: Deploy code dark behind feature toggles to uncouple deployment from feature release.
  • Automate Comprehensive Test Suites: Invest heavily in automated integration tests to catch unintended regressions across features.
  • Scale Horizontally with Stateless Replicas: Run multiple identical stateless application instances behind an Nginx or ALB load balancer.

Don't:

  • Store session state in local server memory: Store sessions in Redis or encrypted cookies to allow painless multi-instance scaling.
  • Allow circular dependencies between feature directories: Keep dependency flow hierarchical and clean.
  • Write blocking long-running background jobs in HTTP threads: Offload background jobs to BullMQ/Sidekiq queues.

Troubleshooting

ErrorCauseSolution
Slow deployment pipelinesMonolithic test suites running sequentially on single runner.Parallelize test execution and modularize build caching across test suites.
Database connection exhaustionMultiple app instances exhausting max database connections.Place an enterprise connection pooler (e.g. PgBouncer/ProxySQL) in front of the DB.
Deployment regression blast radiusOne failing sub-feature crashes entire application deployment.Implement feature flags and canary deployment strategies to safely isolate new code.

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.