@silverassist/agents-toolkit 2.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/LICENSE +135 -0
- package/README.md +388 -0
- package/bin/cli.js +940 -0
- package/package.json +52 -0
- package/src/index.js +58 -0
- package/templates/agents/AGENTS.codex.md +195 -0
- package/templates/agents/AGENTS.md +195 -0
- package/templates/agents/CLAUDE.md +213 -0
- package/templates/agents/copilot-instructions.md +83 -0
- package/templates/shared/instructions/css-styling.instructions.md +142 -0
- package/templates/shared/instructions/documentation-language.instructions.md +216 -0
- package/templates/shared/instructions/github-workflow.instructions.md +245 -0
- package/templates/shared/instructions/php-standards.instructions.md +293 -0
- package/templates/shared/instructions/react-components.instructions.md +196 -0
- package/templates/shared/instructions/server-actions.instructions.md +429 -0
- package/templates/shared/instructions/testing-standards.instructions.md +264 -0
- package/templates/shared/instructions/tests.instructions.md +103 -0
- package/templates/shared/instructions/typescript.instructions.md +106 -0
- package/templates/shared/instructions/wordpress-plugin-architecture.instructions.md +238 -0
- package/templates/shared/prompts/README.md +129 -0
- package/templates/shared/prompts/_partials/README.md +57 -0
- package/templates/shared/prompts/_partials/documentation.md +203 -0
- package/templates/shared/prompts/_partials/git-operations.md +171 -0
- package/templates/shared/prompts/_partials/github-integration.md +100 -0
- package/templates/shared/prompts/_partials/jira-integration.md +155 -0
- package/templates/shared/prompts/_partials/pr-template.md +216 -0
- package/templates/shared/prompts/_partials/validations.md +87 -0
- package/templates/shared/prompts/add-tests.prompt.md +151 -0
- package/templates/shared/prompts/analyze-github-issue.prompt.md +73 -0
- package/templates/shared/prompts/analyze-ticket.prompt.md +63 -0
- package/templates/shared/prompts/create-plan.prompt.md +118 -0
- package/templates/shared/prompts/create-pr.prompt.md +139 -0
- package/templates/shared/prompts/finalize-pr.prompt.md +150 -0
- package/templates/shared/prompts/fix-issues.prompt.md +92 -0
- package/templates/shared/prompts/new-wp-component.prompt.md +51 -0
- package/templates/shared/prompts/new-wp-plugin.prompt.md +46 -0
- package/templates/shared/prompts/prepare-pr.prompt.md +123 -0
- package/templates/shared/prompts/prepare-release.prompt.md +74 -0
- package/templates/shared/prompts/quality-check.prompt.md +45 -0
- package/templates/shared/prompts/review-code.prompt.md +81 -0
- package/templates/shared/prompts/work-github-issue.prompt.md +96 -0
- package/templates/shared/prompts/work-ticket.prompt.md +98 -0
- package/templates/shared/skills/README.md +53 -0
- package/templates/shared/skills/component-architecture/SKILL.md +321 -0
- package/templates/shared/skills/create-component/SKILL.md +714 -0
- package/templates/shared/skills/domain-driven-design/SKILL.md +277 -0
- package/templates/shared/skills/plugin-creation/SKILL.md +1094 -0
- package/templates/shared/skills/quality-checks/SKILL.md +493 -0
- package/templates/shared/skills/release-management/SKILL.md +649 -0
- package/templates/shared/skills/testing/SKILL.md +682 -0
- package/templates/shared/skills/testing-patterns/SKILL.md +243 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Claude Code Instructions
|
|
2
|
+
|
|
3
|
+
This file contains project-wide instructions for Claude Code.
|
|
4
|
+
|
|
5
|
+
## Agent Workflow for Complex Tasks
|
|
6
|
+
|
|
7
|
+
When implementing new features, refactoring code, or fixing complex issues, **always follow this systematic workflow**:
|
|
8
|
+
|
|
9
|
+
### Phase 1: Initial Analysis
|
|
10
|
+
1. **Analyze the request** - Understand the full scope, dependencies, and potential impacts
|
|
11
|
+
2. **Search existing code** - Use semantic search and grep to understand current implementation
|
|
12
|
+
3. **Identify components** - List all files, functions, and components that need changes
|
|
13
|
+
4. **Review documentation** - Check existing docs for patterns and conventions
|
|
14
|
+
|
|
15
|
+
### Phase 2: Planning Documentation
|
|
16
|
+
1. **Create planning document** - `docs/[feature-name]-plan.md` with:
|
|
17
|
+
- Problem statement and objectives
|
|
18
|
+
- Current architecture analysis
|
|
19
|
+
- Proposed changes with before/after code examples
|
|
20
|
+
- Risk assessment and mitigation strategies
|
|
21
|
+
- Phase breakdown if complex
|
|
22
|
+
2. **Add action plan** - Detailed step-by-step implementation guide
|
|
23
|
+
3. **Create TODO list** - Use the TodoWrite tool to track all phases
|
|
24
|
+
4. **Commit planning** - `git commit -m "PROJECT-XXX: Add [feature] implementation plan"`
|
|
25
|
+
|
|
26
|
+
### Phase 3: Implementation by Phases
|
|
27
|
+
For each phase:
|
|
28
|
+
1. **Mark TODO as in-progress** - Update status before starting work
|
|
29
|
+
2. **Implement changes** - Make code changes following the plan
|
|
30
|
+
3. **Write/update tests** - Add unit tests, ensure regression tests pass
|
|
31
|
+
4. **Run tests** - `npm test` to verify no regressions
|
|
32
|
+
5. **Mark TODO as completed** - Update status after successful implementation
|
|
33
|
+
6. **Commit phase** - `git commit -m "PROJECT-XXX: Implement [feature] - Phase N"`
|
|
34
|
+
|
|
35
|
+
### Phase 4: Final Documentation
|
|
36
|
+
1. **Create final documentation** - `docs/[feature-name].md`
|
|
37
|
+
2. **Update related docs** - Update `project-overview.md`, `readme.md`, etc.
|
|
38
|
+
3. **Delete planning docs** - Remove temporary planning documents
|
|
39
|
+
4. **Final commit** - `git commit -m "PROJECT-XXX: Add [feature] documentation"`
|
|
40
|
+
|
|
41
|
+
### Key Principles
|
|
42
|
+
- ✅ **One commit per phase** - Create clear checkpoint commits
|
|
43
|
+
- ✅ **Test everything** - Run full test suite after each phase
|
|
44
|
+
- ✅ **No breaking changes** - Ensure backward compatibility
|
|
45
|
+
- ✅ **Document as you go** - Update docs with each phase
|
|
46
|
+
- ✅ **Type safety** - Maintain full TypeScript coverage
|
|
47
|
+
|
|
48
|
+
## Slash Commands
|
|
49
|
+
|
|
50
|
+
Custom slash commands are available in `.claude/commands/`:
|
|
51
|
+
|
|
52
|
+
| Command | Description |
|
|
53
|
+
|---------|-------------|
|
|
54
|
+
| `/analyze-ticket` | Analyze a Jira ticket without making changes |
|
|
55
|
+
| `/create-plan` | Create an implementation plan for a ticket |
|
|
56
|
+
| `/work-ticket` | Start working on a Jira ticket with full workflow setup |
|
|
57
|
+
| `/prepare-pr` | Prepare code for pull request review |
|
|
58
|
+
| `/create-pr` | Create and submit a pull request |
|
|
59
|
+
| `/finalize-pr` | Finalize and merge a pull request |
|
|
60
|
+
| `/review-code` | Review code for quality and issues |
|
|
61
|
+
| `/fix-issues` | Fix identified code issues |
|
|
62
|
+
| `/add-tests` | Add tests for existing code |
|
|
63
|
+
|
|
64
|
+
## Key Technologies & Frameworks
|
|
65
|
+
|
|
66
|
+
- **Next.js 15.x** with App Router for modern React development
|
|
67
|
+
- **React 19** for latest React features and optimizations
|
|
68
|
+
- **TypeScript** for comprehensive type safety
|
|
69
|
+
- **Tailwind CSS v4** with custom CSS variables and shadcn/ui design system
|
|
70
|
+
- **Jest & React Testing Library** for comprehensive testing
|
|
71
|
+
|
|
72
|
+
## Domain-Driven Design (DDD) Principles
|
|
73
|
+
|
|
74
|
+
This project follows **Domain-Driven Design** principles.
|
|
75
|
+
|
|
76
|
+
**Core Principles**:
|
|
77
|
+
1. **Group by Domain, Not by Type** - Organize files by business domain rather than technical type
|
|
78
|
+
2. **Clear Boundaries** - Each domain has well-defined responsibilities
|
|
79
|
+
3. **Colocation** - Related code (components, utils, tests) lives together
|
|
80
|
+
|
|
81
|
+
**Quick Rules**:
|
|
82
|
+
- ✅ Create domain folders that match business concepts
|
|
83
|
+
- ✅ Keep domain-specific utilities inside domain folders
|
|
84
|
+
- ✅ Place tests in `__tests__/` subfolders within each domain
|
|
85
|
+
- ❌ Don't create generic folders like "helpers", "services", "utils" at root level
|
|
86
|
+
|
|
87
|
+
## Key Conventions
|
|
88
|
+
|
|
89
|
+
### Code Style & Organization
|
|
90
|
+
|
|
91
|
+
- **Imports**: Always organize imports alphabetically within each group
|
|
92
|
+
- **API Functions**: Must have descriptive JSDoc comments in English
|
|
93
|
+
- **Types**: Define interfaces and types properly, not directly in components
|
|
94
|
+
- **No `any` Type**: Always define explicit types using `type` or `interface`
|
|
95
|
+
- **File Naming**: All files should use kebab-case (e.g., `use-hash.ts`, `contact-form.tsx`)
|
|
96
|
+
- **Object Destructuring**: Always use destructuring when iterating over objects
|
|
97
|
+
- **Error Handling**: Apply robust error handling with try/catch for async operations
|
|
98
|
+
- **Import Paths**: Always use absolute imports with `@/` prefix
|
|
99
|
+
|
|
100
|
+
### Component Structure & Naming
|
|
101
|
+
|
|
102
|
+
**CRITICAL: All components must follow these strict conventions:**
|
|
103
|
+
|
|
104
|
+
#### 1. Folder & File Naming
|
|
105
|
+
|
|
106
|
+
- **Folder names**: MUST use kebab-case (e.g., `user-profile/`, `checkout-wizard/`)
|
|
107
|
+
- **File structure**: Every component MUST be in its own folder with an `index.tsx` file
|
|
108
|
+
- **❌ NEVER**: Use camelCase or PascalCase for folder names
|
|
109
|
+
- **❌ NEVER**: Create standalone component files like `Component.tsx` at root level
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
✅ CORRECT:
|
|
113
|
+
src/components/user-profile/index.tsx
|
|
114
|
+
src/components/contact-form/index.tsx
|
|
115
|
+
|
|
116
|
+
❌ INCORRECT:
|
|
117
|
+
src/components/UserProfile.tsx
|
|
118
|
+
src/components/userProfile/index.tsx
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### 2. Component Export Pattern
|
|
122
|
+
|
|
123
|
+
- **Function name**: MUST use PascalCase for the exported function
|
|
124
|
+
- **Export statement**: MUST use `export default function` for components
|
|
125
|
+
- **Barrel file**: Re-export with a named alias from the domain `index.ts`
|
|
126
|
+
- **Single responsibility**: Each file should export ONLY the component function
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// ✅ CORRECT: src/components/user-profile/index.tsx
|
|
130
|
+
interface UserProfileProps {
|
|
131
|
+
userId: string;
|
|
132
|
+
className?: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export default function UserProfile({ userId, className }: UserProfileProps) {
|
|
136
|
+
// Component implementation
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ✅ CORRECT: src/components/index.ts (barrel)
|
|
140
|
+
export { default as UserProfile } from "./user-profile";
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### 3. Props Interface Definition
|
|
144
|
+
|
|
145
|
+
- **MUST**: Define props interface INSIDE the component file
|
|
146
|
+
- **Interface name**: MUST match component name + "Props" suffix (PascalCase)
|
|
147
|
+
- **Location**: Define interface immediately BEFORE the component function
|
|
148
|
+
|
|
149
|
+
#### 4. Separation of Concerns
|
|
150
|
+
|
|
151
|
+
- **Component file**: ONLY the component function and its props interface
|
|
152
|
+
- **Helper functions**: Create separate `helpers.ts` or `utils.ts` in same folder
|
|
153
|
+
- **Types/Interfaces**: Create separate `types.ts` if multiple types are shared
|
|
154
|
+
- **Constants**: Create separate `constants.ts` for component-specific constants
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## React Patterns
|
|
159
|
+
|
|
160
|
+
### Hook Placement Rules (CRITICAL)
|
|
161
|
+
|
|
162
|
+
**✅ Correct:** All hooks before conditional returns
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
export default function Component({ data }: Props) {
|
|
166
|
+
const [state, setState] = useState(initialState);
|
|
167
|
+
const handleClick = useCallback(() => {}, []);
|
|
168
|
+
|
|
169
|
+
// Early returns AFTER all hooks
|
|
170
|
+
if (!data) return null;
|
|
171
|
+
|
|
172
|
+
return <div>...</div>;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**❌ Incorrect:** Hooks after conditional returns
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
export function Component({ data }: Props) {
|
|
180
|
+
if (!data) return null; // ❌ Early return before hooks
|
|
181
|
+
|
|
182
|
+
const [state, setState] = useState(initialState); // ❌ Error!
|
|
183
|
+
return <div>...</div>;
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Git Commit Guidelines
|
|
190
|
+
|
|
191
|
+
### Commit Message Format
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
TYPE-XXX: Brief description
|
|
195
|
+
|
|
196
|
+
- Detailed change 1
|
|
197
|
+
- Detailed change 2
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Commit Types
|
|
201
|
+
|
|
202
|
+
- `feat`: New feature
|
|
203
|
+
- `fix`: Bug fix
|
|
204
|
+
- `docs`: Documentation only
|
|
205
|
+
- `refactor`: Code change that neither fixes a bug nor adds a feature
|
|
206
|
+
- `test`: Adding or updating tests
|
|
207
|
+
- `chore`: Maintenance tasks
|
|
208
|
+
|
|
209
|
+
### Branch Naming
|
|
210
|
+
|
|
211
|
+
- `feature/TYPE-XXX-brief-description`
|
|
212
|
+
- `bugfix/TYPE-XXX-brief-description`
|
|
213
|
+
- `hotfix/TYPE-XXX-brief-description`
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Copilot Instructions
|
|
2
|
+
|
|
3
|
+
This file contains project-wide instructions for GitHub Copilot.
|
|
4
|
+
|
|
5
|
+
## 🔄 Copilot Agent Workflow for Complex Tasks
|
|
6
|
+
|
|
7
|
+
When implementing new features, refactoring code, or fixing complex issues, **always follow this systematic workflow**:
|
|
8
|
+
|
|
9
|
+
### Phase 1: Initial Analysis
|
|
10
|
+
1. **Analyze the request** - Understand the full scope, dependencies, and potential impacts
|
|
11
|
+
2. **Search existing code** - Use semantic search and grep to understand current implementation
|
|
12
|
+
3. **Identify components** - List all files, functions, and components that need changes
|
|
13
|
+
4. **Review documentation** - Check existing docs for patterns and conventions
|
|
14
|
+
|
|
15
|
+
### Phase 2: Planning Documentation
|
|
16
|
+
1. **Create planning document** - `docs/[feature-name]-plan.md` with:
|
|
17
|
+
- Problem statement and objectives
|
|
18
|
+
- Current architecture analysis
|
|
19
|
+
- Proposed changes with before/after code examples
|
|
20
|
+
- Risk assessment and mitigation strategies
|
|
21
|
+
- Phase breakdown if complex
|
|
22
|
+
2. **Add action plan** - Detailed step-by-step implementation guide
|
|
23
|
+
3. **Create TODO list** - Use `manage_todo_list` tool to track all phases
|
|
24
|
+
4. **Commit planning** - `git commit -m "PROJECT-XXX: Add [feature] implementation plan"`
|
|
25
|
+
|
|
26
|
+
### Phase 3: Implementation by Phases
|
|
27
|
+
For each phase:
|
|
28
|
+
1. **Mark TODO as in-progress** - Update status before starting work
|
|
29
|
+
2. **Implement changes** - Make code changes following the plan
|
|
30
|
+
3. **Write/update tests** - Add unit tests, ensure regression tests pass
|
|
31
|
+
4. **Run tests** - `npm test` to verify no regressions
|
|
32
|
+
5. **Mark TODO as completed** - Update status after successful implementation
|
|
33
|
+
6. **Commit phase** - `git commit -m "PROJECT-XXX: Implement [feature] - Phase N"`
|
|
34
|
+
|
|
35
|
+
### Phase 4: Final Documentation
|
|
36
|
+
1. **Create final documentation** - `docs/[feature-name].md`
|
|
37
|
+
2. **Update related docs** - Update `project-overview.md`, `readme.md`, etc.
|
|
38
|
+
3. **Delete planning docs** - Remove temporary planning documents
|
|
39
|
+
4. **Final commit** - `git commit -m "PROJECT-XXX: Add [feature] documentation"`
|
|
40
|
+
|
|
41
|
+
### Key Principles
|
|
42
|
+
- ✅ **One commit per phase** - Create clear checkpoint commits
|
|
43
|
+
- ✅ **Test everything** - Run full test suite after each phase
|
|
44
|
+
- ✅ **No breaking changes** - Ensure backward compatibility
|
|
45
|
+
- ✅ **Document as you go** - Update docs with each phase
|
|
46
|
+
- ✅ **Type safety** - Maintain full TypeScript coverage
|
|
47
|
+
|
|
48
|
+
## Key Technologies & Frameworks
|
|
49
|
+
|
|
50
|
+
- **Next.js 15.x** with App Router for modern React development
|
|
51
|
+
- **React 19** for latest React features and optimizations
|
|
52
|
+
- **TypeScript** for comprehensive type safety
|
|
53
|
+
- **Tailwind CSS v4** with custom CSS variables and shadcn/ui design system
|
|
54
|
+
- **Jest & React Testing Library** for comprehensive testing
|
|
55
|
+
|
|
56
|
+
## Domain-Driven Design (DDD) Principles
|
|
57
|
+
|
|
58
|
+
This project follows **Domain-Driven Design** principles. See the `domain-driven-design` skill for detailed guidelines.
|
|
59
|
+
|
|
60
|
+
**Core Principles**:
|
|
61
|
+
1. **Group by Domain, Not by Type** - Organize files by business domain rather than technical type
|
|
62
|
+
2. **Clear Boundaries** - Each domain has well-defined responsibilities
|
|
63
|
+
3. **Colocation** - Related code (components, utils, tests) lives together
|
|
64
|
+
|
|
65
|
+
**Quick Rules**:
|
|
66
|
+
- ✅ Create domain folders that match business concepts
|
|
67
|
+
- ✅ Keep domain-specific utilities inside domain folders
|
|
68
|
+
- ✅ Place tests in `__tests__/` subfolders within each domain
|
|
69
|
+
- ❌ Don't create generic folders like "helpers", "services", "utils" at root level
|
|
70
|
+
|
|
71
|
+
## Barrel Export Pattern
|
|
72
|
+
|
|
73
|
+
Use **barrel exports** (`index.ts`) for folders with multiple internal files:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// src/lib/api/index.ts
|
|
77
|
+
export * from "./client";
|
|
78
|
+
export * from "./endpoints";
|
|
79
|
+
export * from "./types";
|
|
80
|
+
|
|
81
|
+
// Usage - Clean imports from domain
|
|
82
|
+
import { apiClient, fetchUser } from "@/lib/api";
|
|
83
|
+
```
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*.{css,tsx}"
|
|
3
|
+
---
|
|
4
|
+
# Tailwind CSS & shadcn/ui Standards
|
|
5
|
+
|
|
6
|
+
## Use Design Tokens (Semantic Colors)
|
|
7
|
+
|
|
8
|
+
**✅ ALWAYS use semantic color tokens** instead of hardcoded colors:
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
// ✅ CORRECT: Semantic tokens
|
|
12
|
+
<div className="bg-background text-foreground" />
|
|
13
|
+
<div className="bg-card text-card-foreground border-border" />
|
|
14
|
+
<div className="bg-primary text-primary-foreground" />
|
|
15
|
+
<div className="bg-destructive text-destructive-foreground" />
|
|
16
|
+
<div className="bg-muted text-muted-foreground" />
|
|
17
|
+
|
|
18
|
+
// ❌ INCORRECT: Hardcoded colors
|
|
19
|
+
<div className="bg-white text-black" />
|
|
20
|
+
<div className="bg-blue-500 text-white" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Use cn() Utility for Conditional Classes
|
|
24
|
+
|
|
25
|
+
**✅ ALWAYS use cn()** from `@/lib/utils` for conditional styling:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { cn } from "@/lib/utils";
|
|
29
|
+
|
|
30
|
+
// ✅ CORRECT: Using cn() utility
|
|
31
|
+
<button
|
|
32
|
+
className={cn(
|
|
33
|
+
"px-4 py-2 rounded-md font-medium",
|
|
34
|
+
"bg-primary text-primary-foreground",
|
|
35
|
+
isDisabled && "opacity-50 cursor-not-allowed",
|
|
36
|
+
isActive && "ring-2 ring-ring ring-offset-2",
|
|
37
|
+
className // Allow prop override
|
|
38
|
+
)}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
// ❌ INCORRECT: Template literals
|
|
42
|
+
<button
|
|
43
|
+
className={`px-4 py-2 ${isDisabled ? 'opacity-50' : ''}`}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Setting Up cn() Utility
|
|
48
|
+
|
|
49
|
+
If you don't have the `cn()` utility yet (it's installed automatically with shadcn/ui):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install clsx tailwind-merge
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// src/lib/utils.ts
|
|
57
|
+
import { type ClassValue, clsx } from "clsx";
|
|
58
|
+
import { twMerge } from "tailwind-merge";
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Merges and combines Tailwind CSS classes.
|
|
62
|
+
* Uses clsx for conditional classes and tailwind-merge to handle conflicts.
|
|
63
|
+
* @param inputs - The Tailwind CSS classes to merge
|
|
64
|
+
* @returns The merged Tailwind CSS classes
|
|
65
|
+
*/
|
|
66
|
+
export function cn(...inputs: ClassValue[]): string {
|
|
67
|
+
return twMerge(clsx(inputs));
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Responsive Design (Mobile-First)
|
|
72
|
+
|
|
73
|
+
**✅ ALWAYS use mobile-first responsive design**:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
// ✅ CORRECT: Mobile-first (sm → md → lg → xl)
|
|
77
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" />
|
|
78
|
+
<div className="text-sm md:text-base lg:text-lg" />
|
|
79
|
+
<div className="p-4 md:p-6 lg:p-8" />
|
|
80
|
+
<div className="flex flex-col md:flex-row" />
|
|
81
|
+
|
|
82
|
+
// ❌ INCORRECT: Desktop-first (working backwards)
|
|
83
|
+
<div className="grid grid-cols-4 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1" />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## shadcn/ui Component Usage
|
|
87
|
+
|
|
88
|
+
**✅ IMPORT from component path**:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
// ✅ CORRECT: Import from component path
|
|
92
|
+
import { Button } from "@/components/ui/button";
|
|
93
|
+
import { Card, CardContent, CardHeader } from "@/components/ui/card";
|
|
94
|
+
|
|
95
|
+
// Use with variants
|
|
96
|
+
<Button variant="default">Primary</Button>
|
|
97
|
+
<Button variant="secondary">Secondary</Button>
|
|
98
|
+
<Button variant="destructive">Delete</Button>
|
|
99
|
+
<Button variant="outline">Outline</Button>
|
|
100
|
+
<Button variant="ghost">Ghost</Button>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Typography
|
|
104
|
+
|
|
105
|
+
**✅ USE prose classes for content** and utility classes for UI:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
// ✅ CORRECT: UI typography
|
|
109
|
+
<h1 className="text-3xl font-bold tracking-tight" />
|
|
110
|
+
<p className="text-sm text-muted-foreground" />
|
|
111
|
+
|
|
112
|
+
// ✅ CORRECT: Content typography (prose)
|
|
113
|
+
<article className="prose prose-lg dark:prose-invert" />
|
|
114
|
+
|
|
115
|
+
// ✅ Font families
|
|
116
|
+
<div className="font-sans" /> // Default font
|
|
117
|
+
<code className="font-mono" /> // Monospace font
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Avoiding Common Mistakes
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
// ❌ AVOID: Conflicting classes
|
|
124
|
+
<div className="p-4 p-6" /> // Which one wins?
|
|
125
|
+
|
|
126
|
+
// ❌ AVOID: Redundant classes
|
|
127
|
+
<div className="flex flex-row" /> // flex-row is default
|
|
128
|
+
|
|
129
|
+
// ❌ AVOID: Inline styles when Tailwind works
|
|
130
|
+
<div style={{ padding: '16px' }} /> // Use className="p-4"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Styling Checklist
|
|
134
|
+
|
|
135
|
+
Before committing styled components, verify:
|
|
136
|
+
|
|
137
|
+
- [ ] Using semantic color tokens (not hardcoded)
|
|
138
|
+
- [ ] Using `cn()` for conditional classes
|
|
139
|
+
- [ ] Mobile-first responsive design
|
|
140
|
+
- [ ] Consistent spacing from Tailwind scale
|
|
141
|
+
- [ ] shadcn/ui components imported correctly
|
|
142
|
+
- [ ] No conflicting or redundant classes
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Language policy (English-only for technical content), documentation standards, commit messages, and PR conventions for Silver Assist plugins
|
|
3
|
+
name: Documentation & Language Policy
|
|
4
|
+
applyTo: "**"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Documentation & Language Policy — Silver Assist Plugins
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Language Policy
|
|
12
|
+
|
|
13
|
+
### English-Only Rule
|
|
14
|
+
|
|
15
|
+
**ALL technical project files MUST be written in ENGLISH:**
|
|
16
|
+
|
|
17
|
+
- Code comments (PHP, JavaScript, CSS)
|
|
18
|
+
- Documentation files (`.md`)
|
|
19
|
+
- Commit messages
|
|
20
|
+
- Pull Request descriptions
|
|
21
|
+
- Issue descriptions
|
|
22
|
+
- GitHub Actions workflows (`.yml`)
|
|
23
|
+
- Scripts (`.sh`, `.php`)
|
|
24
|
+
- README files
|
|
25
|
+
- Code variable/function names
|
|
26
|
+
|
|
27
|
+
**Exception — Spanish allowed:**
|
|
28
|
+
- User-facing content in WordPress admin (translation files `.pot`, `.po`)
|
|
29
|
+
- Content entered by end users
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Documentation Standards
|
|
34
|
+
|
|
35
|
+
### File Naming
|
|
36
|
+
|
|
37
|
+
- Major docs: `UPPERCASE.md` (README, CHANGELOG, LICENSE, CONTRIBUTING)
|
|
38
|
+
- Specific guides: `lowercase-with-hyphens.md`
|
|
39
|
+
- Always use `.md` extension, no spaces
|
|
40
|
+
|
|
41
|
+
### Markdown Best Practices
|
|
42
|
+
|
|
43
|
+
- One `# H1` per file (document title)
|
|
44
|
+
- Specify language in code blocks (```php, ```bash)
|
|
45
|
+
- Use `**Bold**` for important terms, `` `code` `` for inline code
|
|
46
|
+
- Use numbered lists for sequential steps, bullet lists for non-sequential
|
|
47
|
+
|
|
48
|
+
### Callout Conventions
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
**⚠️ WARNING**: Important warning message
|
|
52
|
+
**✅ TIP**: Best practice
|
|
53
|
+
**❌ AVOID**: Things to avoid
|
|
54
|
+
**🔥 CRITICAL**: Critical information
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Commit Message Standards (Conventional Commits)
|
|
60
|
+
|
|
61
|
+
### Format
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
type(scope): brief description
|
|
65
|
+
|
|
66
|
+
Detailed explanation (optional)
|
|
67
|
+
|
|
68
|
+
Closes #issue-number (if applicable)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Types
|
|
72
|
+
|
|
73
|
+
| Type | Usage | Example |
|
|
74
|
+
|------|-------|---------|
|
|
75
|
+
| `feat` | New features | `feat: Add search by sender name` |
|
|
76
|
+
| `fix` | Bug fixes | `fix: Resolve N+1 query in log table` |
|
|
77
|
+
| `docs` | Documentation only | `docs: Update README with new features` |
|
|
78
|
+
| `style` | Code style (no logic change) | `style: Format PHP files with PHPCS` |
|
|
79
|
+
| `refactor` | Code refactoring | `refactor: Extract LogWriter from RequestLogger` |
|
|
80
|
+
| `perf` | Performance improvements | `perf: Cache resolved error IDs` |
|
|
81
|
+
| `test` | Add or update tests | `test: Add unit tests for sender search` |
|
|
82
|
+
| `build` | Build system changes | `build: Update composer dependencies` |
|
|
83
|
+
| `ci` | CI/CD changes | `ci: Pin actions to SHA hashes` |
|
|
84
|
+
| `chore` | Maintenance tasks | `chore: Update dependencies` |
|
|
85
|
+
|
|
86
|
+
### Examples
|
|
87
|
+
|
|
88
|
+
**Good:**
|
|
89
|
+
```
|
|
90
|
+
feat: Add unresolved errors filter with resolved badge
|
|
91
|
+
|
|
92
|
+
- Add "Unresolved" tab in logs table
|
|
93
|
+
- Show green "Resolved" badge for errors with successful retry
|
|
94
|
+
- Cache resolved IDs to prevent N+1 queries
|
|
95
|
+
|
|
96
|
+
Closes #56
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Bad:**
|
|
100
|
+
```
|
|
101
|
+
updates
|
|
102
|
+
Fixed bug
|
|
103
|
+
Added new feature
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Jira-Based Commits (WordPress Website Projects)
|
|
109
|
+
|
|
110
|
+
For WordPress website backend projects (aa-wp, familyassets-wp, osa-wp, assistedlivingorg-wp), use Jira ticket prefixes:
|
|
111
|
+
|
|
112
|
+
### Format
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
WEB-XXX: Brief description
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Examples
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Good
|
|
122
|
+
WEB-726: Setup WordPress 6.8.2 headless backend with Docker
|
|
123
|
+
WEB-734: Fix GraphQL query error in nextjs-graphql-hooks plugin
|
|
124
|
+
WEB-740: Add Elementor integration for headless CMS
|
|
125
|
+
WEB-758: Update Docker configuration for PHP 8.3
|
|
126
|
+
|
|
127
|
+
# Bad
|
|
128
|
+
updates
|
|
129
|
+
Fixed bug
|
|
130
|
+
WEB-726 (missing colon)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Branch Naming
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
feature/WEB-XXX-description # New features
|
|
137
|
+
bugfix/WEB-XXX-description # Bug fixes
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Protected Branches (Never Commit Directly)
|
|
141
|
+
|
|
142
|
+
- `main`, `master`, `dev`, `stg`, `staging`
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Pull Request Standards
|
|
147
|
+
|
|
148
|
+
### PR Title
|
|
149
|
+
|
|
150
|
+
Same convention as commit messages: `type: brief description`
|
|
151
|
+
|
|
152
|
+
### PR Description Template
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
## Description
|
|
156
|
+
Brief summary of changes (1-2 sentences).
|
|
157
|
+
|
|
158
|
+
## Changes
|
|
159
|
+
- Specific change 1
|
|
160
|
+
- Specific change 2
|
|
161
|
+
|
|
162
|
+
## Testing
|
|
163
|
+
- [ ] PHPCS passes (0 errors)
|
|
164
|
+
- [ ] PHPStan Level 8 passes
|
|
165
|
+
- [ ] Unit tests pass
|
|
166
|
+
- [ ] Integration tests pass
|
|
167
|
+
|
|
168
|
+
## Related Issues
|
|
169
|
+
Closes #issue-number
|
|
170
|
+
|
|
171
|
+
## Checklist
|
|
172
|
+
- [ ] Code follows WordPress Coding Standards
|
|
173
|
+
- [ ] Documentation updated
|
|
174
|
+
- [ ] Tests added/updated
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Code Comments Standards
|
|
180
|
+
|
|
181
|
+
### Class Headers
|
|
182
|
+
|
|
183
|
+
```php
|
|
184
|
+
/**
|
|
185
|
+
* Class description.
|
|
186
|
+
*
|
|
187
|
+
* @since X.Y.Z
|
|
188
|
+
*/
|
|
189
|
+
class ClassName {
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Method/Function Comments
|
|
194
|
+
|
|
195
|
+
```php
|
|
196
|
+
/**
|
|
197
|
+
* Brief description of what the method does.
|
|
198
|
+
*
|
|
199
|
+
* @since X.Y.Z
|
|
200
|
+
*
|
|
201
|
+
* @param string $param1 Description.
|
|
202
|
+
* @param array $param2 Description.
|
|
203
|
+
* @return bool True on success, false on failure.
|
|
204
|
+
*/
|
|
205
|
+
public function method_name( string $param1, array $param2 ): bool {
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Inline Comments
|
|
210
|
+
|
|
211
|
+
```php
|
|
212
|
+
// Single-line comment ending with period.
|
|
213
|
+
|
|
214
|
+
// TODO: Future enhancement description.
|
|
215
|
+
// FIXME: Known issue that needs fixing.
|
|
216
|
+
```
|