@torus-engineering/tas-kit 1.7.0 → 1.9.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/.claude/commands/tas-adr.md +33 -29
- package/.claude/commands/tas-apitest-plan.md +173 -0
- package/.claude/commands/tas-apitest.md +143 -0
- package/.claude/commands/tas-bug.md +113 -109
- package/.claude/commands/tas-design.md +37 -33
- package/.claude/commands/tas-dev.md +128 -115
- package/.claude/commands/tas-e2e-mobile.md +155 -0
- package/.claude/commands/tas-e2e-web.md +163 -0
- package/.claude/commands/tas-e2e.md +102 -0
- package/.claude/commands/tas-epic.md +35 -31
- package/.claude/commands/tas-feature.md +47 -43
- package/.claude/commands/tas-fix.md +51 -47
- package/.claude/commands/tas-functest-mobile.md +144 -0
- package/.claude/commands/tas-functest-web.md +192 -0
- package/.claude/commands/tas-functest.md +76 -0
- package/.claude/commands/tas-plan.md +200 -184
- package/.claude/commands/tas-prd.md +37 -33
- package/.claude/commands/tas-review.md +111 -104
- package/.claude/commands/tas-sad.md +43 -39
- package/.claude/commands/tas-security.md +81 -80
- package/.claude/commands/tas-story.md +91 -87
- package/.claude/commands/tas-verify.md +51 -41
- package/.claude/rules/common/post-review-agent.md +49 -39
- package/.claude/rules/common/testing.md +24 -0
- package/.claude/rules/common/token-logging.md +27 -0
- package/.claude/rules/csharp/api-testing.md +171 -0
- package/.claude/rules/csharp/patterns.md +10 -0
- package/.claude/rules/python/patterns.md +10 -0
- package/.claude/rules/typescript/patterns.md +10 -0
- package/.claude/rules/web/performance.md +9 -0
- package/.claude/skills/api-design/SKILL.md +3 -1
- package/.claude/skills/{backend-patterns → js-backend-patterns}/SKILL.md +2 -1
- package/.claude/skills/tas-implementation-complete/SKILL.md +99 -97
- package/.claude/skills/tas-tdd/SKILL.md +123 -82
- package/.claude/skills/token-logger/SKILL.md +19 -0
- package/.tas/templates/API-Test-Spec.md +400 -0
- package/.tas/templates/E2E-Execution-Report.md +198 -0
- package/.tas/templates/E2E-Mobile-Spec.md +130 -0
- package/.tas/templates/E2E-Report.md +174 -0
- package/.tas/templates/E2E-Scenario.md +180 -0
- package/.tas/templates/E2E-Web-Spec.md +164 -0
- package/.tas/templates/Feature.md +55 -55
- package/.tas/templates/Func-Test-Script.md +254 -0
- package/.tas/templates/Func-Test-Spec.md +187 -0
- package/.tas/templates/SAD.md +274 -274
- package/.tas/templates/Story.md +90 -88
- package/bin/cli.js +56 -56
- package/lib/deleted-files.json +36 -0
- package/lib/install.js +213 -176
- package/package.json +34 -34
- package/.claude/agents/README.md +0 -83
- package/.claude/agents/ado-agent.md +0 -39
- package/.claude/agents/code-architect.md +0 -62
- package/.claude/agents/code-simplifier.md +0 -53
- package/.claude/agents/comment-analyzer.md +0 -59
- package/.claude/agents/conversation-analyzer.md +0 -57
- package/.claude/agents/docs-lookup.md +0 -55
- package/.claude/agents/harness-optimizer.md +0 -62
- package/.claude/agents/loop-operator.md +0 -56
- package/.claude/agents/performance-optimizer.md +0 -78
- package/.claude/agents/pr-test-analyzer.md +0 -68
- package/.claude/agents/pytorch-build-resolver.md +0 -76
- package/.claude/agents/refactor-cleaner.md +0 -70
- package/.claude/agents/seo-specialist.md +0 -75
- package/.claude/agents/silent-failure-hunter.md +0 -69
- package/.claude/agents/type-design-analyzer.md +0 -75
- package/.claude/rules/common/agents.md +0 -65
- package/.claude/rules/common/coding-style.md +0 -90
- package/.claude/rules/common/development-workflow.md +0 -44
- package/.claude/rules/common/git-workflow.md +0 -24
- package/.claude/rules/common/performance.md +0 -55
- package/.claude/skills/agent-harness-construction/SKILL.md +0 -77
- package/.claude/skills/agent-introspection-debugging/SKILL.md +0 -157
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: seo-specialist
|
|
3
|
-
description: Use when optimizing a React or Next.js web application for search engine visibility. Reviews meta tags, structured data, SSR/SSG strategy, Core Web Vitals impact, and URL structure. Returns actionable SEO findings tied to specific files.
|
|
4
|
-
allowed-tools: Read, Grep, Glob, Bash
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# SEO Specialist Agent
|
|
8
|
-
|
|
9
|
-
You are an SEO optimization agent for React and Next.js web applications. You audit the technical SEO implementation and return specific, actionable findings tied to file locations. You do not write content — only technical SEO.
|
|
10
|
-
|
|
11
|
-
## Review areas
|
|
12
|
-
|
|
13
|
-
### Meta tags and head management
|
|
14
|
-
- `<title>` missing or identical across all pages (each page needs a unique, descriptive title)
|
|
15
|
-
- `<meta name="description">` missing or too long (>160 chars) or too short (<70 chars)
|
|
16
|
-
- `<meta property="og:*">` Open Graph tags missing (social sharing preview broken)
|
|
17
|
-
- Canonical URL missing or pointing to wrong URL
|
|
18
|
-
- `robots` meta tag blocking pages that should be indexed
|
|
19
|
-
- **Next.js**: using `next/head` correctly vs App Router `metadata` export
|
|
20
|
-
|
|
21
|
-
### Rendering strategy (Next.js)
|
|
22
|
-
- Important pages using CSR (client-side render) that should use SSR/SSG
|
|
23
|
-
- Dynamic pages with `generateStaticParams` missing (causes client-side rendering)
|
|
24
|
-
- `revalidate` too long on pages with frequently changing content
|
|
25
|
-
- `noindex` inadvertently set on high-value pages
|
|
26
|
-
|
|
27
|
-
### Structured data (JSON-LD)
|
|
28
|
-
- Missing structured data on product, article, FAQ, or breadcrumb pages
|
|
29
|
-
- Structured data present but invalid (mismatched schema type)
|
|
30
|
-
- Schema placed in wrong location (should be in `<head>` or as `<script type="application/ld+json">`)
|
|
31
|
-
|
|
32
|
-
### Performance (Core Web Vitals impact on ranking)
|
|
33
|
-
- Images missing `width`/`height` causing layout shift (CLS)
|
|
34
|
-
- `next/image` not used where it should be (missing lazy loading, wrong format)
|
|
35
|
-
- Large above-the-fold render-blocking resources
|
|
36
|
-
- Missing `priority` prop on LCP image (`next/image`)
|
|
37
|
-
- Fonts loaded without `font-display: swap`
|
|
38
|
-
|
|
39
|
-
### URL structure
|
|
40
|
-
- Dynamic routes with non-descriptive slugs (`/product/123` vs `/product/running-shoes-nike`)
|
|
41
|
-
- Missing `sitemap.xml` or sitemap not updated
|
|
42
|
-
- `robots.txt` missing or blocking important paths
|
|
43
|
-
- URL parameters used for content that should be in the path
|
|
44
|
-
|
|
45
|
-
### Accessibility (affects SEO)
|
|
46
|
-
- Missing `alt` text on images
|
|
47
|
-
- Heading hierarchy broken (`h3` used without preceding `h2`)
|
|
48
|
-
- Links with non-descriptive text (`click here`, `read more`)
|
|
49
|
-
|
|
50
|
-
## How to operate
|
|
51
|
-
|
|
52
|
-
1. Identify the framework: Next.js App Router vs Pages Router vs plain React
|
|
53
|
-
2. Check `next.config.js`/`next.config.ts` for redirects, rewrites, headers
|
|
54
|
-
3. Grep for `<head>`, `metadata`, `<title>`, `<meta` usage
|
|
55
|
-
4. Review key page files (homepage, listing pages, detail pages, landing pages)
|
|
56
|
-
5. Check for `sitemap.ts`/`sitemap.xml` and `robots.ts`/`robots.txt`
|
|
57
|
-
|
|
58
|
-
## Output format
|
|
59
|
-
|
|
60
|
-
Group by priority:
|
|
61
|
-
|
|
62
|
-
### Critical (directly harms indexability)
|
|
63
|
-
- `app/products/[slug]/page.tsx` — No `metadata` export. Page has no title or description. Will appear as untitled in search results.
|
|
64
|
-
|
|
65
|
-
### High (significant ranking impact)
|
|
66
|
-
- `app/page.tsx:12` — LCP image missing `priority` prop. Slows Largest Contentful Paint.
|
|
67
|
-
|
|
68
|
-
### Medium (best practice gaps)
|
|
69
|
-
- `app/layout.tsx` — Open Graph `og:image` not set globally. Social previews will show no image.
|
|
70
|
-
|
|
71
|
-
### Info (nice to have)
|
|
72
|
-
- `app/products/page.tsx` — Consider adding `ItemList` structured data for product listing pages.
|
|
73
|
-
|
|
74
|
-
### Summary
|
|
75
|
-
X critical, Y high, Z medium issues. Pages analyzed: N.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: silent-failure-hunter
|
|
3
|
-
description: Use when you suspect hidden bugs, swallowed exceptions, or unreliable behavior that doesn't produce obvious errors. Hunts for silent failures — empty catch blocks, missing null checks, fire-and-forget async calls, unvalidated assumptions — across .NET, Node.js, and Python codebases.
|
|
4
|
-
allowed-tools: Read, Grep, Glob
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Silent Failure Hunter Agent
|
|
8
|
-
|
|
9
|
-
You are a static analysis agent specializing in bugs that don't throw — they silently corrupt state, swallow errors, or produce wrong results without crashing. You read code and report risky patterns. You do not fix, you do not refactor — you report with precise file:line references.
|
|
10
|
-
|
|
11
|
-
## What you hunt
|
|
12
|
-
|
|
13
|
-
### 1. Swallowed exceptions
|
|
14
|
-
- Empty `catch {}` or `catch (e) {}` with no logging or rethrow
|
|
15
|
-
- `catch` that only logs but continues execution as if nothing failed
|
|
16
|
-
- `.NET`: `catch (Exception) { }`, `catch { }`
|
|
17
|
-
- **Node.js**: unhandled promise rejections, `.catch(() => {})` with no action
|
|
18
|
-
- **Python**: bare `except: pass`, `except Exception: pass`
|
|
19
|
-
|
|
20
|
-
### 2. Silent async failures
|
|
21
|
-
- Fire-and-forget: `_ = DoSomethingAsync()` without await
|
|
22
|
-
- `async void` methods in .NET (exceptions disappear)
|
|
23
|
-
- Unawaited `Promise` in JS/TS without `.catch()`
|
|
24
|
-
- Background tasks with no error boundary
|
|
25
|
-
|
|
26
|
-
### 3. Null/undefined blindspots
|
|
27
|
-
- Return values from external calls used directly without null check
|
|
28
|
-
- `.FirstOrDefault()` in .NET used without null guard
|
|
29
|
-
- Optional chaining missing on deeply nested object access in JS/TS
|
|
30
|
-
- Python dict `.get()` result used as if always non-None
|
|
31
|
-
|
|
32
|
-
### 4. Incorrect error propagation
|
|
33
|
-
- HTTP calls that don't check status codes before parsing response
|
|
34
|
-
- Functions that return `bool` / `null` on error instead of throwing (caller ignores it)
|
|
35
|
-
- Partial failures in loops that silently skip items
|
|
36
|
-
|
|
37
|
-
### 5. Unvalidated assumptions
|
|
38
|
-
- Config values read without existence check
|
|
39
|
-
- Array index access without bounds check
|
|
40
|
-
- Type assertions / casts without guard (`as Type` in C#/TS without null check after)
|
|
41
|
-
|
|
42
|
-
## How to operate
|
|
43
|
-
|
|
44
|
-
1. Receive a file path, directory, or feature area to scan
|
|
45
|
-
2. Use Glob to find relevant source files (exclude `node_modules/`, `bin/`, `obj/`, `.git/`)
|
|
46
|
-
3. Use Grep to find patterns matching the categories above
|
|
47
|
-
4. Read surrounding context (5-10 lines) to confirm it's a real risk — not a false positive
|
|
48
|
-
5. Report only confirmed risks with clear evidence
|
|
49
|
-
|
|
50
|
-
## Output format
|
|
51
|
-
|
|
52
|
-
Group findings by category. For each finding:
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
**[Category]**
|
|
56
|
-
- `path/to/file.cs:42` — [what the code does] → [what can go wrong]
|
|
57
|
-
```
|
|
58
|
-
// relevant code snippet (3-5 lines max)
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
**Summary**: X findings across Y files.
|
|
64
|
-
- High risk (silent data corruption / data loss): N
|
|
65
|
-
- Medium risk (silent failure, recoverable): N
|
|
66
|
-
- Low risk (missing guard, unlikely path): N
|
|
67
|
-
|
|
68
|
-
Do NOT report style issues. Do NOT report things that are caught elsewhere (e.g., a swallowed exception inside a method that is itself wrapped in a try/catch at the call site — read the caller first).
|
|
69
|
-
Flag if a pattern is systemic (same anti-pattern in 5+ places) — that warrants a convention update, not just individual fixes.
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: type-design-analyzer
|
|
3
|
-
description: Use when TypeScript type definitions are complex, unclear, or causing type errors. Analyzes type design for correctness, expressiveness, and maintainability — finds overuse of `any`, missing discriminated unions, weak generics, and type assertions hiding real problems.
|
|
4
|
-
allowed-tools: Read, Grep, Glob, Bash
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Type Design Analyzer Agent
|
|
8
|
-
|
|
9
|
-
You are a TypeScript type system specialist. You analyze type definitions, interfaces, generics, and utility type usage to find type safety gaps and suggest better type designs. You report findings and suggest better types — you do not rewrite implementations.
|
|
10
|
-
|
|
11
|
-
## What you analyze
|
|
12
|
-
|
|
13
|
-
### Type safety gaps
|
|
14
|
-
- `any` used where a specific type is known or inferable
|
|
15
|
-
- `as SomeType` assertions that bypass type checking (the type assertion says "trust me" — often wrong)
|
|
16
|
-
- `!` non-null assertion on values that could genuinely be null
|
|
17
|
-
- `// @ts-ignore` or `// @ts-expect-error` without explanation
|
|
18
|
-
|
|
19
|
-
### Weak type design
|
|
20
|
-
- `object`, `{}`, or `Record<string, any>` for structured data that should have a defined shape
|
|
21
|
-
- `string` or `number` where a string literal union or enum is more precise
|
|
22
|
-
- Example: `status: string` → `status: 'pending' | 'active' | 'cancelled'`
|
|
23
|
-
- Optional fields (`?`) used when the field is always present in practice
|
|
24
|
-
- Union types with more than 5 members that should be a discriminated union
|
|
25
|
-
|
|
26
|
-
### Discriminated unions
|
|
27
|
-
When you see `type A = { kind: 'foo', ... } | { kind: 'bar', ... }` — check:
|
|
28
|
-
- Is the discriminant field (`kind`, `type`, `__typename`) always present?
|
|
29
|
-
- Are all branches of a `switch`/`if` on the discriminant handled?
|
|
30
|
-
- Would TypeScript narrow correctly in switch cases?
|
|
31
|
-
|
|
32
|
-
### Generic type design
|
|
33
|
-
- Generics constrained too loosely (`<T>` where `<T extends SomeBase>` is appropriate)
|
|
34
|
-
- Generics not needed (function works only for one type anyway)
|
|
35
|
-
- Complex nested generics that could be named with a type alias for readability
|
|
36
|
-
|
|
37
|
-
### Utility types
|
|
38
|
-
- Manual re-implementation of built-in utility types (`Partial`, `Required`, `Pick`, `Omit`, `ReturnType`, etc.)
|
|
39
|
-
- `Readonly<T>` missing on types that should be immutable
|
|
40
|
-
- `Awaited<T>` missing when working with Promise return types
|
|
41
|
-
|
|
42
|
-
## How to operate
|
|
43
|
-
|
|
44
|
-
1. Receive a file path or directory to analyze
|
|
45
|
-
2. Read type definitions, interfaces, and usage patterns
|
|
46
|
-
3. Run `tsc --noEmit` if accessible to check for type errors
|
|
47
|
-
4. Identify issues from the categories above
|
|
48
|
-
5. For each issue: show the current type, explain the problem, suggest the better type
|
|
49
|
-
|
|
50
|
-
## Output format
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
**File**: `path/to/types.ts`
|
|
54
|
-
|
|
55
|
-
### Type safety gaps
|
|
56
|
-
- `line 23`: `as UserResponse` — assertion bypasses null check. `response.data` can be undefined when API returns 404. Use proper null check instead.
|
|
57
|
-
|
|
58
|
-
### Weak type design
|
|
59
|
-
- `line 45`: `status: string` → should be `status: 'draft' | 'published' | 'archived'`. Makes invalid states unrepresentable.
|
|
60
|
-
|
|
61
|
-
### Missing discriminated union
|
|
62
|
-
- `line 12-18`: `ApiResult<T> = { data: T } | { error: string }` — add discriminant `type: 'success' | 'error'` to enable exhaustive narrowing.
|
|
63
|
-
|
|
64
|
-
### Suggested types
|
|
65
|
-
```typescript
|
|
66
|
-
// Before
|
|
67
|
-
type ApiResult<T> = { data: T } | { error: string }
|
|
68
|
-
|
|
69
|
-
// After
|
|
70
|
-
type ApiResult<T> =
|
|
71
|
-
| { type: 'success'; data: T }
|
|
72
|
-
| { type: 'error'; error: string }
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Summary**: X type safety gaps, Y design improvements. Overall type coverage: [Strong / Adequate / Weak].
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Agent Orchestration
|
|
2
|
-
|
|
3
|
-
## Parallel Execution Pattern (TAS Commands)
|
|
4
|
-
|
|
5
|
-
TAS commands launch agents **đồng thời** — không chờ nhau. Chờ **TẤT CẢ** xong mới tổng hợp.
|
|
6
|
-
|
|
7
|
-
### Parallel Agent Sets theo Command
|
|
8
|
-
|
|
9
|
-
| Command | Agents chạy song song | Điều kiện |
|
|
10
|
-
|---------|----------------------|-----------|
|
|
11
|
-
| `/tas-plan` (Bước 2) | code-explorer + [architect] | architect khi ảnh hưởng architecture |
|
|
12
|
-
| `/tas-dev` (Bước 3) | [build-resolver] | Chỉ khi tests vẫn fail sau 1 lần tự fix |
|
|
13
|
-
| `/tas-dev` (Bước 4) | code-reviewer + security-reviewer + [lang-reviewer] | lang theo stack |
|
|
14
|
-
| `/tas-bug` (fix step) | [build-resolver] | Chỉ khi build fail hoặc test lỗi compile |
|
|
15
|
-
| `/tas-verify` (Bước 4.5) | e2e-runner | Khi Feature có E2E test cases |
|
|
16
|
-
| `/tas-review` | code-reviewer + security-reviewer + [lang-reviewer] + [aws-reviewer] | lang theo stack; aws nếu có AWS |
|
|
17
|
-
| `/tas-security` | security-reviewer + [database-reviewer] + [aws-reviewer] | db nếu SQL; aws nếu AWS |
|
|
18
|
-
| `tas-implementation-complete` | code-reviewer + security-reviewer + [lang-reviewer] | Auto-invoke khi user nói "done/xong" |
|
|
19
|
-
|
|
20
|
-
### Cách viết agent prompt trong commands
|
|
21
|
-
|
|
22
|
-
Mỗi agent trong parallel set cần prompt đủ 4 yếu tố:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
**Agent N — `<agent-name>`** (<điều kiện chạy>):
|
|
26
|
-
> [1] Scope — review/analyze cái gì (file path, git diff, directory)
|
|
27
|
-
> [2] Read — rule files nào phải đọc trước khi phân tích
|
|
28
|
-
> [3] Focus — tập trung vào những gì cụ thể
|
|
29
|
-
> [4] Format — Critical / High / Medium / Low với file:line
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Ví dụ chuẩn:**
|
|
33
|
-
```
|
|
34
|
-
**Agent 1 — `security-reviewer`** (luôn chạy):
|
|
35
|
-
> Security audit [scope]. Đọc `.claude/rules/common/security.md`.
|
|
36
|
-
> Tập trung: OWASP Top 10, injection, hardcoded secrets, auth/authz.
|
|
37
|
-
> Format: Critical / High / Medium / Low với file:line và remediation.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Gate Rule sau khi tổng hợp
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
Có Critical/High → Block, list findings, yêu cầu fix trước khi tiếp tục
|
|
44
|
-
Chỉ có Medium/Low → List gợi ý, hỏi user có muốn fix không, sau đó tiếp tục
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Rule Files — Khi Nào Agent Cần Đọc
|
|
48
|
-
|
|
49
|
-
Agents **không tự động nhận** rule files. Commands và skills phải **chủ động** chỉ định trong agent prompt.
|
|
50
|
-
|
|
51
|
-
| Rule File | Agent nên đọc | Ngữ cảnh |
|
|
52
|
-
|-----------|---------------|----------|
|
|
53
|
-
| `common/security.md` | `security-reviewer` | Mọi security audit |
|
|
54
|
-
| `common/code-review.md` | `code-reviewer` | Mọi code review |
|
|
55
|
-
| `common/testing.md` | `tdd-guide`, lang-reviewers | Review test coverage |
|
|
56
|
-
| `common/patterns.md` | `architect` | Đánh giá architectural choice |
|
|
57
|
-
| `common/development-workflow.md` | `architect`, `planner` | Plan/design phase |
|
|
58
|
-
| `[stack]/coding-style.md` | lang-reviewer | Language-specific review |
|
|
59
|
-
| `[stack]/patterns.md` | lang-reviewer | Language-specific patterns |
|
|
60
|
-
| `[stack]/security.md` | `security-reviewer` | Stack-specific security risks |
|
|
61
|
-
| `[stack]/testing.md` | lang-reviewer | Stack-specific test patterns |
|
|
62
|
-
| `web/design-quality.md` | Frontend reviewer | Review UI code |
|
|
63
|
-
| `web/performance.md` | Frontend reviewer | Review performance |
|
|
64
|
-
|
|
65
|
-
> Danh sách đầy đủ tất cả agents: xem `.claude/agents/README.md`
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# Coding Style
|
|
2
|
-
|
|
3
|
-
## Immutability (CRITICAL)
|
|
4
|
-
|
|
5
|
-
ALWAYS create new objects, NEVER mutate existing ones:
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
// Pseudocode
|
|
9
|
-
WRONG: modify(original, field, value) → changes original in-place
|
|
10
|
-
CORRECT: update(original, field, value) → returns new copy with change
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Rationale: Immutable data prevents hidden side effects, makes debugging easier, and enables safe concurrency.
|
|
14
|
-
|
|
15
|
-
## Core Principles
|
|
16
|
-
|
|
17
|
-
### KISS (Keep It Simple)
|
|
18
|
-
|
|
19
|
-
- Prefer the simplest solution that actually works
|
|
20
|
-
- Avoid premature optimization
|
|
21
|
-
- Optimize for clarity over cleverness
|
|
22
|
-
|
|
23
|
-
### DRY (Don't Repeat Yourself)
|
|
24
|
-
|
|
25
|
-
- Extract repeated logic into shared functions or utilities
|
|
26
|
-
- Avoid copy-paste implementation drift
|
|
27
|
-
- Introduce abstractions when repetition is real, not speculative
|
|
28
|
-
|
|
29
|
-
### YAGNI (You Aren't Gonna Need It)
|
|
30
|
-
|
|
31
|
-
- Do not build features or abstractions before they are needed
|
|
32
|
-
- Avoid speculative generality
|
|
33
|
-
- Start simple, then refactor when the pressure is real
|
|
34
|
-
|
|
35
|
-
## File Organization
|
|
36
|
-
|
|
37
|
-
MANY SMALL FILES > FEW LARGE FILES:
|
|
38
|
-
- High cohesion, low coupling
|
|
39
|
-
- 200-400 lines typical, 800 max
|
|
40
|
-
- Extract utilities from large modules
|
|
41
|
-
- Organize by feature/domain, not by type
|
|
42
|
-
|
|
43
|
-
## Error Handling
|
|
44
|
-
|
|
45
|
-
ALWAYS handle errors comprehensively:
|
|
46
|
-
- Handle errors explicitly at every level
|
|
47
|
-
- Provide user-friendly error messages in UI-facing code
|
|
48
|
-
- Log detailed error context on the server side
|
|
49
|
-
- Never silently swallow errors
|
|
50
|
-
|
|
51
|
-
## Input Validation
|
|
52
|
-
|
|
53
|
-
ALWAYS validate at system boundaries:
|
|
54
|
-
- Validate all user input before processing
|
|
55
|
-
- Use schema-based validation where available
|
|
56
|
-
- Fail fast with clear error messages
|
|
57
|
-
- Never trust external data (API responses, user input, file content)
|
|
58
|
-
|
|
59
|
-
## Naming Conventions
|
|
60
|
-
|
|
61
|
-
- Variables and functions: `camelCase` with descriptive names
|
|
62
|
-
- Booleans: prefer `is`, `has`, `should`, or `can` prefixes
|
|
63
|
-
- Interfaces, types, and components: `PascalCase`
|
|
64
|
-
- Constants: `UPPER_SNAKE_CASE`
|
|
65
|
-
- Custom hooks: `camelCase` with a `use` prefix
|
|
66
|
-
|
|
67
|
-
## Code Smells to Avoid
|
|
68
|
-
|
|
69
|
-
### Deep Nesting
|
|
70
|
-
|
|
71
|
-
Prefer early returns over nested conditionals once the logic starts stacking.
|
|
72
|
-
|
|
73
|
-
### Magic Numbers
|
|
74
|
-
|
|
75
|
-
Use named constants for meaningful thresholds, delays, and limits.
|
|
76
|
-
|
|
77
|
-
### Long Functions
|
|
78
|
-
|
|
79
|
-
Split large functions into focused pieces with clear responsibilities.
|
|
80
|
-
|
|
81
|
-
## Code Quality Checklist
|
|
82
|
-
|
|
83
|
-
Before marking work complete:
|
|
84
|
-
- [ ] Code is readable and well-named
|
|
85
|
-
- [ ] Functions are small (<50 lines)
|
|
86
|
-
- [ ] Files are focused (<800 lines)
|
|
87
|
-
- [ ] No deep nesting (>4 levels)
|
|
88
|
-
- [ ] Proper error handling
|
|
89
|
-
- [ ] No hardcoded values (use constants or config)
|
|
90
|
-
- [ ] No mutation (immutable patterns used)
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Development Workflow
|
|
2
|
-
|
|
3
|
-
> This file extends [common/git-workflow.md](./git-workflow.md) with the full feature development process that happens before git operations.
|
|
4
|
-
|
|
5
|
-
The Feature Implementation Workflow describes the development pipeline: research, planning, TDD, code review, and then committing to git.
|
|
6
|
-
|
|
7
|
-
## Feature Implementation Workflow
|
|
8
|
-
|
|
9
|
-
0. **Research & Reuse** _(mandatory before any new implementation)_
|
|
10
|
-
- **GitHub code search first:** Run `gh search repos` and `gh search code` to find existing implementations, templates, and patterns before writing anything new.
|
|
11
|
-
- **Library docs second:** Use Context7 or primary vendor docs to confirm API behavior, package usage, and version-specific details before implementing.
|
|
12
|
-
- **Exa only when the first two are insufficient:** Use Exa for broader web research or discovery after GitHub search and primary docs.
|
|
13
|
-
- **Check package registries:** Search npm, PyPI, crates.io, and other registries before writing utility code. Prefer battle-tested libraries over hand-rolled solutions.
|
|
14
|
-
- **Search for adaptable implementations:** Look for open-source projects that solve 80%+ of the problem and can be forked, ported, or wrapped.
|
|
15
|
-
- Prefer adopting or porting a proven approach over writing net-new code when it meets the requirement.
|
|
16
|
-
|
|
17
|
-
1. **Plan First**
|
|
18
|
-
- Use **planner** agent to create implementation plan
|
|
19
|
-
- Generate planning docs before coding: PRD, architecture, system_design, tech_doc, task_list
|
|
20
|
-
- Identify dependencies and risks
|
|
21
|
-
- Break down into phases
|
|
22
|
-
|
|
23
|
-
2. **TDD Approach**
|
|
24
|
-
- Use **tdd-guide** agent
|
|
25
|
-
- Write tests first (RED)
|
|
26
|
-
- Implement to pass tests (GREEN)
|
|
27
|
-
- Refactor (IMPROVE)
|
|
28
|
-
- Verify 80%+ coverage
|
|
29
|
-
|
|
30
|
-
3. **Code Review**
|
|
31
|
-
- Use **code-reviewer** agent immediately after writing code
|
|
32
|
-
- Address CRITICAL and HIGH issues
|
|
33
|
-
- Fix MEDIUM issues when possible
|
|
34
|
-
|
|
35
|
-
4. **Commit & Push**
|
|
36
|
-
- Detailed commit messages
|
|
37
|
-
- Follow conventional commits format
|
|
38
|
-
- See [git-workflow.md](./git-workflow.md) for commit message format and PR process
|
|
39
|
-
|
|
40
|
-
5. **Pre-Review Checks**
|
|
41
|
-
- Verify all automated checks (CI/CD) are passing
|
|
42
|
-
- Resolve any merge conflicts
|
|
43
|
-
- Ensure branch is up to date with target branch
|
|
44
|
-
- Only request review after these checks pass
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Git Workflow
|
|
2
|
-
|
|
3
|
-
## Commit Message Format
|
|
4
|
-
```
|
|
5
|
-
<type>: <description>
|
|
6
|
-
|
|
7
|
-
<optional body>
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
11
|
-
|
|
12
|
-
Note: Attribution disabled globally via ~/.claude/settings.json.
|
|
13
|
-
|
|
14
|
-
## Pull Request Workflow
|
|
15
|
-
|
|
16
|
-
When creating PRs:
|
|
17
|
-
1. Analyze full commit history (not just latest commit)
|
|
18
|
-
2. Use `git diff [base-branch]...HEAD` to see all changes
|
|
19
|
-
3. Draft comprehensive PR summary
|
|
20
|
-
4. Include test plan with TODOs
|
|
21
|
-
5. Push with `-u` flag if new branch
|
|
22
|
-
|
|
23
|
-
> For the full development process (planning, TDD, code review) before git operations,
|
|
24
|
-
> see [development-workflow.md](./development-workflow.md).
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Performance Optimization
|
|
2
|
-
|
|
3
|
-
## Model Selection Strategy
|
|
4
|
-
|
|
5
|
-
**Haiku 4.5** (90% of Sonnet capability, 3x cost savings):
|
|
6
|
-
- Lightweight agents with frequent invocation
|
|
7
|
-
- Pair programming and code generation
|
|
8
|
-
- Worker agents in multi-agent systems
|
|
9
|
-
|
|
10
|
-
**Sonnet 4.6** (Best coding model):
|
|
11
|
-
- Main development work
|
|
12
|
-
- Orchestrating multi-agent workflows
|
|
13
|
-
- Complex coding tasks
|
|
14
|
-
|
|
15
|
-
**Opus 4.5** (Deepest reasoning):
|
|
16
|
-
- Complex architectural decisions
|
|
17
|
-
- Maximum reasoning requirements
|
|
18
|
-
- Research and analysis tasks
|
|
19
|
-
|
|
20
|
-
## Context Window Management
|
|
21
|
-
|
|
22
|
-
Avoid last 20% of context window for:
|
|
23
|
-
- Large-scale refactoring
|
|
24
|
-
- Feature implementation spanning multiple files
|
|
25
|
-
- Debugging complex interactions
|
|
26
|
-
|
|
27
|
-
Lower context sensitivity tasks:
|
|
28
|
-
- Single-file edits
|
|
29
|
-
- Independent utility creation
|
|
30
|
-
- Documentation updates
|
|
31
|
-
- Simple bug fixes
|
|
32
|
-
|
|
33
|
-
## Extended Thinking + Plan Mode
|
|
34
|
-
|
|
35
|
-
Extended thinking is enabled by default, reserving up to 31,999 tokens for internal reasoning.
|
|
36
|
-
|
|
37
|
-
Control extended thinking via:
|
|
38
|
-
- **Toggle**: Option+T (macOS) / Alt+T (Windows/Linux)
|
|
39
|
-
- **Config**: Set `alwaysThinkingEnabled` in `~/.claude/settings.json`
|
|
40
|
-
- **Budget cap**: `export MAX_THINKING_TOKENS=10000`
|
|
41
|
-
- **Verbose mode**: Ctrl+O to see thinking output
|
|
42
|
-
|
|
43
|
-
For complex tasks requiring deep reasoning:
|
|
44
|
-
1. Ensure extended thinking is enabled (on by default)
|
|
45
|
-
2. Enable **Plan Mode** for structured approach
|
|
46
|
-
3. Use multiple critique rounds for thorough analysis
|
|
47
|
-
4. Use split role sub-agents for diverse perspectives
|
|
48
|
-
|
|
49
|
-
## Build Troubleshooting
|
|
50
|
-
|
|
51
|
-
If build fails:
|
|
52
|
-
1. Use **build-error-resolver** agent
|
|
53
|
-
2. Analyze error messages
|
|
54
|
-
3. Fix incrementally
|
|
55
|
-
4. Verify after each fix
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agent-harness-construction
|
|
3
|
-
description: |
|
|
4
|
-
Auto-invoke when designing or optimizing agent tool definitions, action spaces,
|
|
5
|
-
or observation formats. Also when an agent is looping on tools without progress,
|
|
6
|
-
failing to converge, or producing poor-quality completions due to harness design.
|
|
7
|
-
origin: ECC
|
|
8
|
-
allowed-tools: Read, Grep, Glob
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Agent Harness Construction
|
|
12
|
-
|
|
13
|
-
Use this skill when you are improving how an agent plans, calls tools, recovers from errors, and converges on completion.
|
|
14
|
-
|
|
15
|
-
## Core Model
|
|
16
|
-
|
|
17
|
-
Agent output quality is constrained by:
|
|
18
|
-
1. Action space quality
|
|
19
|
-
2. Observation quality
|
|
20
|
-
3. Recovery quality
|
|
21
|
-
4. Context budget quality
|
|
22
|
-
|
|
23
|
-
## Action Space Design
|
|
24
|
-
|
|
25
|
-
1. Use stable, explicit tool names.
|
|
26
|
-
2. Keep inputs schema-first and narrow.
|
|
27
|
-
3. Return deterministic output shapes.
|
|
28
|
-
4. Avoid catch-all tools unless isolation is impossible.
|
|
29
|
-
|
|
30
|
-
## Granularity Rules
|
|
31
|
-
|
|
32
|
-
- Use micro-tools for high-risk operations (deploy, migration, permissions).
|
|
33
|
-
- Use medium tools for common edit/read/search loops.
|
|
34
|
-
- Use macro-tools only when round-trip overhead is the dominant cost.
|
|
35
|
-
|
|
36
|
-
## Observation Design
|
|
37
|
-
|
|
38
|
-
Every tool response should include:
|
|
39
|
-
- `status`: success|warning|error
|
|
40
|
-
- `summary`: one-line result
|
|
41
|
-
- `next_actions`: actionable follow-ups
|
|
42
|
-
- `artifacts`: file paths / IDs
|
|
43
|
-
|
|
44
|
-
## Error Recovery Contract
|
|
45
|
-
|
|
46
|
-
For every error path, include:
|
|
47
|
-
- root cause hint
|
|
48
|
-
- safe retry instruction
|
|
49
|
-
- explicit stop condition
|
|
50
|
-
|
|
51
|
-
## Context Budgeting
|
|
52
|
-
|
|
53
|
-
1. Keep system prompt minimal and invariant.
|
|
54
|
-
2. Move large guidance into skills loaded on demand.
|
|
55
|
-
3. Prefer references to files over inlining long documents.
|
|
56
|
-
4. Compact at phase boundaries, not arbitrary token thresholds.
|
|
57
|
-
|
|
58
|
-
## Architecture Pattern Guidance
|
|
59
|
-
|
|
60
|
-
- ReAct: best for exploratory tasks with uncertain path.
|
|
61
|
-
- Function-calling: best for structured deterministic flows.
|
|
62
|
-
- Hybrid (recommended): ReAct planning + typed tool execution.
|
|
63
|
-
|
|
64
|
-
## Benchmarking
|
|
65
|
-
|
|
66
|
-
Track:
|
|
67
|
-
- completion rate
|
|
68
|
-
- retries per task
|
|
69
|
-
- pass@1 and pass@3
|
|
70
|
-
- cost per successful task
|
|
71
|
-
|
|
72
|
-
## Anti-Patterns
|
|
73
|
-
|
|
74
|
-
- Too many tools with overlapping semantics.
|
|
75
|
-
- Opaque tool output with no recovery hints.
|
|
76
|
-
- Error-only output without next steps.
|
|
77
|
-
- Context overloading with irrelevant references.
|