@hd-agent-kit/cli 1.0.0

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/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @hd-agent-kit
2
+
3
+ AI agent configuration kit for Claude Code, Cursor, Windsurf, and OpenCode.
4
+
5
+ Sets up `AGENTS.md` and `.agents/skills/` in your project so AI assistants follow consistent rules and have access to slash commands like `/commit`, `/analyze`, `/refactor`, etc.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npx @hd-agent-kit/cli init
11
+ ```
12
+
13
+ This will:
14
+ 1. Copy `AGENTS.md` and `.agents/skills/` to your project root
15
+ 2. Configure global gitignore so these files don't get pushed to your repo
16
+
17
+ ## Commands
18
+
19
+ ### `init`
20
+ Copy agent files to your project and setup global gitignore.
21
+
22
+ ```bash
23
+ npx @hd-agent-kit/cli init # prompts before overwriting
24
+ npx @hd-agent-kit/cli init --force # overwrites without asking
25
+ ```
26
+
27
+ ### `update`
28
+ Update all agent files to the latest version (overwrites existing files).
29
+
30
+ ```bash
31
+ npx @hd-agent-kit/cli update
32
+ ```
33
+
34
+ ### `gitignore`
35
+ Only setup the global gitignore (without copying files).
36
+
37
+ ```bash
38
+ npx @hd-agent-kit/cli gitignore
39
+ ```
40
+
41
+ ## What Gets Installed
42
+
43
+ ```
44
+ your-project/
45
+ ├── AGENTS.md ← Global AI rules
46
+ └── .agents/
47
+ └── skills/
48
+ ├── analyze/SKILL.md ← /analyze — project analysis
49
+ ├── commit/SKILL.md ← /commit — smart commits
50
+ ├── document/SKILL.md ← /document — documentation
51
+ ├── performance-check/SKILL.md ← /performance-check
52
+ ├── refactor/SKILL.md ← /refactor — safe refactoring
53
+ ├── security-scan/SKILL.md ← /security-scan
54
+ └── write-tests/SKILL.md ← /write-tests — test generation
55
+ ```
56
+
57
+ ## Global Gitignore
58
+
59
+ The `init` and `gitignore` commands add these entries to your global gitignore:
60
+
61
+ ```
62
+ AGENTS.md
63
+ .agents/
64
+ project-rules.md
65
+ ```
66
+
67
+ This prevents agent config files from being committed to any project.
68
+
69
+ ## Available Slash Commands
70
+
71
+ | Command | Description |
72
+ |---------|-------------|
73
+ | `/analyze` | Analyze project and generate `project-rules.md` |
74
+ | `/commit` | Analyze changes and propose a commit message |
75
+ | `/refactor [file]` | Create a step-by-step refactor plan |
76
+ | `/write-tests [file]` | Generate test files |
77
+ | `/document [file]` | Generate JSDoc/TSDoc or README |
78
+ | `/performance-check` | Bundle, render, and Core Web Vitals analysis |
79
+ | `/security-scan` | Dependency audit, XSS/CSRF risk detection |
80
+
81
+ ## License
82
+
83
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { init, update, setupGlobalGitignore } = require('../src/index');
4
+
5
+ const args = process.argv.slice(2);
6
+ const command = args[0];
7
+ const flags = args.slice(1);
8
+ const force = flags.includes('--force') || flags.includes('-f');
9
+
10
+ const HELP_TEXT = `
11
+ @hd-agent-kit — AI Agent Configuration Kit
12
+
13
+ Usage:
14
+ npx @hd-agent-kit/cli <command> [options]
15
+
16
+ Commands:
17
+ init Copy agent files to project + setup global gitignore
18
+ update Update existing agent files (overwrites all)
19
+ gitignore Only setup global gitignore
20
+
21
+ Options:
22
+ --force, -f Overwrite existing files without prompting
23
+ --help, -h Show this help message
24
+ `;
25
+
26
+ async function main() {
27
+ if (!command || command === '--help' || command === '-h') {
28
+ console.log(HELP_TEXT);
29
+ process.exit(0);
30
+ }
31
+
32
+ switch (command) {
33
+ case 'init':
34
+ await init({ force });
35
+ break;
36
+ case 'update':
37
+ await update();
38
+ break;
39
+ case 'gitignore':
40
+ await setupGlobalGitignore();
41
+ break;
42
+ default:
43
+ console.error(` Unknown command: ${command}\n`);
44
+ console.log(HELP_TEXT);
45
+ process.exit(1);
46
+ }
47
+ }
48
+
49
+ main().catch((err) => {
50
+ console.error('\n Error:', err.message);
51
+ process.exit(1);
52
+ });
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@hd-agent-kit/cli",
3
+ "version": "1.0.0",
4
+ "description": "AI agent configuration kit — sets up AGENTS.md and skill files for Claude Code, Cursor, Windsurf, and OpenCode",
5
+ "bin": {
6
+ "hd-agent-kit": "./bin/cli.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "src/",
11
+ "templates/"
12
+ ],
13
+ "keywords": [
14
+ "ai",
15
+ "agents",
16
+ "claude",
17
+ "cursor",
18
+ "windsurf",
19
+ "opencode",
20
+ "developer-tools",
21
+ "cli"
22
+ ],
23
+ "license": "MIT",
24
+ "engines": {
25
+ "node": ">=16.0.0"
26
+ }
27
+ }
package/src/index.js ADDED
@@ -0,0 +1,151 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { execSync } = require('child_process');
4
+ const readline = require('readline');
5
+
6
+ const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
7
+ const GITIGNORE_ENTRIES = ['AGENTS.md', '.agents/', 'project-rules.md'];
8
+
9
+ // ── Helpers ──────────────────────────────────────────────
10
+
11
+ function log(msg) {
12
+ console.log(` ${msg}`);
13
+ }
14
+
15
+ function success(msg) {
16
+ console.log(` \u2713 ${msg}`);
17
+ }
18
+
19
+ function warn(msg) {
20
+ console.log(` ! ${msg}`);
21
+ }
22
+
23
+ function ask(question) {
24
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
25
+ return new Promise((resolve) => {
26
+ rl.question(` ${question} (y/N) `, (answer) => {
27
+ rl.close();
28
+ resolve(answer.trim().toLowerCase() === 'y');
29
+ });
30
+ });
31
+ }
32
+
33
+ function getAllFiles(dir, base = dir) {
34
+ const results = [];
35
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
36
+ const fullPath = path.join(dir, entry.name);
37
+ if (entry.isDirectory()) {
38
+ results.push(...getAllFiles(fullPath, base));
39
+ } else {
40
+ results.push(path.relative(base, fullPath));
41
+ }
42
+ }
43
+ return results;
44
+ }
45
+
46
+ // ── Global Gitignore ─────────────────────────────────────
47
+
48
+ async function setupGlobalGitignore() {
49
+ console.log('\n \uD83D\uDD12 Setting up global gitignore...\n');
50
+
51
+ let gitignorePath;
52
+
53
+ try {
54
+ gitignorePath = execSync('git config --global core.excludesFile', { encoding: 'utf-8' }).trim();
55
+ } catch {
56
+ // No global gitignore configured yet
57
+ gitignorePath = '';
58
+ }
59
+
60
+ // Resolve ~ to home directory
61
+ if (gitignorePath.startsWith('~')) {
62
+ gitignorePath = path.join(process.env.HOME || process.env.USERPROFILE, gitignorePath.slice(1));
63
+ }
64
+
65
+ if (!gitignorePath) {
66
+ const homedir = process.env.HOME || process.env.USERPROFILE;
67
+ gitignorePath = path.join(homedir, '.gitignore_global');
68
+
69
+ execSync(`git config --global core.excludesFile "${gitignorePath}"`);
70
+ log(`Global gitignore created: ${gitignorePath}`);
71
+ }
72
+
73
+ // Read existing content or start fresh
74
+ let content = '';
75
+ if (fs.existsSync(gitignorePath)) {
76
+ content = fs.readFileSync(gitignorePath, 'utf-8');
77
+ }
78
+
79
+ const lines = content.split('\n').map((l) => l.trim());
80
+ let added = false;
81
+
82
+ for (const entry of GITIGNORE_ENTRIES) {
83
+ if (!lines.includes(entry)) {
84
+ content = content.trimEnd() + '\n' + entry;
85
+ success(`${entry} added`);
86
+ added = true;
87
+ } else {
88
+ log(`${entry} already exists, skipped`);
89
+ }
90
+ }
91
+
92
+ if (added) {
93
+ fs.writeFileSync(gitignorePath, content.trimEnd() + '\n', 'utf-8');
94
+ }
95
+
96
+ console.log('');
97
+ }
98
+
99
+ // ── Copy Files ───────────────────────────────────────────
100
+
101
+ async function copyFiles(targetDir, { force = false } = {}) {
102
+ console.log('\n \uD83D\uDCC1 Copying agent files...\n');
103
+
104
+ const files = getAllFiles(TEMPLATES_DIR);
105
+
106
+ for (const relPath of files) {
107
+ const src = path.join(TEMPLATES_DIR, relPath);
108
+ const dest = path.join(targetDir, relPath);
109
+ const destDir = path.dirname(dest);
110
+
111
+ // Check if file exists
112
+ if (!force && fs.existsSync(dest)) {
113
+ const overwrite = await ask(`${relPath} already exists. Overwrite?`);
114
+ if (!overwrite) {
115
+ warn(`${relPath} skipped`);
116
+ continue;
117
+ }
118
+ }
119
+
120
+ fs.mkdirSync(destDir, { recursive: true });
121
+ fs.copyFileSync(src, dest);
122
+ success(relPath);
123
+ }
124
+
125
+ console.log('');
126
+ }
127
+
128
+ // ── Commands ─────────────────────────────────────────────
129
+
130
+ async function init({ force = false } = {}) {
131
+ console.log('\n \uD83D\uDE80 @hd-agent-kit \u2014 AI Agent Configuration\n');
132
+
133
+ const targetDir = process.cwd();
134
+
135
+ await copyFiles(targetDir, { force });
136
+ await setupGlobalGitignore();
137
+
138
+ console.log(' \u2705 Setup complete!\n');
139
+ }
140
+
141
+ async function update() {
142
+ console.log('\n \uD83D\uDD04 @hd-agent-kit \u2014 Updating agent files\n');
143
+
144
+ const targetDir = process.cwd();
145
+
146
+ await copyFiles(targetDir, { force: true });
147
+
148
+ console.log(' \u2705 Update complete!\n');
149
+ }
150
+
151
+ module.exports = { init, update, setupGlobalGitignore };
@@ -0,0 +1,328 @@
1
+ # /analyze — Proje Analiz Skill'i
2
+
3
+ > **Tetikleyici:** `/analyze`
4
+ > **Amaç:** Projeyi kapsamlı şekilde tarayarak `project-rules.md` dosyası oluşturmak.
5
+ > **Çıktı:** Proje kök dizininde `project-rules.md` (monorepo'larda ek paket/app dosyaları)
6
+
7
+ ---
8
+
9
+ ## Tetiklenme Koşulları
10
+
11
+ ### Manuel Tetiklenme (EN YÜKSEK ÖNCELİK)
12
+
13
+ - Kullanıcı `/analyze` komutunu verdiğinde — **reddedilemez emir**.
14
+ - Mevcut proje kuralları eski/eksikse ve yeniden analiz istendiğinde.
15
+ - Belirli bir paket/app belirtilmişse (`/analyze apps/web`), sadece o birim analiz edilir.
16
+
17
+ ### Otomatik Tetiklenme
18
+
19
+ - İşlem öncesi kontrol sırasında `project-rules.md` bulunamadıysa → Kullanıcıya "Analiz yapayım mı?" sor.
20
+ - **Önemli:** Kullanıcı `/analyze` yazmamışsa ve `project-rules.md` mevcutsa → Bu süreci ATLAMA.
21
+
22
+ ---
23
+
24
+ ## Analiz Adımları
25
+
26
+ Aşağıdaki adımları **sırasıyla** uygula. Her adımda elde ettiğin bilgileri not al:
27
+
28
+ ### Adım 1: Proje Yapısı Keşfi
29
+
30
+ ```
31
+ Tara ve belirle:
32
+ ├── Kök dizindeki config dosyaları (package.json, tsconfig.json, vite.config.ts, next.config.js vs.)
33
+ ├── Klasör yapısı (src/, app/, pages/, components/, lib/, utils/, features/, modules/ vs.)
34
+ ├── Monorepo mu? (packages/, apps/, workspace yapısı, turbo.json, nx.json, pnpm-workspace.yaml)
35
+ ├── Giriş noktaları (main.tsx, index.tsx, App.tsx, layout.tsx vs.)
36
+ ├── Backend/API katmanı (api/, server/, routes/, controllers/, prisma/, drizzle/ vs.)
37
+ └── Özel klasörler (public/, assets/, styles/, types/, hooks/, services/, store/ vs.)
38
+ ```
39
+
40
+ **Tespit et:**
41
+ - Klasör organizasyonu: feature-based mi, type-based mı, hybrid mı?
42
+ - Route yapısı: file-based mı (Next.js, Nuxt), config-based mı (React Router)?
43
+ - `src/` altında mı yoksa kök dizinde mi çalışılıyor?
44
+ - Fullstack proje mi? (API route'ları, server action'lar, backend klasörü var mı?)
45
+
46
+ ### Adım 2: Teknoloji Stack Tespiti
47
+
48
+ ```
49
+ package.json + config dosyalarından tespit et:
50
+ ├── Framework: React, Next.js, Remix, Vue, Nuxt, Svelte, Angular, Astro, Solid
51
+ ├── Build Tool: Vite, Webpack, Turbopack, esbuild, Rollup, Parcel
52
+ ├── Dil: TypeScript (strict mi?), JavaScript, JSX/TSX
53
+ ├── Styling: Tailwind, CSS Modules, styled-components, Emotion, Sass, vanilla CSS, Panda, StyleX
54
+ ├── State Yönetimi: Zustand, Redux Toolkit, Jotai, Recoil, Pinia, MobX, XState, Context API
55
+ ├── Server State: TanStack Query, SWR, Apollo Client, tRPC, RTK Query
56
+ ├── Form: React Hook Form, Formik, Zod, Yup, Valibot
57
+ ├── Test: Vitest, Jest, Testing Library, Playwright, Cypress, MSW
58
+ ├── Linting: ESLint, Biome, Prettier, Stylelint
59
+ ├── UI Kit: shadcn/ui, Radix, Headless UI, MUI, Ant Design, Mantine, Chakra
60
+ ├── Animasyon: Framer Motion, GSAP, Motion One, CSS transitions
61
+ ├── i18n: next-intl, react-i18next, vue-i18n, @formatjs, Paraglide
62
+ ├── Backend/API: Express, Fastify, Hono, tRPC, GraphQL, REST
63
+ ├── ORM/DB: Prisma, Drizzle, TypeORM, Mongoose, Supabase client
64
+ ├── Auth: NextAuth/Auth.js, Clerk, Supabase Auth, Firebase Auth, Lucia
65
+ └── Diğer: Monorepo tooling, deployment config, analytics
66
+ ```
67
+
68
+ ### Adım 3: Kod Stili & Pattern Analizi
69
+
70
+ Mevcut kaynak kodunu **en az 10-15 dosya** üzerinden örnekleyerek analiz et:
71
+
72
+ **Component Yapısı:**
73
+ - Arrow function mı, function declaration mı?
74
+ - Props inline mı tanımlanmış, ayrı interface/type mı?
75
+ - Export: default export mı, named export mı?
76
+ - Dosya başına tek component mı, birden fazla mı?
77
+ - Component dosya uzantısı: `.tsx`, `.jsx`, `.vue`, `.svelte`?
78
+
79
+ **Hook Kullanımı:**
80
+ - Custom hook'lar var mı? Nerede bulunuyor?
81
+ - Hangi hook pattern'ları tercih ediliyor?
82
+ - Data fetching nasıl yapılıyor?
83
+
84
+ **Stil Yaklaşımı:**
85
+ - Tailwind kullanılıyorsa: `cn()` / `clsx()` / `cva()` var mı? Hangi utility pattern'lar yaygın?
86
+ - CSS Modules ise: Adlandırma convention'ı ne?
87
+ - Theme/token sistemi var mı?
88
+
89
+ **Import Sıralaması:**
90
+ - Mevcut koddaki import sıralamasını tespit et (React, 3rd party, internal, styles, types vs.)
91
+ - Absolute import path alias var mı? (`@/`, `~/`, `#/`)
92
+
93
+ **Tip Tanımları:**
94
+ - Type'lar nerede tanımlanıyor? (Component yanında, ayrı `types/` klasöründe, global `types.d.ts`?)
95
+ - `interface` mi `type` mı daha yaygın?
96
+ - Zod/Valibot schema'dan tip türetme var mı?
97
+
98
+ **Hata Yönetimi:**
99
+ - Error boundary kullanılıyor mu?
100
+ - API hataları nasıl handle ediliyor?
101
+ - Toast/notification sistemi var mı?
102
+
103
+ **Backend/API Katmanı (varsa):**
104
+ - API route yapısı nasıl? (Next.js App Router, Pages Router, Express router vs.)
105
+ - Validation nerede yapılıyor? (Middleware, handler içinde, Zod schema)
106
+ - Auth middleware var mı? Nasıl uygulanıyor?
107
+ - DB query'leri nerede yazılıyor? (Service layer, doğrudan handler'da)
108
+
109
+ ### Adım 4: Konfigürasyon Analizi
110
+
111
+ ```
112
+ Detaylı incele:
113
+ ├── tsconfig.json → strict, paths, target, module, jsx ayarları
114
+ ├── ESLint config → Aktif kurallar, custom rules, extends
115
+ ├── Prettier config → Print width, tab/space, trailing comma, quotes
116
+ ├── Tailwind config → Custom theme, plugins, content paths
117
+ ├── Vite/Webpack config → Alias'lar, plugins, env handling
118
+ ├── .env.example → Env değişken yapısı ve adlandırma
119
+ ├── CI/CD config → Lint, test, build pipeline'ları
120
+ ├── Docker config → Dockerfile, docker-compose.yml varsa
121
+ └── Deployment config → vercel.json, netlify.toml, fly.toml vs.
122
+ ```
123
+
124
+ ### Adım 5: Test Stratejisi Tespiti
125
+
126
+ - Hangi test runner kullanılıyor?
127
+ - Test dosyaları nerede? (`__tests__/`, `*.test.ts`, `*.spec.ts`, yanında mı ayrı klasörde mi?)
128
+ - Test coverage hedefi var mı?
129
+ - E2E test altyapısı var mı?
130
+ - MSW veya benzeri API mock'lama var mı?
131
+ - Test utility/helper dosyaları var mı?
132
+
133
+ ### Adım 6: Git & Workflow Analizi
134
+
135
+ - Commit geçmişinden mesaj formatını tespit et (Conventional Commits mi, serbest mi?)
136
+ - Branch stratejisi (gitflow, trunk-based, GitHub flow?)
137
+ - PR template var mı?
138
+ - Husky/lint-staged gibi git hook'lar kurulu mu?
139
+ - Changelog yönetimi var mı?
140
+
141
+ ### Adım 7: Environment & Deployment Analizi
142
+
143
+ - Hangi ortamlar tanımlı? (development, staging, production)
144
+ - `.env.example` veya `.env.local.example` var mı?
145
+ - Env variable adlandırma convention'ı ne? (`NEXT_PUBLIC_`, `VITE_`, `REACT_APP_` vs.)
146
+ - Deployment target ne? (Vercel, Netlify, AWS, Docker, self-hosted)
147
+ - CI/CD pipeline'ı kurulu mu? (GitHub Actions, GitLab CI, CircleCI)
148
+ - Build komutu ve output dizini ne?
149
+
150
+ ### Adım 8: i18n & Lokalizasyon Analizi
151
+
152
+ - i18n kütüphanesi kullanılıyor mu?
153
+ - Çeviri dosyaları nerede? (`locales/`, `messages/`, `public/locales/`)
154
+ - Key naming convention'ı ne? (flat, nested, namespace-based)
155
+ - Kaç dil destekleniyor?
156
+ - RTL desteği var mı?
157
+ - Tarih/sayı/para birimi formatlama nasıl yapılıyor?
158
+
159
+ ---
160
+
161
+ ## Monorepo Davranışı
162
+
163
+ ### Monorepo Tespit Kriterleri
164
+
165
+ Şu dosya/klasörlerden biri varsa proje bir monorepo'dur:
166
+ - `pnpm-workspace.yaml`
167
+ - `turbo.json` veya `nx.json`
168
+ - `lerna.json`
169
+ - Kök `package.json` içinde `workspaces` alanı
170
+ - `apps/` ve/veya `packages/` klasör yapısı
171
+
172
+ ### Monorepo Analiz Stratejisi
173
+
174
+ - `/analyze` monorepo'da verildiğinde: Kök analiz + aktif olarak çalışılan paket/app analizi.
175
+ - Kullanıcı belirli bir paket belirtirse (`/analyze apps/web`), sadece o paket analiz edilir.
176
+ - Kök `project-rules.md` ortak convention'ları (commit format, linting, shared config) içerir.
177
+ - Paket/app `project-rules.md` dosyaları o birime özel override'ları içerir.
178
+
179
+ ### Monorepo Kural Dosyası Hiyerarşisi
180
+
181
+ ```
182
+ monorepo-root/
183
+ ├── project-rules.md ← Tüm paketler için geçerli ortak kurallar
184
+ ├── apps/
185
+ │ ├── web/
186
+ │ │ └── project-rules.md ← Sadece web app'e özel kurallar
187
+ │ └── admin/
188
+ │ └── project-rules.md ← Sadece admin app'e özel kurallar
189
+ └── packages/
190
+ ├── ui/
191
+ │ └── project-rules.md ← Sadece UI kit'e özel kurallar
192
+ └── shared/
193
+ └── project-rules.md ← Sadece shared pakete özel kurallar
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Çıktı Formatı: project-rules.md
199
+
200
+ Analiz tamamlandıktan sonra aşağıdaki formatta `project-rules.md` oluştur:
201
+
202
+ ```markdown
203
+ # [Proje Adı] — Proje Kuralları
204
+ # Bu dosya otomatik analiz ile oluşturulmuştur.
205
+ # Son analiz tarihi: [TARİH]
206
+ # Analiz tetikleyicisi: [/analyze komutu / Otomatik tespit]
207
+
208
+ ## Proje Özeti
209
+ - **Framework:** [tespit edilen]
210
+ - **Dil:** [TypeScript/JavaScript] | Strict: [Evet/Hayır]
211
+ - **Styling:** [tespit edilen]
212
+ - **State Yönetimi:** [tespit edilen]
213
+ - **Test:** [tespit edilen]
214
+ - **Build Tool:** [tespit edilen]
215
+ - **Monorepo:** [Evet/Hayır]
216
+ - **Fullstack:** [Evet/Hayır — backend katmanı varsa]
217
+ - **i18n:** [Evet/Hayır — kullanılan kütüphane]
218
+ - **Deployment Target:** [tespit edilen]
219
+
220
+ ## Temel Dependency Versiyonları
221
+ - [framework]: [versiyon]
222
+ - [ui-kit]: [versiyon]
223
+ - [state-lib]: [versiyon]
224
+ - [test-runner]: [versiyon]
225
+
226
+ ## Klasör Yapısı Kuralları
227
+ [Mevcut yapıya göre kurallar — yeni dosyalar nereye konulmalı, naming convention'lar]
228
+
229
+ ## Component Kuralları
230
+ [Mevcut koddan tespit edilen pattern'lar — function style, export style, prop tanımlama vs.]
231
+
232
+ ## Styling Kuralları
233
+ [Tailwind config, CSS convention, theme kullanımı vs.]
234
+
235
+ ## Import Kuralları
236
+ [Sıralama, path alias'lar, barrel export kullanımı]
237
+
238
+ ## Tip Tanımlama Kuralları
239
+ [Interface vs Type tercihi, nerede tanımlanacağı, naming convention]
240
+
241
+ ## State Yönetimi Kuralları
242
+ [Hangi state nerede yönetilecek, server state vs client state]
243
+
244
+ ## Test Kuralları
245
+ [Test dosya konumu, naming, minimum kapsam, kullanılan araçlar]
246
+
247
+ ## API & Data Fetching Kuralları
248
+ [Kullanılan pattern'lar, error handling, caching stratejisi]
249
+
250
+ ## Backend/Server Kuralları (Varsa)
251
+ [API route yapısı, validation, auth, DB erişim pattern'ları, server action convention'ları]
252
+
253
+ ## i18n Kuralları (Varsa)
254
+ [Key naming, çeviri dosya yapısı, yeni dil ekleme süreci, çoğullama kuralları]
255
+
256
+ ## Environment & Deployment Kuralları
257
+ [Env variable convention, ortam farkları, build/deploy süreci]
258
+
259
+ ## Design System & UI Kit Kuralları
260
+ [Mevcut component kullanımı, yeni varyant ekleme süreci, token hiyerarşisi]
261
+
262
+ ## Git Kuralları
263
+ [Commit format, branch naming — projeden tespit edilen]
264
+
265
+ ## Proje-Spesifik Notlar
266
+ [Projeye özel convention'lar, dikkat edilmesi gereken noktalar, bilinen teknik borçlar]
267
+ ```
268
+
269
+ ### Şablon Esnekliği
270
+
271
+ Yukarıdaki bölümlerin hepsi her projede geçerli olmayabilir. Analiz sonucunda **ilgisiz bölümleri dahil etme**. Örneğin:
272
+ - Küçük landing page → "State Yönetimi", "Backend/Server", "i18n" bölümleri eklenmez.
273
+ - Sadece frontend → "Backend/Server Kuralları" eklenmez.
274
+ - i18n yoksa → "i18n Kuralları" eklenmez.
275
+
276
+ Sadece projede aktif olarak kullanılan teknolojilere ve pattern'lara dair bölümleri yaz.
277
+
278
+ ---
279
+
280
+ ## Hata Kurtarma & Fallback
281
+
282
+ ### package.json Yoksa
283
+ 1. Projenin bir alt projesi/paketi olabilir → Üst dizinleri kontrol et
284
+ 2. Yeni proje mi? → Kullanıcıya sor
285
+ 3. Monorepo paketi mi? → Kök dizini bul ve workspace yapısını analiz et
286
+ 4. Hiçbiri değilse → Mevcut dosyaları tarayarak teknoloji tahmini yap, kullanıcıya doğrulat
287
+
288
+ ### TypeScript Kullanılmıyorsa
289
+ - TypeScript kurallarını ATLAMA, JavaScript best practice'lerine geç
290
+ - JSDoc ile tip belgeleme öner (zorunlu tutma)
291
+ - PropTypes kullanımını projede varsa devam ettir
292
+ - ESLint kurallarına daha fazla ağırlık ver
293
+ - Kullanıcıya TypeScript migration'ı öner ama dayatma
294
+
295
+ ### Config Dosyası Eksikse
296
+ - tsconfig.json yoksa → Dosya uzantılarından tespit et
297
+ - ESLint config yoksa → Mevcut kod stilinden convention çıkar
298
+ - Prettier config yoksa → Mevcut dosyalardaki formatting'i tespit et
299
+ - .env.example yoksa → Kodda kullanılan env variable'ları tarayarak bir liste oluştur
300
+
301
+ ### Analiz Sırasında Erişilemeyen Dosyalar
302
+ - Erişilemeyen dosyayı atla, analizi durdurmadan devam et
303
+ - Analiz sonucunda "şu dosyalara erişilemedi" notu düş
304
+ - Kritik config dosyasına erişilemiyorsa kullanıcıyı bilgilendir
305
+
306
+ ---
307
+
308
+ ## Güncellik Kontrolü
309
+
310
+ `project-rules.md` zaten mevcutsa, okurken şunları kontrol et:
311
+
312
+ 1. Analiz tarihi 3 aydan eski mi? → Kullanıcıya güncelleme öner
313
+ 2. package.json'daki major versiyonlar rules'daki ile uyuşuyor mu? → Uyuşmuyorsa uyar
314
+ 3. Yeni config dosyaları eklenmiş mi? (rules'da olmayan) → Varsa bildir
315
+ 4. Klasör yapısı rules'daki ile uyuşuyor mu? → Uyuşmuyorsa güncelleme öner
316
+
317
+ ### Güncelleme Gerektiğinde
318
+ ```
319
+ "Proje kurallarınız [tarih]'de oluşturulmuş. O zamandan beri [framework] versiyonu değişmiş
320
+ ve [yeni kütüphane] eklenmiş görünüyor. Kuralları güncellememi ister misiniz? (/analyze)"
321
+ ```
322
+
323
+ ### Yeniden Analiz Gerektiren Durumlar
324
+ - Framework major version upgrade'i (ör: Next.js 14 → 15)
325
+ - Yeni major dependency eklenmesi (ör: projeye Zustand eklendi)
326
+ - Klasör yapısı önemli ölçüde değişimi
327
+ - Team convention değişikliği
328
+ - `project-rules.md` 3 aydan eski