Logo Architecture Patterns

Architecture Patterns

Cộng đồng
jiaxiaojunQAQ
architecture-patterns

Organizational coding standards and architectural patterns. References comprehensive skills for detailed patterns. Use when making architecture decisions or implementing features.

Add to TypingMind

Tổng quan

Nhà phát hànhjiaxiaojunQAQ
Kho mãSkillJect
Tên kỹ năngarchitecture-patterns
Sao
79
Bản fork
8
Tệp đi kèm
7
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 7 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được jiaxiaojunQAQ công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Architecture Patterns trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/jiaxiaojunQAQ/SkillJect/tree/main/data/skills_sample/architecture-patterns-barnhardt-enterprises-inc
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jiaxiaojunQAQ/SkillJect.git /tmp/SkillJect
mkdir -p .claude/skills
cp -r /tmp/SkillJect/data/skills_sample/architecture-patterns-barnhardt-enterprises-inc .claude/skills/architecture-patterns
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Architecture Patterns trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Architecture Patterns ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Architecture Patterns với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Architecture Patterns (Pattern Index)

When to Use

  • Making architecture decisions
  • Implementing new features
  • Reviewing code for pattern compliance
  • Choosing between multiple approaches
  • Learning established patterns

Overview

This skill is a pattern index that references comprehensive skills for details. Use this to understand which pattern to use, then reference the specific skill for implementation details.

Pattern Categories

1. Next.js Patterns

→ See: nextjs-15-specialist skill

Quick Reference:

  • Server Components (default): Data fetching, database access, backend APIs
  • Client Components ('use client'): Interactivity, hooks, browser APIs
  • Server Actions ('use server'): Form submissions, mutations
  • Route Handlers (app/api/): REST API endpoints
  • Streaming: Suspense boundaries for progressive loading

Decision Tree:

Need interactivity (onClick, onChange)?
├─ YES → Client Component
└─ NO → Server Component

Need React hooks (useState, useEffect)?
├─ YES → Client Component
└─ NO → Server Component

Need to fetch data?
└─ Prefer Server Component (better performance)

Details: nextjs-patterns.md


2. TypeScript Conventions

→ See: typescript-strict-guard skill

Quick Reference:

  • No any - Use explicit types or unknown with type guards
  • No @ts-ignore - Fix underlying type error
  • No ! assertions - Use optional chaining or type guards
  • Explicit types - All function parameters and return types
  • Type guards - Runtime validation for unknown types

Decision Tree:

Type is unknown at compile time?
├─ Use `unknown` with type guard
└─ Define explicit interface/type

Need optional property?
├─ Use `type?.property`
└─ Or `type ?? defaultValue`

Need to narrow union type?
└─ Use discriminated union or type guard

Details: typescript-conventions.md


3. Database Patterns

→ See: drizzle-orm-patterns skill

Quick Reference:

  • Drizzle ORM (not Prisma) - Edge runtime compatible
  • Parameterized queries - SQL injection prevention
  • Transactions - Atomic operations for multi-step changes
  • Relations - Join queries with .with() syntax
  • Migrations - Version-controlled schema changes

Decision Tree:

Need to query database?
├─ Simple query → db.select().from(table)
├─ Relations → .with() syntax
└─ Complex → Use joins explicitly

Need to modify data?
├─ Single record → db.insert/update/delete
└─ Multiple operations → Use transaction

Details: database-patterns.md


4. State Management Patterns

Quick Reference:

  • Server state → React Query (useQuery, useMutation)
  • Local UI state → useState
  • Shared UI state → Context API
  • URL state → Next.js useSearchParams
  • Form state → React Hook Form + Zod

Decision Tree:

What kind of state?
├─ Server data (API, database) → React Query
├─ Local UI (toggle, input) → useState
├─ Shared across components → Context
├─ URL parameters → useSearchParams
└─ Form data → React Hook Form

Details: state-management-patterns.md


5. API Patterns

→ See: zod-validation-patterns skill

Quick Reference:

  • Input validation → Zod schemas (MANDATORY)
  • Error handling → try/catch with informative messages
  • Response format → Consistent JSON structure
  • Status codes → Proper HTTP semantics
  • Authentication → Check before processing
  • Authorization → Verify resource ownership

Decision Tree:

Implementing API route?
1. Define Zod schema for input validation
2. Check authentication (if protected)
3. Validate input with schema.parse()
4. Check authorization (resource ownership)
5. Execute business logic
6. Return appropriate status code

Details: api-patterns.md


6. React 19 Patterns

→ See: react-19-patterns skill

Quick Reference:

  • use() hook - Read resources (Promises, Context) in components
  • useOptimistic - Optimistic UI updates
  • useFormStatus - Form submission state
  • useActionState - Server action state management
  • Actions - Server/client actions for mutations

Details: react-19-patterns.md


Pattern Selection Guide

Data Fetching

Scenario: Need to display data from database

Options:

  1. Server Component (PREFERRED)

    • ✅ Best performance
    • ✅ No client bundle
    • ✅ Direct database access
    • ❌ No interactivity
  2. React Query in Client Component

    • ✅ Caching, refetching, optimistic updates
    • ✅ Client-side interactivity
    • ❌ Larger bundle
    • ❌ Requires API route
  3. Server-Sent Events (SSE)

    • ✅ Real-time updates
    • ✅ Automatic reconnection
    • ❌ More complex setup
    • ❌ Requires SSE endpoint

Decision:

Is data static or rarely changes?
└─ Use Server Component

Need real-time updates?
└─ Use SSE pattern

Need client-side caching/refetching?
└─ Use React Query

Form Handling

Scenario: Need to handle form submission

Options:

  1. Server Actions (PREFERRED)

    • ✅ Progressive enhancement
    • ✅ Works without JavaScript
    • ✅ Simple implementation
    • ❌ Limited client-side control
  2. Client Component + API Route

    • ✅ Full client-side control
    • ✅ Complex validation
    • ✅ Multi-step forms
    • ❌ More code

Decision:

Simple form (create, update)?
└─ Use Server Action

Complex validation or multi-step?
└─ Use Client Component + API Route

Need optimistic UI updates?
└─ Use Client Component with useOptimistic

Authentication

Scenario: Need to protect routes/resources

Pattern:

typescript
// 1. Check authentication
const user = await getAuthUser(request)
if (!user) {
  return new Response('Unauthorized', { status: 401 })
}

// 2. Check authorization (resource ownership)
const resource = await db.resource.findUnique({ where: { id } })
if (!resource) {
  return new Response('Not found', { status: 404 })
}
if (resource.userId !== user.id) {
  return new Response('Forbidden', { status: 403 })
}

// 3. Proceed with operation

See: ../security-sentinel/SKILL.md


Progressive Disclosure

This skill uses progressive disclosure:

  1. SKILL.md (this file) - Pattern index and decision trees
  2. Pattern files - Reference comprehensive skills
  3. Comprehensive skills - Full implementation details

Example workflow:

  1. Read SKILL.md to understand pattern categories
  2. Use decision tree to select pattern
  3. Reference specific pattern file for overview
  4. Deep dive into comprehensive skill for details

Integration with Other Skills

Architecture patterns aggregate knowledge from:

  • nextjs-15-specialist - Next.js 15 complete patterns
  • typescript-strict-guard - TypeScript strict mode
  • drizzle-orm-patterns - Database operations
  • react-19-patterns - React 19 features
  • zod-validation-patterns - Input validation
  • security-sentinel - Security best practices

Common Patterns Quick Reference

Create a new page with data

typescript
// app/projects/page.tsx (Server Component)
export default async function ProjectsPage() {
  const projects = await db.select().from(projectsTable)
  return <ProjectList projects={projects} />
}

Create an API endpoint

typescript
// app/api/projects/route.ts
import { z } from 'zod'

const createSchema = z.object({
  name: z.string().min(1).max(100),
})

export async function POST(request: Request) {
  // 1. Validate input
  const body = await request.json()
  const validated = createSchema.parse(body)

  // 2. Check auth
  const user = await getAuthUser(request)
  if (!user) return new Response('Unauthorized', { status: 401 })

  // 3. Execute
  const project = await db.insert(projectsTable).values({
    ...validated,
    userId: user.id,
  })

  return Response.json(project, { status: 201 })
}

Add interactivity to a component

typescript
// components/ProjectCard.tsx (Client Component)
'use client'

import { useState } from 'react'

export function ProjectCard({ project }: Props) {
  const [loading, setLoading] = useState(false)

  const handleDelete = async () => {
    setLoading(true)
    await deleteProject(project.id)
    setLoading(false)
  }

  return (
    <div>
      <h2>{project.name}</h2>
      <button onClick={handleDelete} disabled={loading}>
        Delete
      </button>
    </div>
  )
}

See Also

  • nextjs-patterns.md - Next.js pattern details
  • typescript-conventions.md - TypeScript standards
  • database-patterns.md - Database operation patterns
  • state-management-patterns.md - State management guide
  • api-patterns.md - API design patterns
  • react-19-patterns.md - React 19 features

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Architecture Patterns làm được gì?

Organizational coding standards and architectural patterns. References comprehensive skills for detailed patterns. Use when making architecture decisions or implementing features.

Vì sao nên dùng Architecture Patterns trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Architecture Patterns là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Architecture Patterns trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/jiaxiaojunQAQ/SkillJect/tree/main/data/skills_sample/architecture-patterns-barnhardt-enterprises-inc. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Architecture Patterns?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Architecture Patterns với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Architecture Patterns với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Architecture Patterns có miễn phí không?

Kỹ năng này được jiaxiaojunQAQ phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇