agents-templated 2.2.1 → 2.2.3
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/package.json +1 -1
- package/templates/.claude/rules/ai-integration.mdc +60 -0
- package/templates/.claude/rules/core.mdc +180 -0
- package/templates/.claude/rules/database.mdc +291 -0
- package/templates/.claude/rules/frontend.mdc +224 -0
- package/templates/.claude/rules/guardrails.mdc +105 -0
- package/templates/.claude/rules/hardening.mdc +58 -0
- package/templates/.claude/rules/intent-routing.mdc +59 -0
- package/templates/.claude/rules/planning.mdc +75 -0
- package/templates/.claude/rules/security.mdc +286 -0
- package/templates/.claude/rules/style.mdc +306 -0
- package/templates/.claude/rules/system-workflow.mdc +69 -0
- package/templates/.claude/rules/testing.mdc +308 -0
- package/templates/.claude/rules/workflows.mdc +61 -0
- package/templates/CLAUDE.md +27 -27
- package/templates/agents/rules/ai-integration.mdc +10 -2
- package/templates/agents/rules/core.mdc +8 -1
- package/templates/agents/rules/database.mdc +10 -2
- package/templates/agents/rules/frontend.mdc +10 -2
- package/templates/agents/rules/guardrails.mdc +10 -2
- package/templates/agents/rules/hardening.mdc +10 -2
- package/templates/agents/rules/intent-routing.mdc +10 -2
- package/templates/agents/rules/planning.mdc +10 -2
- package/templates/agents/rules/security.mdc +11 -2
- package/templates/agents/rules/style.mdc +10 -2
- package/templates/agents/rules/system-workflow.mdc +10 -2
- package/templates/agents/rules/testing.mdc +9 -1
- package/templates/agents/rules/workflows.mdc +10 -2
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Testing Guidelines & Best Practices"
|
|
3
|
+
description: "Apply when adding tests, verifying coverage, or validating quality before deployment. Always required for business logic and critical flows"
|
|
4
|
+
version: "3.0.0"
|
|
5
|
+
tags: ["testing", "quality", "coverage", "e2e", "a11y"]
|
|
6
|
+
triggers:
|
|
7
|
+
- "User requests tests for business logic"
|
|
8
|
+
- "Implementing a new feature"
|
|
9
|
+
- "Fixing a bug"
|
|
10
|
+
- "Need to verify API endpoints work"
|
|
11
|
+
- "Checking application behavior"
|
|
12
|
+
- "Hardening release artifacts"
|
|
13
|
+
- "CI/CD validation needed before deployment"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Testing Guidelines & Best Practices
|
|
17
|
+
|
|
18
|
+
Comprehensive testing patterns for maintaining quality across any technology stack.
|
|
19
|
+
|
|
20
|
+
## Core Testing Principles
|
|
21
|
+
|
|
22
|
+
- **Test Pyramid**: More unit tests (80%), fewer integration tests (15%), minimal E2E tests (5%)
|
|
23
|
+
- **Arrange-Act-Assert**: Structure tests clearly with setup, action, and verification
|
|
24
|
+
- **Descriptive Names**: Test names should describe expected behavior
|
|
25
|
+
- **Independent Tests**: Each test should be able to run in isolation
|
|
26
|
+
- **Fast Feedback**: Unit tests should run quickly (<100ms each)
|
|
27
|
+
- **Deterministic**: Tests should pass/fail consistently, not randomly
|
|
28
|
+
|
|
29
|
+
## Unit Testing
|
|
30
|
+
|
|
31
|
+
Unit tests verify individual functions, methods, and components in isolation.
|
|
32
|
+
|
|
33
|
+
### Unit Test Pattern
|
|
34
|
+
|
|
35
|
+
Unit Test Structure:
|
|
36
|
+
1. Arrange
|
|
37
|
+
- Set up test data
|
|
38
|
+
- Mock dependencies
|
|
39
|
+
- Configure test environment
|
|
40
|
+
|
|
41
|
+
2. Act
|
|
42
|
+
- Call the function/method being tested
|
|
43
|
+
- Perform the action
|
|
44
|
+
|
|
45
|
+
3. Assert
|
|
46
|
+
- Verify the result
|
|
47
|
+
- Check side effects
|
|
48
|
+
- Validate behavior
|
|
49
|
+
|
|
50
|
+
### What to Unit Test
|
|
51
|
+
|
|
52
|
+
- Business logic functions (validation, calculations, transformations)
|
|
53
|
+
- Utility functions (helpers, formatters, parsers)
|
|
54
|
+
- Service/class methods with clear inputs and outputs
|
|
55
|
+
- Error handling and edge cases
|
|
56
|
+
- Complex conditional logic
|
|
57
|
+
|
|
58
|
+
### Unit Test Examples (Language-Agnostic)
|
|
59
|
+
|
|
60
|
+
**Example 1: Validation Function**
|
|
61
|
+
Test: Email validation function
|
|
62
|
+
- Test valid email returns true
|
|
63
|
+
- Test invalid email format returns false
|
|
64
|
+
- Test empty string returns false
|
|
65
|
+
- Test whitespace is trimmed
|
|
66
|
+
- Test case-insensitive comparison
|
|
67
|
+
|
|
68
|
+
**Example 2: Business Logic**
|
|
69
|
+
Test: Calculate discount price
|
|
70
|
+
- Test standard discount percentage
|
|
71
|
+
- Test no discount
|
|
72
|
+
- Test maximum discount cap
|
|
73
|
+
- Test negative prices handled gracefully
|
|
74
|
+
- Test rounding is correct
|
|
75
|
+
|
|
76
|
+
**Example 3: Error Handling**
|
|
77
|
+
Test: Parse JSON data
|
|
78
|
+
- Test valid JSON parses successfully
|
|
79
|
+
- Test invalid JSON throws appropriate error
|
|
80
|
+
- Test missing required fields throws error
|
|
81
|
+
- Test extra fields are handled
|
|
82
|
+
- Test error messages are helpful
|
|
83
|
+
|
|
84
|
+
### Mocking & Test Doubles
|
|
85
|
+
|
|
86
|
+
Use test doubles (mocks, stubs, fakes) for external dependencies:
|
|
87
|
+
|
|
88
|
+
Mocking Strategy:
|
|
89
|
+
1. Identify external dependencies
|
|
90
|
+
- Database calls
|
|
91
|
+
- API calls
|
|
92
|
+
- File system access
|
|
93
|
+
- Time/date functions
|
|
94
|
+
- Random number generation
|
|
95
|
+
|
|
96
|
+
2. Replace with appropriate test double
|
|
97
|
+
- Stub: Return fixed value
|
|
98
|
+
- Mock: Verify it was called correctly
|
|
99
|
+
- Fake: Simplified working implementation
|
|
100
|
+
|
|
101
|
+
3. Verify interactions when appropriate
|
|
102
|
+
- Was the dependency called?
|
|
103
|
+
- Was it called with correct arguments?
|
|
104
|
+
- Was it called the right number of times?
|
|
105
|
+
|
|
106
|
+
## Integration Testing
|
|
107
|
+
|
|
108
|
+
Integration tests verify that multiple components work together correctly.
|
|
109
|
+
|
|
110
|
+
### What to Integration Test
|
|
111
|
+
|
|
112
|
+
- API endpoints (request response)
|
|
113
|
+
- Database operations (save, query, delete)
|
|
114
|
+
- Service-to-service interactions
|
|
115
|
+
- Authentication and authorization flows
|
|
116
|
+
- Error scenarios and edge cases
|
|
117
|
+
|
|
118
|
+
### Integration Test Pattern
|
|
119
|
+
|
|
120
|
+
Integration Test Structure:
|
|
121
|
+
1. Setup
|
|
122
|
+
- Create test database/data
|
|
123
|
+
- Mock external services if needed
|
|
124
|
+
- Set up test user/session
|
|
125
|
+
|
|
126
|
+
2. Execute
|
|
127
|
+
- Make API call or trigger operation
|
|
128
|
+
- Interact with multiple components
|
|
129
|
+
|
|
130
|
+
3. Verify
|
|
131
|
+
- Check response status and data
|
|
132
|
+
- Verify database changes
|
|
133
|
+
- Check side effects
|
|
134
|
+
|
|
135
|
+
### Integration Test Examples
|
|
136
|
+
|
|
137
|
+
**Example 1: User Creation API**
|
|
138
|
+
Test: POST /api/users with valid data
|
|
139
|
+
- Validate request body
|
|
140
|
+
- Create user in database
|
|
141
|
+
- Return created user with ID
|
|
142
|
+
- User can be retrieved afterward
|
|
143
|
+
- Password is hashed (not plaintext)
|
|
144
|
+
|
|
145
|
+
**Example 2: Authentication Flow**
|
|
146
|
+
Test: User login
|
|
147
|
+
- Validate credentials
|
|
148
|
+
- Create session/token
|
|
149
|
+
- Return session/token to client
|
|
150
|
+
- Can use session to access protected endpoints
|
|
151
|
+
- Session is invalidated on logout
|
|
152
|
+
|
|
153
|
+
**Example 3: Error Handling**
|
|
154
|
+
Test: Create user with duplicate email
|
|
155
|
+
- Database rejects duplicate
|
|
156
|
+
- API returns 400 Bad Request
|
|
157
|
+
- Error message is appropriate
|
|
158
|
+
- No partial data is written
|
|
159
|
+
|
|
160
|
+
## End-to-End Testing
|
|
161
|
+
|
|
162
|
+
E2E tests verify complete user journeys across the entire application.
|
|
163
|
+
|
|
164
|
+
### What to E2E Test
|
|
165
|
+
|
|
166
|
+
- Critical user workflows (login, purchase, form submission)
|
|
167
|
+
- Happy path scenarios
|
|
168
|
+
- Common error scenarios
|
|
169
|
+
- Cross-browser compatibility (if applicable)
|
|
170
|
+
- Accessibility requirements
|
|
171
|
+
|
|
172
|
+
### E2E Test Examples
|
|
173
|
+
|
|
174
|
+
**Example 1: User Registration**
|
|
175
|
+
Test: New user can register successfully
|
|
176
|
+
1. Navigate to signup page
|
|
177
|
+
2. Fill in email, password, name
|
|
178
|
+
3. Click submit button
|
|
179
|
+
4. Wait for success message
|
|
180
|
+
5. Redirect to dashboard
|
|
181
|
+
6. User can access protected content
|
|
182
|
+
|
|
183
|
+
**Example 2: Login with Invalid Credentials**
|
|
184
|
+
Test: Login with wrong password
|
|
185
|
+
1. Navigate to login page
|
|
186
|
+
2. Enter email and wrong password
|
|
187
|
+
3. Click login button
|
|
188
|
+
4. See error message "Invalid credentials"
|
|
189
|
+
5. Still on login page (not redirected)
|
|
190
|
+
6. Can try again
|
|
191
|
+
|
|
192
|
+
**Example 3: Multi-step Workflow**
|
|
193
|
+
Test: User can complete purchase
|
|
194
|
+
1. Navigate to product page
|
|
195
|
+
2. Add item to cart
|
|
196
|
+
3. Navigate to checkout
|
|
197
|
+
4. Enter shipping information
|
|
198
|
+
5. Enter payment information
|
|
199
|
+
6. Submit order
|
|
200
|
+
7. See confirmation page
|
|
201
|
+
8. Receive confirmation email
|
|
202
|
+
|
|
203
|
+
## Accessibility Testing
|
|
204
|
+
|
|
205
|
+
Test that your application meets WCAG 2.1 AA standards.
|
|
206
|
+
|
|
207
|
+
### Automated Accessibility Testing
|
|
208
|
+
|
|
209
|
+
Use tools to scan for common accessibility violations:
|
|
210
|
+
- Color contrast issues
|
|
211
|
+
- Missing alt text for images
|
|
212
|
+
- Missing labels for form inputs
|
|
213
|
+
- Heading hierarchy problems
|
|
214
|
+
- Missing ARIA attributes
|
|
215
|
+
|
|
216
|
+
### Manual Accessibility Testing
|
|
217
|
+
|
|
218
|
+
- Keyboard navigation: Can user navigate with Tab and Enter?
|
|
219
|
+
- Screen reader: Does content make sense when read aloud?
|
|
220
|
+
- Visual clarity: Can text be read at smaller sizes?
|
|
221
|
+
- Color dependency: Is information conveyed without color alone?
|
|
222
|
+
- Responsiveness: Does layout work on different screen sizes?
|
|
223
|
+
|
|
224
|
+
## Performance Testing
|
|
225
|
+
|
|
226
|
+
Test performance requirements and regressions.
|
|
227
|
+
|
|
228
|
+
### Performance Metrics to Monitor
|
|
229
|
+
|
|
230
|
+
**Web Applications:**
|
|
231
|
+
- First Contentful Paint (FCP)
|
|
232
|
+
- Largest Contentful Paint (LCP)
|
|
233
|
+
- Cumulative Layout Shift (CLS)
|
|
234
|
+
- Time to Interactive (TTI)
|
|
235
|
+
- Page load time
|
|
236
|
+
|
|
237
|
+
**API Endpoints:**
|
|
238
|
+
- Response time (p50, p95, p99)
|
|
239
|
+
- Throughput (requests per second)
|
|
240
|
+
- Error rate
|
|
241
|
+
- Database query time
|
|
242
|
+
- Memory usage
|
|
243
|
+
|
|
244
|
+
### Performance Testing Examples
|
|
245
|
+
|
|
246
|
+
Test: API response time
|
|
247
|
+
- Create 100 users in database
|
|
248
|
+
- Query all users endpoint
|
|
249
|
+
- Measure response time
|
|
250
|
+
- Assert completes in <500ms
|
|
251
|
+
|
|
252
|
+
Test: Page load performance
|
|
253
|
+
- Navigate to homepage
|
|
254
|
+
- Measure First Contentful Paint
|
|
255
|
+
- Assert completes in <2 seconds
|
|
256
|
+
|
|
257
|
+
Test: Database query optimization
|
|
258
|
+
- Insert 10,000 records
|
|
259
|
+
- Run query with filter
|
|
260
|
+
- Verify query uses index
|
|
261
|
+
- Measure execution time
|
|
262
|
+
- Assert completes efficiently
|
|
263
|
+
|
|
264
|
+
## Hardening Verification Testing
|
|
265
|
+
|
|
266
|
+
When hardening/obfuscation is enabled (see `.claude/rules/hardening.mdc`), require additional validation on hardened artifacts.
|
|
267
|
+
|
|
268
|
+
### Required Checks for Hardened Builds
|
|
269
|
+
|
|
270
|
+
- Run core functional regression tests against hardened output, not only non-hardened builds.
|
|
271
|
+
- Run performance checks and compare against accepted budgets (startup, latency, memory as applicable).
|
|
272
|
+
- Validate crash/debug workflow with restricted symbol/mapping artifact access controls.
|
|
273
|
+
- Confirm release evidence includes hardening profile rationale and rollback trigger/steps.
|
|
274
|
+
|
|
275
|
+
If these checks are missing for a hardening-required profile, release readiness should be treated as blocked.
|
|
276
|
+
|
|
277
|
+
## Security Testing
|
|
278
|
+
|
|
279
|
+
Test security requirements and threat scenarios.
|
|
280
|
+
|
|
281
|
+
### Security Tests
|
|
282
|
+
|
|
283
|
+
Test: Input Validation
|
|
284
|
+
- SQL injection payloads in fields
|
|
285
|
+
- XSS payloads in fields
|
|
286
|
+
- Extremely long strings
|
|
287
|
+
- Special characters
|
|
288
|
+
- Wrong data types
|
|
289
|
+
|
|
290
|
+
Test: Authentication
|
|
291
|
+
- Login with wrong password
|
|
292
|
+
- Access protected endpoint without credentials
|
|
293
|
+
- Use expired token
|
|
294
|
+
- Use modified token
|
|
295
|
+
|
|
296
|
+
Test: Authorization
|
|
297
|
+
- Access another user's data
|
|
298
|
+
- Perform admin operation as regular user
|
|
299
|
+
- Modify resource of different user
|
|
300
|
+
|
|
301
|
+
Test: Rate Limiting
|
|
302
|
+
- Exceed rate limit on authentication
|
|
303
|
+
- Verify 429 response
|
|
304
|
+
- Verify retry-after header
|
|
305
|
+
|
|
306
|
+
## Test Organization
|
|
307
|
+
|
|
308
|
+
Organize tests logically for easy maintenance:
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Development Workflow Guidelines"
|
|
3
|
+
description: "Apply when optimizing development process, running pre-commit checks, or keeping project healthy"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
tags: ["workflow", "quality", "validation", "commit"]
|
|
7
|
+
globs:
|
|
8
|
+
- "**/*"
|
|
9
|
+
triggers:
|
|
10
|
+
- "User asks about workflow or pre-commit steps"
|
|
11
|
+
- "Need to keep project validated"
|
|
12
|
+
- "Running quality gates before merge"
|
|
13
|
+
- "Post-hardening verification needed"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Development Workflow Guidelines
|
|
17
|
+
|
|
18
|
+
Technology-agnostic suggestions for keeping the project healthy and maintaining quality before commits.
|
|
19
|
+
|
|
20
|
+
## When This Rule Applies
|
|
21
|
+
|
|
22
|
+
Use this guidance when the user asks about workflow, pre-commit checks, or keeping the project validated. Do not force these steps on every change—treat them as recommended practices.
|
|
23
|
+
|
|
24
|
+
## Project Health (agents-templated)
|
|
25
|
+
|
|
26
|
+
If this project was scaffolded with agents-templated:
|
|
27
|
+
|
|
28
|
+
- **Periodically**: Run `agents-templated validate` to ensure required docs and rules are present; run `agents-templated doctor` for environment and configuration recommendations.
|
|
29
|
+
- **After pulling template updates**: Run `agents-templated update --check-only` to see available updates, then `agents-templated update` if you want to apply them (with backup).
|
|
30
|
+
|
|
31
|
+
These commands help keep agent rules, documentation, and security patterns in sync.
|
|
32
|
+
|
|
33
|
+
## Pre-Commit Quality Gates
|
|
34
|
+
|
|
35
|
+
Before committing, consider running (in order):
|
|
36
|
+
|
|
37
|
+
1. **Lint** – Your stack's linter (e.g. ESLint, Pylint, golangci-lint) to catch style and simple issues.
|
|
38
|
+
2. **Type check** – If applicable (TypeScript, mypy, etc.) to catch type errors.
|
|
39
|
+
3. **Tests** – At least the fast test suite (e.g. unit tests) so regressions are caught early.
|
|
40
|
+
4. **Project validation** – For agents-templated projects, `agents-templated validate` can confirm setup is intact.
|
|
41
|
+
|
|
42
|
+
For high-risk or distributed-client releases, add hardening-specific checks before merge/release:
|
|
43
|
+
|
|
44
|
+
5. **Hardening profile selection** – Document threat model and selected profile from `.claude/rules/hardening.mdc`.
|
|
45
|
+
6. **Post-hardening verification** – Run functional regression and performance checks on hardened artifacts.
|
|
46
|
+
7. **Artifact controls** – Verify restricted handling for symbol/mapping/debug artifacts and confirm rollback path.
|
|
47
|
+
|
|
48
|
+
Do not commit with failing lint or tests unless the user explicitly requests a WIP commit (e.g. with `--no-verify` or a clear "work in progress" message).
|
|
49
|
+
|
|
50
|
+
## Commit Messages
|
|
51
|
+
|
|
52
|
+
- Prefer clear, descriptive messages (e.g. conventional commits: `feat:`, `fix:`, `docs:`).
|
|
53
|
+
- Reference issues or tickets when relevant (e.g. "Closes #123").
|
|
54
|
+
- Keep the body focused on what changed and why, not how.
|
|
55
|
+
|
|
56
|
+
## Summary
|
|
57
|
+
|
|
58
|
+
- Use **agents-templated validate** and **doctor** to maintain project setup and get recommendations.
|
|
59
|
+
- Run **lint**, **type check**, and **tests** before committing when possible.
|
|
60
|
+
- For hardening-required releases, include profile rationale, post-hardening verification evidence, and rollback readiness.
|
|
61
|
+
- Write clear commit messages and reference issues where applicable.
|
package/templates/CLAUDE.md
CHANGED
|
@@ -7,23 +7,23 @@ All policy, routing, and skill governance lives here — edit this file directly
|
|
|
7
7
|
|
|
8
8
|
## Reference Index
|
|
9
9
|
|
|
10
|
-
### Rule modules (`.
|
|
11
|
-
|
|
12
|
-
| Module | File |
|
|
13
|
-
|
|
14
|
-
| Security | `.
|
|
15
|
-
| Testing | `.
|
|
16
|
-
| Core | `.
|
|
17
|
-
| Database | `.
|
|
18
|
-
| Frontend | `.
|
|
19
|
-
| Style | `.
|
|
20
|
-
| System Workflow | `.
|
|
21
|
-
| Workflows | `.
|
|
22
|
-
| Hardening | `.
|
|
23
|
-
| Intent Routing | `.
|
|
24
|
-
| Planning | `.
|
|
25
|
-
| AI Integration | `.
|
|
26
|
-
| Guardrails | `.
|
|
10
|
+
### Rule modules (`.claude/rules/`)
|
|
11
|
+
|
|
12
|
+
| Module | File | Apply when... |
|
|
13
|
+
|--------|------|---------------|
|
|
14
|
+
| Security | `.claude/rules/security.mdc` | Implementing authentication, validating inputs, protecting against injection attacks |
|
|
15
|
+
| Testing | `.claude/rules/testing.mdc` | Adding tests, verifying coverage, validating quality before deployment |
|
|
16
|
+
| Core | `.claude/rules/core.mdc` | Designing architecture, setting up projects, defining type systems |
|
|
17
|
+
| Database | `.claude/rules/database.mdc` | Designing schema, building data access layers, optimizing queries |
|
|
18
|
+
| Frontend | `.claude/rules/frontend.mdc` | Building UI components, designing pages, creating forms, implementing accessibility |
|
|
19
|
+
| Style | `.claude/rules/style.mdc` | Organizing code, naming variables, improving clarity and maintainability |
|
|
20
|
+
| System Workflow | `.claude/rules/system-workflow.mdc` | Planning delivery phases, defining acceptance criteria, establishing rollback |
|
|
21
|
+
| Workflows | `.claude/rules/workflows.mdc` | Optimizing development process, running pre-commit checks, keeping project healthy |
|
|
22
|
+
| Hardening | `.claude/rules/hardening.mdc` | Building distributed apps, protecting IP logic, preparing production releases |
|
|
23
|
+
| Intent Routing | `.claude/rules/intent-routing.mdc` | Determining which rule applies, routing to correct execution pathway |
|
|
24
|
+
| Planning | `.claude/rules/planning.mdc` | Implementing features, designing systems, making architectural decisions |
|
|
25
|
+
| AI Integration | `.claude/rules/ai-integration.mdc` | Integrating LLMs, RAG pipelines, prompt engineering, AI-powered features |
|
|
26
|
+
| Guardrails | `.claude/rules/guardrails.mdc` | Any destructive/irreversible action, scope expansion, dangerous requests |
|
|
27
27
|
|
|
28
28
|
### Skill modules (`.github/skills/`)
|
|
29
29
|
|
|
@@ -59,40 +59,40 @@ Subagents are bounded agents with limited tool access. They inherit all policy f
|
|
|
59
59
|
|
|
60
60
|
## Always Enforce
|
|
61
61
|
|
|
62
|
-
1. **Security-first (non-overrideable)** — `.
|
|
62
|
+
1. **Security-first (non-overrideable)** — `.claude/rules/security.mdc`
|
|
63
63
|
- Validate all external inputs at boundaries.
|
|
64
64
|
- Require authentication and role-based authorization for protected operations.
|
|
65
65
|
- Rate-limit public APIs.
|
|
66
66
|
- Never expose secrets, credentials, or PII in logs/errors/responses.
|
|
67
67
|
|
|
68
|
-
2. **Testing discipline (non-overrideable)** — `.
|
|
68
|
+
2. **Testing discipline (non-overrideable)** — `.claude/rules/testing.mdc`
|
|
69
69
|
- Coverage mix target: Unit 80% / Integration 15% / E2E 5%.
|
|
70
70
|
- Business logic must have tests; critical flows need integration coverage.
|
|
71
71
|
- Never disable/remove tests to pass builds.
|
|
72
72
|
|
|
73
|
-
3. **Type safety and runtime boundaries** — `.
|
|
73
|
+
3. **Type safety and runtime boundaries** — `.claude/rules/core.mdc`
|
|
74
74
|
- Strong internal typing, runtime validation at boundaries, explicit error models.
|
|
75
75
|
|
|
76
|
-
4. **Database integrity** — `.
|
|
76
|
+
4. **Database integrity** — `.claude/rules/database.mdc`
|
|
77
77
|
- Prefer ORM/ODM, justify raw queries, enforce DB constraints, prevent N+1, reversible migrations.
|
|
78
78
|
|
|
79
|
-
5. **Frontend standards** — `.
|
|
79
|
+
5. **Frontend standards** — `.claude/rules/frontend.mdc`
|
|
80
80
|
- WCAG 2.1 AA, responsive defaults, clear loading/error states, no unsafe client trust.
|
|
81
81
|
|
|
82
|
-
6. **Style and consistency** — `.
|
|
82
|
+
6. **Style and consistency** — `.claude/rules/style.mdc`
|
|
83
83
|
- Consistent naming, small composable modules, explicit contracts, no magic values.
|
|
84
84
|
|
|
85
|
-
7. **Workflow discipline** — `.
|
|
85
|
+
7. **Workflow discipline** — `.claude/rules/system-workflow.mdc`, `.claude/rules/workflows.mdc`
|
|
86
86
|
- Feature branches only, no direct main edits, deterministic PR structure, review gates.
|
|
87
87
|
|
|
88
|
-
8. **Hardening mode** — `.
|
|
88
|
+
8. **Hardening mode** — `.claude/rules/hardening.mdc`
|
|
89
89
|
- In hardening/audit contexts: assume hostile input, threat-model, validate config safety, strict rate limits, dependency audit.
|
|
90
90
|
|
|
91
|
-
9. **Planning discipline** — `.
|
|
91
|
+
9. **Planning discipline** — `.claude/rules/planning.mdc`
|
|
92
92
|
- Every feature discussion or implementation produces a `.github/prompts/` plan file.
|
|
93
93
|
- Plans are updated as work progresses, not discarded.
|
|
94
94
|
|
|
95
|
-
10. **Guardrails (non-overrideable)** — `.
|
|
95
|
+
10. **Guardrails (non-overrideable)** — `.claude/rules/guardrails.mdc`
|
|
96
96
|
- Require `CONFIRM-DESTRUCTIVE:<target>` token before any destructive/irreversible action.
|
|
97
97
|
- Work only within the defined task scope; no silent expansion.
|
|
98
98
|
- Classify every action by reversibility before executing.
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "AI / LLM Integration"
|
|
3
|
-
description: "
|
|
4
|
-
version: "
|
|
3
|
+
description: "Apply when integrating LLMs, RAG pipelines, prompt engineering, or building AI-powered features. Covers safety, cost, and quality"
|
|
4
|
+
version: "3.0.0"
|
|
5
5
|
tags: ["ai", "llm", "openai", "anthropic", "rag", "prompt-engineering", "safety"]
|
|
6
6
|
alwaysApply: false
|
|
7
7
|
globs: ["**/*llm*", "**/*openai*", "**/*anthropic*", "**/*langchain*", "**/*rag*", "**/ai/**"]
|
|
8
|
+
triggers:
|
|
9
|
+
- "Integrating OpenAI or other LLM API"
|
|
10
|
+
- "Building RAG pipeline or semantic search"
|
|
11
|
+
- "Implementing prompt template or engineering"
|
|
12
|
+
- "Adding AI-powered feature to application"
|
|
13
|
+
- "Evaluating LLM responses or quality"
|
|
14
|
+
- "Optimizing LLM API costs"
|
|
15
|
+
- "Implementing AI moderation or safety controls"
|
|
8
16
|
---
|
|
9
17
|
|
|
10
18
|
## Purpose
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Core Project Guidelines"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Apply to all architecture, type safety, code organization, and enterprise quality standards. Foundation for every feature"
|
|
4
4
|
alwaysApply: true
|
|
5
5
|
version: "3.0.0"
|
|
6
6
|
tags: ["architecture", "core", "enterprise", "technology-agnostic"]
|
|
7
7
|
globs:
|
|
8
8
|
- "*"
|
|
9
|
+
triggers:
|
|
10
|
+
- "Designing application architecture"
|
|
11
|
+
- "Setting up new project or module"
|
|
12
|
+
- "Defining type systems and validation"
|
|
13
|
+
- "Organizing code structure"
|
|
14
|
+
- "Improving code quality standards"
|
|
15
|
+
- "Making testing or performance decisions"
|
|
9
16
|
---
|
|
10
17
|
|
|
11
18
|
## Developer Identity
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Database and Data Layer Guidelines"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Apply when designing schema, building data access layers, optimizing queries, or managing database operations"
|
|
4
4
|
alwaysApply: true
|
|
5
5
|
version: "3.0.0"
|
|
6
6
|
tags: ["database", "backend", "data", "orm", "schema"]
|
|
7
7
|
globs:
|
|
8
8
|
- "src/models/**/*"
|
|
9
9
|
- "src/data/**/*"
|
|
10
|
+
triggers:
|
|
11
|
+
- "Designing database schema"
|
|
12
|
+
- "Adding database migrations"
|
|
13
|
+
- "Building data access layer"
|
|
14
|
+
- "Querying or filtering data"
|
|
15
|
+
- "Optimizing slow queries"
|
|
16
|
+
- "Managing relationships between entities"
|
|
17
|
+
- "Handling data validation in models"
|
|
10
18
|
---
|
|
11
19
|
|
|
12
20
|
# Database and Data Layer Guidelines
|
|
@@ -302,4 +310,4 @@ Test: Cascade delete
|
|
|
302
310
|
|
|
303
311
|
---
|
|
304
312
|
|
|
305
|
-
Remember: Good database design prevents bugs, improves performance, and makes your application maintainable.
|
|
313
|
+
Remember: Good database design prevents bugs, improves performance, and makes your application maintainable.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Frontend Development Guidelines"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Apply when building UI components, designing pages, creating forms, or implementing accessibility and responsive interfaces"
|
|
4
4
|
alwaysApply: true
|
|
5
5
|
version: "3.0.0"
|
|
6
6
|
tags: ["frontend", "ui", "ux", "security", "accessibility"]
|
|
@@ -8,6 +8,14 @@ globs:
|
|
|
8
8
|
- "src/**/*"
|
|
9
9
|
- "components/**/*"
|
|
10
10
|
- "public/**/*"
|
|
11
|
+
triggers:
|
|
12
|
+
- "Building UI components or pages"
|
|
13
|
+
- "Creating forms and handling user input"
|
|
14
|
+
- "Designing responsive layouts"
|
|
15
|
+
- "Implementing accessibility features"
|
|
16
|
+
- "Styling and theming interfaces"
|
|
17
|
+
- "Building navigation and routing"
|
|
18
|
+
- "Implementing client-side state management"
|
|
11
19
|
---
|
|
12
20
|
|
|
13
21
|
# Frontend Development Guidelines
|
|
@@ -214,4 +222,4 @@ E2E tests:
|
|
|
214
222
|
|
|
215
223
|
---
|
|
216
224
|
|
|
217
|
-
Remember: Build user interfaces that work for everyone, load quickly, and provide excellent user experience.
|
|
225
|
+
Remember: Build user interfaces that work for everyone, load quickly, and provide excellent user experience.
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
alwaysApply: true
|
|
3
3
|
title: "AI Agent Guardrails"
|
|
4
|
-
description: "
|
|
5
|
-
version: "
|
|
4
|
+
description: "Apply before any irreversible action, scope expansion, dangerous request, or system change. Safety constraints that cannot be weakened"
|
|
5
|
+
version: "3.0.0"
|
|
6
6
|
tags: ["guardrails", "safety", "scope", "reversibility", "agent-behavior"]
|
|
7
|
+
triggers:
|
|
8
|
+
- "Planning destructive or irreversible action"
|
|
9
|
+
- "Deleting files, databases, or deployment"
|
|
10
|
+
- "Modifying security or authentication"
|
|
11
|
+
- "Making scope expansion decisions"
|
|
12
|
+
- "Evaluating request safety and reversibility"
|
|
13
|
+
- "Handling secrets or sensitive data"
|
|
14
|
+
- "Making agent behavioral decisions"
|
|
7
15
|
---
|
|
8
16
|
|
|
9
17
|
## Purpose
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Application Hardening & Obfuscation"
|
|
3
|
-
description: "
|
|
4
|
-
version: "
|
|
3
|
+
description: "Apply when building distributed apps, protecting IP logic, preparing production releases, or hardening against reverse engineering"
|
|
4
|
+
version: "3.0.0"
|
|
5
5
|
tags: ["hardening", "obfuscation", "anti-tamper", "security"]
|
|
6
|
+
triggers:
|
|
7
|
+
- "Preparing mobile or desktop app for release"
|
|
8
|
+
- "Protecting proprietary business logic"
|
|
9
|
+
- "Hardening against reverse engineering"
|
|
10
|
+
- "Building distributed client applications"
|
|
11
|
+
- "Preparing production release with hardening"
|
|
12
|
+
- "Implementing tamper detection"
|
|
13
|
+
- "Adding integrity checks to release"
|
|
6
14
|
---
|
|
7
15
|
|
|
8
16
|
## Purpose
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Intent Routing & Command Selection"
|
|
3
|
-
description: "
|
|
4
|
-
version: "
|
|
3
|
+
description: "Apply when determining which rule applies, routing to correct execution pathway, or making command selection decisions"
|
|
4
|
+
version: "3.0.0"
|
|
5
5
|
tags: ["routing", "deterministic", "workflow", "commands"]
|
|
6
|
+
triggers:
|
|
7
|
+
- "User makes natural language request"
|
|
8
|
+
- "Determining which rule applies"
|
|
9
|
+
- "Routing to correct execution pathway"
|
|
10
|
+
- "Selecting command or agent to invoke"
|
|
11
|
+
- "Handling ambiguous user intent"
|
|
12
|
+
- "Making safety behavior decisions"
|
|
13
|
+
- "Validating action scope and appropriateness"
|
|
6
14
|
---
|
|
7
15
|
|
|
8
16
|
## Purpose
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Planning Discipline"
|
|
3
|
-
description: "
|
|
4
|
-
version: "
|
|
3
|
+
description: "Apply when implementing features, designing systems, discussing architecture, or making implementation decisions. Produces reusable prompt plan files"
|
|
4
|
+
version: "3.0.0"
|
|
5
5
|
tags: ["planning", "workflow", "documentation", "prompts"]
|
|
6
6
|
alwaysApply: true
|
|
7
|
+
triggers:
|
|
8
|
+
- "User requests a new feature"
|
|
9
|
+
- "Planning implementation approach"
|
|
10
|
+
- "Discussing architectural changes"
|
|
11
|
+
- "Breaking down user stories"
|
|
12
|
+
- "Creating acceptance criteria"
|
|
13
|
+
- "Designing database schema"
|
|
14
|
+
- "Planning deployment phases"
|
|
7
15
|
---
|
|
8
16
|
|
|
9
17
|
## Purpose
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Security Rules & Best Practices"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Apply when implementing authentication, authorization, API validation, secrets management, or protecting against OWASP Top 10 vulnerabilities"
|
|
4
|
+
alwaysApply: true
|
|
4
5
|
version: "3.0.0"
|
|
5
|
-
tags: ["security", "
|
|
6
|
+
tags: ["security", "auth", "validation", "secrets", "owasp"]
|
|
7
|
+
triggers:
|
|
8
|
+
- "User adds login/authentication to project"
|
|
9
|
+
- "Building API endpoints or handling user input"
|
|
10
|
+
- "Storing passwords, tokens, or sensitive data"
|
|
11
|
+
- "Validating form inputs or API requests"
|
|
12
|
+
- "Protecting against injection, XSS, CSRF"
|
|
13
|
+
- "Adding authorization/permissions to endpoints"
|
|
14
|
+
- "Integrating third-party APIs or external services"
|
|
6
15
|
---
|
|
7
16
|
|
|
8
17
|
# Security Rules & Best Practices
|