@kienha/anti-chaotic 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/rules/documentation.md +1 -1
- package/.agent/skills/backend-developer/SKILL.md +4 -14
- package/.agent/skills/business-analysis/SKILL.md +2 -4
- package/.agent/skills/designer/SKILL.md +36 -58
- package/.agent/skills/devops-engineer/SKILL.md +0 -9
- package/.agent/skills/frontend-developer/SKILL.md +17 -3
- package/.agent/skills/frontend-developer/react/SKILL.md +16 -12
- package/.agent/skills/lead-architect/SKILL.md +2 -2
- package/.agent/skills/rules-workflows/SKILL.md +62 -19
- package/.agent/skills/rules-workflows/assets/workflow-basic.md +112 -0
- package/.agent/skills/rules-workflows/references/orchestration-patterns.md +15 -3
- package/.agent/skills/rules-workflows/references/rules-guide.md +6 -47
- package/.agent/skills/rules-workflows/references/workflows-guide.md +12 -20
- package/.agent/skills/skill-creator/SKILL.md +18 -20
- package/.agent/skills/skill-creator/assets/skill-questionnaire.md +8 -0
- package/.agent/workflows/docs-from-codebase.md +104 -0
- package/.agent/workflows/implement-feature.md +148 -0
- package/.agent/workflows/requirement-analysis.md +113 -249
- package/.agent/workflows/setup-codebase.md +51 -58
- package/.agent/workflows/ui-ux-design.md +72 -51
- package/README.md +23 -343
- package/bin/{ag.js → anti-chaotic.js} +17 -0
- package/package.json +5 -4
- package/.agent/skills/frontend-developer/references/react-next.md +0 -67
- package/.agent/skills/frontend-developer/references/react.md +0 -91
- package/.agent/skills/rules-workflows/assets/example-workflow.md +0 -37
- package/.agent/skills/rules-workflows/assets/templates/rule-project-context.md +0 -26
- package/.agent/skills/rules-workflows/assets/templates/workflow-agile-feature.md +0 -62
- package/.agent/workflows/generate-docs-from-codebase.md +0 -335
- package/.agent/workflows/workflow-rule-from-codebase.md +0 -43
- package/.agent/workflows/workflow-rule-from-feedback.md +0 -38
- /package/.agent/skills/rules-workflows/assets/{example-rule-always-on.md → rule-always-on.md} +0 -0
- /package/.agent/skills/rules-workflows/assets/{example-rule-glob.md → rule-glob.md} +0 -0
- /package/.agent/skills/rules-workflows/assets/{example-rule-manual.md → rule-manual.md} +0 -0
- /package/.agent/skills/rules-workflows/assets/{example-rule-model-decision.md → rule-model-decision.md} +0 -0
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# React & Next.js Architecture
|
|
2
|
-
|
|
3
|
-
**Status**: Definitive Guide
|
|
4
|
-
**Stack**: React 18+, Next.js App Router (14+)
|
|
5
|
-
|
|
6
|
-
## 🏗 Architecture: "Server-Centric" Design
|
|
7
|
-
|
|
8
|
-
### 1. The Separation: Server vs. Client
|
|
9
|
-
|
|
10
|
-
- **Default to Server Components (RSC)**: All components are Server by default.
|
|
11
|
-
- **Client Components**: Only use `'use client'` when you need:
|
|
12
|
-
- Event listeners (`onClick`, `onChange`)
|
|
13
|
-
- Hooks (`useState`, `useEffect`)
|
|
14
|
-
- Browser-only APIs
|
|
15
|
-
|
|
16
|
-
### 2. File Structure (Feature-Sliced)
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
app/
|
|
20
|
-
├── layout.tsx # Root layout
|
|
21
|
-
├── page.tsx # Home
|
|
22
|
-
├── (auth)/ # Route Group (doesn't affect URL)
|
|
23
|
-
│ ├── login/
|
|
24
|
-
│ │ └── page.tsx
|
|
25
|
-
├── _components/ # Shared UI
|
|
26
|
-
└── features/ # Feature Modules
|
|
27
|
-
├── cart/
|
|
28
|
-
│ ├── components/
|
|
29
|
-
│ ├── hooks/
|
|
30
|
-
│ └── actions.ts # Server Actions
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## ⚡ Performance Patterns
|
|
34
|
-
|
|
35
|
-
### 1. Data Fetching
|
|
36
|
-
|
|
37
|
-
- **No `useEffect`**: Fetch data directly in Server Components using `async/await`.
|
|
38
|
-
- **Deduplication**: `fetch` is auto-memoized.
|
|
39
|
-
- **Waterfalls**: Use `Promise.all` for parallel fetching, or use `<Suspense>` for streaming.
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
// ✅ GOOD: Streaming
|
|
43
|
-
export default async function Page() {
|
|
44
|
-
return (
|
|
45
|
-
<Suspense fallback={<Skeleton />}>
|
|
46
|
-
<UserFeed /> {/* Fetches its own data */}
|
|
47
|
-
</Suspense>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 2. Server Actions instead of API Routes
|
|
53
|
-
|
|
54
|
-
- Colocate mutations with the feature code.
|
|
55
|
-
- Use `useFormStatus` for pending states.
|
|
56
|
-
- Use `useOptimistic` for instant UI updates.
|
|
57
|
-
|
|
58
|
-
### 3. Image Optimization
|
|
59
|
-
|
|
60
|
-
- Required usage of `next/image`.
|
|
61
|
-
- **sizes**: mandatory prop for responsive images. `sizes="(max-width: 768px) 100vw, 50vw"`.
|
|
62
|
-
|
|
63
|
-
## 🧪 Testing
|
|
64
|
-
|
|
65
|
-
- **Unit**: Vitest/Jest for logic.
|
|
66
|
-
- **Integration**: React Testing Library for Client Components.
|
|
67
|
-
- **E2E**: Playwright for full flows.
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Tech Stack: React & Next.js (Expert Guide)
|
|
2
|
-
|
|
3
|
-
> **RESEARCH FIRST**: Before implementing, use `mcp_context7_query-docs` or `web_search` to verify you are using the latest version of Next.js features and React hooks patterns.
|
|
4
|
-
|
|
5
|
-
You are an expert in React's internal mechanisms (Fiber, Reconciliation). You don't just "use hooks"; you understand _closure traps_ and _dependency arrays_.
|
|
6
|
-
|
|
7
|
-
## 🌟 Core Philosophy
|
|
8
|
-
|
|
9
|
-
- **UI = f(state)**: The UI is a pure projection of the application state.
|
|
10
|
-
- **Unidirectional Data Flow**: Props go down, events go up.
|
|
11
|
-
- **Escape Hatches are Dangerous**: Refs and `useEffect` are escape hatches. Use them only when you cannot derive behavior from rendering.
|
|
12
|
-
|
|
13
|
-
## 🏗 Advanced Patterns
|
|
14
|
-
|
|
15
|
-
### 1. Compound Components
|
|
16
|
-
|
|
17
|
-
Avoid prop drilling and giant configuration objects.
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
// Bad: <Select options={[{...}]} onChange={...} />
|
|
21
|
-
|
|
22
|
-
// Good:
|
|
23
|
-
<Select onValueChange={setValue}>
|
|
24
|
-
<SelectTrigger>{value}</SelectTrigger>
|
|
25
|
-
<SelectContent>
|
|
26
|
-
<SelectItem value="apple">Apple</SelectItem>
|
|
27
|
-
<SelectItem value="banana">Banana</SelectItem>
|
|
28
|
-
</SelectContent>
|
|
29
|
-
</Select>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### 2. Custom Hooks as Logic Layer
|
|
33
|
-
|
|
34
|
-
Extract _all_ logic into custom hooks. Keep components focused on _rendering_.
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
// Component
|
|
38
|
-
function UserProfile() {
|
|
39
|
-
const { user, loading, error } = useUserProfile(id);
|
|
40
|
-
// ... render ...
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Hook
|
|
44
|
-
function useUserProfile(id: string) {
|
|
45
|
-
// ... query, transformation, side effects ...
|
|
46
|
-
return { user, loading, error };
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 3. Server Components (RSC) vs Client Components
|
|
51
|
-
|
|
52
|
-
- **Default to Server Components**: Fetch data, access DB, keep secrets.
|
|
53
|
-
- **"Client Boundary" at the Leaves**: Add `'use client'` only when you need interactivity (onClick, useState, useEffect).
|
|
54
|
-
- **Pattern**: Pass Server Component data as _props_ to Client Components.
|
|
55
|
-
|
|
56
|
-
## 📦 State Management Strategy
|
|
57
|
-
|
|
58
|
-
1. **Server State**: **React Query (TanStack Query)** or **SWR**.
|
|
59
|
-
- _Never_ put API data in `useState` unless you are transforming it heavily for UI state.
|
|
60
|
-
- Use `staleTime` and `gcTime` aggressively.
|
|
61
|
-
2. **Global UI State**: **Zustand** (preferred) or Context API.
|
|
62
|
-
- Context is for _Dependency Injection_ (Themes, Auth, Toast).
|
|
63
|
-
- Zustand is for _Data Stores_ (Cart, Multi-step Form Data).
|
|
64
|
-
3. **Local State**: `useState` / `useReducer`.
|
|
65
|
-
4. **Form State**: **React Hook Form**.
|
|
66
|
-
- Uncontrolled components for performance (no re-render on every keystroke).
|
|
67
|
-
- **Zod** for schema validation.
|
|
68
|
-
|
|
69
|
-
## 🚀 Performance Optimization
|
|
70
|
-
|
|
71
|
-
1. **Referential Stability**:
|
|
72
|
-
- Objects/Arrays declared in render body = new reference every render.
|
|
73
|
-
- `useMemo` for derived objects/arrays passed as props.
|
|
74
|
-
- `useCallback` for functions passed as props to memoized children.
|
|
75
|
-
2. **Virtualization**:
|
|
76
|
-
- Rendering lists > 50 items? Use `react-window` or `tanstack-virtual`.
|
|
77
|
-
3. **Code Splitting**:
|
|
78
|
-
- `lazy()` and `<Suspense>` for heavy route components or heavy libraries (charts, maps).
|
|
79
|
-
|
|
80
|
-
## 🛡 Anti-Patterns to Avoid
|
|
81
|
-
|
|
82
|
-
1. **Prop Drilling**: Passing props through 5 layers. -> Use Composition or Context.
|
|
83
|
-
2. **Effect Chaining**: `useEffect` triggering state change, triggering another `useEffect`. -> Combine logic or derive state.
|
|
84
|
-
3. **Stale Closures**: Forgetting dependencies in `useEffect` or `useCallback`.
|
|
85
|
-
4. **"God Components"**: Components with > 200 lines or > 5 hook calls.
|
|
86
|
-
|
|
87
|
-
## 🧪 Testing (React Testing Library)
|
|
88
|
-
|
|
89
|
-
- **Priority**: `screen.findByRole('button', { name: /save/i })`
|
|
90
|
-
- **User Event**: Use `userEvent.type()` instead of `fireEvent.change()`.
|
|
91
|
-
- **Wrappers**: Create a custom `render` function that wraps components in all Providers (Auth, QueryClient, Theme).
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Standard workflow for deploying to staging environment
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Deploy to Staging
|
|
6
|
-
|
|
7
|
-
This workflow guides through deploying the application to staging.
|
|
8
|
-
|
|
9
|
-
## Step 1: Run Tests
|
|
10
|
-
|
|
11
|
-
Ensure all tests pass before deployment:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm run test
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Step 2: Build Application
|
|
18
|
-
|
|
19
|
-
Build the production bundle:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm run build
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Step 3: Deploy to Staging
|
|
26
|
-
|
|
27
|
-
Deploy the built application:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm run deploy:staging
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Step 4: Verify Deployment
|
|
34
|
-
|
|
35
|
-
- Check the staging URL is accessible
|
|
36
|
-
- Verify key functionality works
|
|
37
|
-
- Review logs for any errors
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
trigger: always_on
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Project Context & Insights
|
|
6
|
-
|
|
7
|
-
## Domain Overview
|
|
8
|
-
|
|
9
|
-
[Describe the business domain, e.g., "E-commerce platform for vintage watches"]
|
|
10
|
-
|
|
11
|
-
## Key Architecture Decisions
|
|
12
|
-
|
|
13
|
-
- **Frontend**: [e.g., Next.js 14, Tailwind, Shadcn]
|
|
14
|
-
- **Backend**: [e.g., Supabase, Edge Functions]
|
|
15
|
-
- **State Management**: [e.g., Zustand]
|
|
16
|
-
|
|
17
|
-
## Coding Standards (Strict)
|
|
18
|
-
|
|
19
|
-
- [Rule 1: e.g., "All components must be functional"]
|
|
20
|
-
- [Rule 2: e.g., "Use Zod for all validations"]
|
|
21
|
-
- [Rule 3: e.g., "No console.log in production"]
|
|
22
|
-
|
|
23
|
-
## Workflow Preferences
|
|
24
|
-
|
|
25
|
-
- **Testing**: [e.g., "Write tests before code"]
|
|
26
|
-
- **Commits**: [e.g., "Conventional Commits format"]
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: End-to-end Agile feature implementation workflow
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Agile Feature Implementation
|
|
6
|
-
|
|
7
|
-
## Step 1: Requirements Analysis
|
|
8
|
-
|
|
9
|
-
**Role: Product Manager**
|
|
10
|
-
|
|
11
|
-
Analyze the user's request.
|
|
12
|
-
|
|
13
|
-
1. Identify the core problem and user goal.
|
|
14
|
-
2. Define success criteria.
|
|
15
|
-
3. List key constraints (tech stack, performance, etc.).
|
|
16
|
-
4. Generate a list of user stories or acceptance criteria.
|
|
17
|
-
|
|
18
|
-
If requirements are vague, STOP and ask the user for clarification.
|
|
19
|
-
|
|
20
|
-
## Step 2: Technical Specification
|
|
21
|
-
|
|
22
|
-
**Role: Lead Architect**
|
|
23
|
-
|
|
24
|
-
Create a technical design for the feature.
|
|
25
|
-
|
|
26
|
-
1. Propose the architecture changes.
|
|
27
|
-
2. Identify necessary file changes (New/Modified/Deleted).
|
|
28
|
-
3. Define API contracts or data models.
|
|
29
|
-
4. Assess security and performance implications.
|
|
30
|
-
|
|
31
|
-
## Step 3: Implementation Strategy
|
|
32
|
-
|
|
33
|
-
**Role: Sequential Thinking**
|
|
34
|
-
|
|
35
|
-
Plan the coding steps.
|
|
36
|
-
|
|
37
|
-
1. Break down the implementation into small, testable chunks.
|
|
38
|
-
2. Identify dependencies between steps.
|
|
39
|
-
3. Plan for edge cases and error handling.
|
|
40
|
-
4. **Output**: A step-by-step implementation plan in `task.md`.
|
|
41
|
-
|
|
42
|
-
## Step 4: Coding & TDD
|
|
43
|
-
|
|
44
|
-
**Role: Developer (Backend/Frontend)**
|
|
45
|
-
|
|
46
|
-
Execute the plan.
|
|
47
|
-
|
|
48
|
-
1. Create/Update tests first (if TDD is followed).
|
|
49
|
-
2. Implement the code for one chunk.
|
|
50
|
-
3. Run tests to verify.
|
|
51
|
-
4. Repeat until feature is complete.
|
|
52
|
-
|
|
53
|
-
## Step 5: Verification & QA
|
|
54
|
-
|
|
55
|
-
**Role: QA Tester**
|
|
56
|
-
|
|
57
|
-
Verify the implementation.
|
|
58
|
-
|
|
59
|
-
1. Run the full test suite.
|
|
60
|
-
2. Perform manual verification steps (if strictly necessary).
|
|
61
|
-
3. Check against the original acceptance criteria.
|
|
62
|
-
4. Generate a final `walkthrough.md` report.
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Generate comprehensive documentation from existing codebase (Architecture, API, Specs).
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Workflow: Generate Documentation from Codebase
|
|
6
|
-
|
|
7
|
-
Use this workflow to automatically generate structured documentation from an existing codebase. This workflow follows the project's **documentation rule** (`documentation.md`) to ensure proper folder structure and knowledge graph linking.
|
|
8
|
-
|
|
9
|
-
## Prerequisites
|
|
10
|
-
|
|
11
|
-
- The `docs/` folder structure should exist (or will be created based on `documentation.md` rule).
|
|
12
|
-
- Agent should understand the project's tech stack.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Step 1: Codebase Discovery & Analysis
|
|
17
|
-
|
|
18
|
-
**Goal**: Understand the project structure, tech stack, and architecture.
|
|
19
|
-
|
|
20
|
-
// turbo
|
|
21
|
-
|
|
22
|
-
1. **Read Configuration Files**:
|
|
23
|
-
- `package.json` / `pyproject.toml` / `go.mod` (dependencies & scripts)
|
|
24
|
-
- `tsconfig.json` / `drizzle.config.ts` / `vite.config.ts` (build config)
|
|
25
|
-
- `.env.example` (environment variables)
|
|
26
|
-
|
|
27
|
-
2. **Analyze Folder Structure**:
|
|
28
|
-
- Run `list_dir` on root, `app/` or `src/`, `db/` or `schema/`
|
|
29
|
-
- Identify patterns: routes, components, services, models
|
|
30
|
-
|
|
31
|
-
3. **Identify Key Components**:
|
|
32
|
-
- Entry points (`main.ts`, `index.ts`, `app/root.tsx`)
|
|
33
|
-
- API routes (`app/routes/api/`, `app/api/`)
|
|
34
|
-
- Database schemas (`app/db/schema/`, `prisma/schema.prisma`)
|
|
35
|
-
- Shared utilities and types
|
|
36
|
-
|
|
37
|
-
**Output**: Mental map of the codebase structure.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Step 2: Determine Documentation Scope
|
|
42
|
-
|
|
43
|
-
**Goal**: Decide which documentation types to generate based on analysis.
|
|
44
|
-
|
|
45
|
-
// turbo
|
|
46
|
-
|
|
47
|
-
Ask the user which documentation to generate (or generate all by default):
|
|
48
|
-
|
|
49
|
-
| Doc Type | Target Folder | Description |
|
|
50
|
-
| ----------------------- | ------------------------------ | ---------------------------------------- |
|
|
51
|
-
| **System Architecture** | `docs/030-Specs/Architecture/` | C4 diagrams, component relationships |
|
|
52
|
-
| **API Documentation** | `docs/030-Specs/API/` | Endpoint specs, request/response schemas |
|
|
53
|
-
| **Database Schema** | `docs/030-Specs/Schema/` | Entity descriptions, relationships |
|
|
54
|
-
| **Component Reference** | `docs/030-Specs/Components/` | Frontend component documentation |
|
|
55
|
-
| **Technical Overview** | `docs/030-Specs/` | High-level technical summary |
|
|
56
|
-
|
|
57
|
-
**Output**: List of documentation targets to generate.
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Step 3: Generate System Architecture Documentation
|
|
62
|
-
|
|
63
|
-
**Role**: Lead Architect (use `lead-architect` skill if complex)
|
|
64
|
-
|
|
65
|
-
// turbo
|
|
66
|
-
|
|
67
|
-
1. **Create Architecture Overview**:
|
|
68
|
-
- File: `docs/030-Specs/Architecture/System-Context.md`
|
|
69
|
-
- Include: Technology stack, deployment targets, external integrations
|
|
70
|
-
- Generate: C4 Context Diagram (Mermaid)
|
|
71
|
-
|
|
72
|
-
2. **Create Component Diagram**:
|
|
73
|
-
- File: `docs/030-Specs/Architecture/Component-View.md`
|
|
74
|
-
- Include: Major components and their interactions
|
|
75
|
-
- Generate: C4 Component Diagram (Mermaid)
|
|
76
|
-
|
|
77
|
-
3. **Document Data Flow**:
|
|
78
|
-
- File: `docs/030-Specs/Architecture/Data-Flow.md`
|
|
79
|
-
- Include: Request lifecycle, data transformation points
|
|
80
|
-
|
|
81
|
-
**Template**:
|
|
82
|
-
|
|
83
|
-
```markdown
|
|
84
|
-
---
|
|
85
|
-
id: ARCH-001
|
|
86
|
-
type: architecture
|
|
87
|
-
status: generated
|
|
88
|
-
created: { DATE }
|
|
89
|
-
tags: [architecture, c4, system-design]
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
# System Architecture Overview
|
|
93
|
-
|
|
94
|
-
## Context Diagram
|
|
95
|
-
|
|
96
|
-
\`\`\`mermaid
|
|
97
|
-
C4Context
|
|
98
|
-
title System Context Diagram
|
|
99
|
-
Person(user, "User", "End user of the system")
|
|
100
|
-
System(app, "Application", "The main application")
|
|
101
|
-
System_Ext(db, "Database", "Data persistence")
|
|
102
|
-
\`\`\`
|
|
103
|
-
|
|
104
|
-
## Technology Stack
|
|
105
|
-
|
|
106
|
-
- **Frontend**: {framework}
|
|
107
|
-
- **Backend**: {runtime}
|
|
108
|
-
- **Database**: {database}
|
|
109
|
-
- **Hosting**: {platform}
|
|
110
|
-
|
|
111
|
-
## Key Architectural Decisions
|
|
112
|
-
|
|
113
|
-
1. ...
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## Step 4: Generate API Documentation
|
|
119
|
-
|
|
120
|
-
**Goal**: Document all API endpoints with request/response schemas.
|
|
121
|
-
|
|
122
|
-
// turbo
|
|
123
|
-
|
|
124
|
-
1. **Scan API Routes**:
|
|
125
|
-
- Find all route handlers in `app/routes/api/` or equivalent
|
|
126
|
-
- Extract: method, path, parameters, response types
|
|
127
|
-
|
|
128
|
-
2. **Generate Endpoint Docs**:
|
|
129
|
-
- Create one file per major API resource
|
|
130
|
-
- Location: `docs/030-Specs/API/`
|
|
131
|
-
- Naming: `Endpoint-{Resource}-{Action}.md`
|
|
132
|
-
|
|
133
|
-
3. **Create API Index**:
|
|
134
|
-
- File: `docs/030-Specs/API/API-Standards.md`
|
|
135
|
-
- Include: Base URL, authentication, common patterns
|
|
136
|
-
|
|
137
|
-
**Template**:
|
|
138
|
-
|
|
139
|
-
```markdown
|
|
140
|
-
---
|
|
141
|
-
id: API-{NUMBER}
|
|
142
|
-
type: api-spec
|
|
143
|
-
status: generated
|
|
144
|
-
created: { DATE }
|
|
145
|
-
tags: [api, { resource }]
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
# API: {Resource Name}
|
|
149
|
-
|
|
150
|
-
## Endpoints
|
|
151
|
-
|
|
152
|
-
### `{METHOD} {PATH}`
|
|
153
|
-
|
|
154
|
-
**Description**: {what this endpoint does}
|
|
155
|
-
|
|
156
|
-
**Authentication**: Required / Public
|
|
157
|
-
|
|
158
|
-
**Request**:
|
|
159
|
-
\`\`\`typescript
|
|
160
|
-
// Request body type
|
|
161
|
-
interface Request {
|
|
162
|
-
field: type;
|
|
163
|
-
}
|
|
164
|
-
\`\`\`
|
|
165
|
-
|
|
166
|
-
**Response**:
|
|
167
|
-
\`\`\`typescript
|
|
168
|
-
// Response type
|
|
169
|
-
interface Response {
|
|
170
|
-
data: type;
|
|
171
|
-
}
|
|
172
|
-
\`\`\`
|
|
173
|
-
|
|
174
|
-
**Example**:
|
|
175
|
-
\`\`\`bash
|
|
176
|
-
curl -X {METHOD} {BASE_URL}{PATH} \
|
|
177
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
178
|
-
-d '{"field": "value"}'
|
|
179
|
-
\`\`\`
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Step 5: Generate Database Schema Documentation
|
|
185
|
-
|
|
186
|
-
**Goal**: Document database entities and relationships.
|
|
187
|
-
|
|
188
|
-
// turbo
|
|
189
|
-
|
|
190
|
-
1. **Scan Schema Definitions**:
|
|
191
|
-
- Drizzle: `app/db/schema/*.ts`
|
|
192
|
-
- Prisma: `prisma/schema.prisma`
|
|
193
|
-
- Raw SQL: `migrations/`
|
|
194
|
-
|
|
195
|
-
2. **Generate Entity Docs**:
|
|
196
|
-
- Location: `docs/030-Specs/Schema/`
|
|
197
|
-
- Naming: `DB-Entity-{TableName}.md`
|
|
198
|
-
|
|
199
|
-
3. **Create ERD**:
|
|
200
|
-
- File: `docs/030-Specs/Schema/ERD.md`
|
|
201
|
-
- Generate: Mermaid ER Diagram
|
|
202
|
-
|
|
203
|
-
**Template**:
|
|
204
|
-
|
|
205
|
-
```markdown
|
|
206
|
-
---
|
|
207
|
-
id: DB-{NUMBER}
|
|
208
|
-
type: schema
|
|
209
|
-
status: generated
|
|
210
|
-
created: { DATE }
|
|
211
|
-
tags: [database, { table_name }]
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
# Entity: {TableName}
|
|
215
|
-
|
|
216
|
-
## Description
|
|
217
|
-
|
|
218
|
-
{Purpose of this table}
|
|
219
|
-
|
|
220
|
-
## Schema
|
|
221
|
-
|
|
222
|
-
| Column | Type | Nullable | Default | Description |
|
|
223
|
-
| ------ | ---- | -------- | ----------------- | ----------- |
|
|
224
|
-
| id | uuid | No | gen_random_uuid() | Primary key |
|
|
225
|
-
| ... | ... | ... | ... | ... |
|
|
226
|
-
|
|
227
|
-
## Relationships
|
|
228
|
-
|
|
229
|
-
- **belongs_to**: [[DB-Entity-{Parent}]]
|
|
230
|
-
- **has_many**: [[DB-Entity-{Child}]]
|
|
231
|
-
|
|
232
|
-
## Indexes
|
|
233
|
-
|
|
234
|
-
- `idx_{table}_{column}` - {purpose}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## Step 6: Generate MOC (Map of Content) Files
|
|
240
|
-
|
|
241
|
-
**Goal**: Create index files for navigation.
|
|
242
|
-
|
|
243
|
-
// turbo
|
|
244
|
-
|
|
245
|
-
1. **Create Specs MOC**:
|
|
246
|
-
- File: `docs/030-Specs/Specs-MOC.md`
|
|
247
|
-
- Link to all generated specs
|
|
248
|
-
|
|
249
|
-
2. **Update Main Index**:
|
|
250
|
-
- File: `docs/000-Index.md`
|
|
251
|
-
- Add links to new documentation
|
|
252
|
-
|
|
253
|
-
**Template**:
|
|
254
|
-
|
|
255
|
-
```markdown
|
|
256
|
-
---
|
|
257
|
-
id: MOC-030
|
|
258
|
-
type: moc
|
|
259
|
-
status: active
|
|
260
|
-
created: { DATE }
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
# Specifications (Map of Content)
|
|
264
|
-
|
|
265
|
-
## Architecture
|
|
266
|
-
|
|
267
|
-
- [[System-Context]] - High-level system overview
|
|
268
|
-
- [[Component-View]] - Internal component structure
|
|
269
|
-
- [[Data-Flow]] - Request/response lifecycle
|
|
270
|
-
|
|
271
|
-
## API
|
|
272
|
-
|
|
273
|
-
- [[API-Standards]] - API conventions and authentication
|
|
274
|
-
- [[Endpoint-Users]] - User management endpoints
|
|
275
|
-
- ...
|
|
276
|
-
|
|
277
|
-
## Database Schema
|
|
278
|
-
|
|
279
|
-
- [[ERD]] - Entity relationship diagram
|
|
280
|
-
- [[DB-Entity-User]] - User table schema
|
|
281
|
-
- ...
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## Step 7: Validation & Linking
|
|
287
|
-
|
|
288
|
-
**Goal**: Ensure generated documentation is complete and properly linked.
|
|
289
|
-
|
|
290
|
-
// turbo
|
|
291
|
-
|
|
292
|
-
1. **Check Frontmatter**: All files must have YAML frontmatter with required fields.
|
|
293
|
-
2. **Verify Links**: All `[[Wiki-links]]` should point to existing files.
|
|
294
|
-
3. **Cross-Reference**: Technical specs should link to related requirements if they exist.
|
|
295
|
-
|
|
296
|
-
**Validation Checklist**:
|
|
297
|
-
|
|
298
|
-
- [ ] All docs have `id`, `type`, `status`, `created` in frontmatter
|
|
299
|
-
- [ ] MOC files link to all related documents
|
|
300
|
-
- [ ] Mermaid diagrams render correctly
|
|
301
|
-
- [ ] No broken wiki-links
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Step 8: Summary & Next Steps
|
|
306
|
-
|
|
307
|
-
// turbo
|
|
308
|
-
|
|
309
|
-
1. **Report Generated Files**: List all created documentation files.
|
|
310
|
-
2. **Suggest Improvements**:
|
|
311
|
-
- Missing documentation areas
|
|
312
|
-
- Outdated sections that need manual review
|
|
313
|
-
3. **Recommend Follow-ups**:
|
|
314
|
-
- Run `/ui-ux-design-from-doc` if design docs are needed
|
|
315
|
-
- Run `/requirement-analysis` for new features
|
|
316
|
-
|
|
317
|
-
**Output Example**:
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
✅ Documentation generated successfully!
|
|
321
|
-
|
|
322
|
-
📁 Files Created:
|
|
323
|
-
- docs/030-Specs/Architecture/System-Context.md
|
|
324
|
-
- docs/030-Specs/Architecture/Component-View.md
|
|
325
|
-
- docs/030-Specs/API/API-Standards.md
|
|
326
|
-
- docs/030-Specs/API/Endpoint-Users.md
|
|
327
|
-
- docs/030-Specs/Schema/ERD.md
|
|
328
|
-
- docs/030-Specs/Schema/DB-Entity-User.md
|
|
329
|
-
- docs/030-Specs/Specs-MOC.md
|
|
330
|
-
|
|
331
|
-
🔗 Next Steps:
|
|
332
|
-
- Review generated docs for accuracy
|
|
333
|
-
- Add missing business context to architecture docs
|
|
334
|
-
- Link specs to existing requirements
|
|
335
|
-
```
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Analyze the current codebase to generate a project context rule file.
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Workflow: Generate Rule from Codebase
|
|
6
|
-
|
|
7
|
-
Use this workflow to "learn" the project's existing patterns, stack, and conventions by scanning the codebase. This is useful when joining an existing project.
|
|
8
|
-
|
|
9
|
-
## Step 1: Discovery Scan
|
|
10
|
-
|
|
11
|
-
1. **Read Configuration**: Check `package.json`, `tsconfig.json`, `drizzle.config.ts`, `wrangler.toml`, etc.
|
|
12
|
-
2. **Analyze Structure**: Run `list_dir` on root and `app/` or `src/` to understand the architecture.
|
|
13
|
-
3. **Sample Code**: Read 2-3 representative files (e.g., a component, an API route, a schema definition) to understand coding style (naming, exports, type usage).
|
|
14
|
-
|
|
15
|
-
## Step 2: Synthesize Observations
|
|
16
|
-
|
|
17
|
-
Identify key facts:
|
|
18
|
-
|
|
19
|
-
- **Tech Stack**: Frameworks, ORMs, UI Libraries.
|
|
20
|
-
- **Conventions**: File naming (kebab vs camel), Component structure, Data fetching patterns.
|
|
21
|
-
- **Directories**: Where does code live? (e.g., `app/routes` vs `src/pages`).
|
|
22
|
-
|
|
23
|
-
## Step 3: Create Project Rules
|
|
24
|
-
|
|
25
|
-
Create a file named `.agent/rules/project-rules.md`.
|
|
26
|
-
|
|
27
|
-
**Content Structure**:
|
|
28
|
-
|
|
29
|
-
1. **Project Overview**: One line summary.
|
|
30
|
-
2. **Tech Stack**: Bullet points of major tools.
|
|
31
|
-
3. **Key Conventions**: detailed "Do's and Don'ts".
|
|
32
|
-
4. **Architecture**: Brief explanation of folder structure.
|
|
33
|
-
|
|
34
|
-
// turbo
|
|
35
|
-
|
|
36
|
-
## Step 4: Write the File
|
|
37
|
-
|
|
38
|
-
Use `write_to_file` to create `.agent/rules/project-rules.md`. If it exists, overwrite it with the fresh analysis.
|
|
39
|
-
|
|
40
|
-
## Step 5: Validation
|
|
41
|
-
|
|
42
|
-
1. Check if the new rule aligns with `package.json` dependencies.
|
|
43
|
-
2. Notify the user that project context has been refreshed.
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Create or update a project rule based on specific user feedback or corrections.
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Workflow: Extract Rule from Feedback
|
|
6
|
-
|
|
7
|
-
Use this workflow when the user provides explicit feedback about how they want the agent to behave, code preferences, or structural constraints (e.g., "Don't use library X", "Always name files Y").
|
|
8
|
-
|
|
9
|
-
## Step 1: Analyze Feedback & Existing Rules
|
|
10
|
-
|
|
11
|
-
1. **Analyze the User's Request**: Identifying the constraint or preference. Is it a global preference or specific to a file type?
|
|
12
|
-
2. **Check Existing Rules**: Look in `.agent/rules/` to see if a conflicting or similar rule already exists.
|
|
13
|
-
- If it contradicts an existing rule, you will need to UPDATE the old rule.
|
|
14
|
-
- If it's new, you will CREATE a new rule.
|
|
15
|
-
|
|
16
|
-
## Step 2: Determine Target Rule File
|
|
17
|
-
|
|
18
|
-
Decide where this rule belongs:
|
|
19
|
-
|
|
20
|
-
- **Default**: Update `.agent/rules/project-rules.md`. This is the central source of truth.
|
|
21
|
-
- **Exception**: If the rule is extremely complex or requires a very specific glob pattern (e.g., specific to only `.css` files), create a dedicated file.
|
|
22
|
-
|
|
23
|
-
## Step 3: Update Project Content
|
|
24
|
-
|
|
25
|
-
1. **Read**: Read `.agent/rules/project-rules.md`.
|
|
26
|
-
2. **Append/Update**: Add the new rule to the "Key Conventions" or "User Preferences" section.
|
|
27
|
-
- Format: `- **[Rule Name]**: [Description]`.
|
|
28
|
-
3. **Conflict Check**: Ensure it doesn't contradict existing lines.
|
|
29
|
-
|
|
30
|
-
## Step 4: Write the File
|
|
31
|
-
|
|
32
|
-
1. Use `replace_file_content` (or `write_to_file` if creating new) to save the changes.
|
|
33
|
-
2. **Validation**: Ensure the file format remains valid markdown.
|
|
34
|
-
|
|
35
|
-
## Step 5: Confirmation
|
|
36
|
-
|
|
37
|
-
1. Notify the user that the rule has been learned.
|
|
38
|
-
2. (Optional) If this feedback was given during a task, ask if you should re-run the previous step with the new rule applied.
|
/package/.agent/skills/rules-workflows/assets/{example-rule-always-on.md → rule-always-on.md}
RENAMED
|
File without changes
|
|
File without changes
|