agents-templated 2.2.20 → 2.2.22

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.
Files changed (56) hide show
  1. package/package.json +2 -1
  2. package/templates/CLAUDE.md +17 -17
  3. package/templates/agents/commands/README.md +0 -144
  4. package/templates/agents/commands/SCHEMA.md +0 -42
  5. package/templates/agents/commands/arch-check.md +0 -58
  6. package/templates/agents/commands/audit.md +0 -58
  7. package/templates/agents/commands/debug-track.md +0 -58
  8. package/templates/agents/commands/docs.md +0 -58
  9. package/templates/agents/commands/fix.md +0 -58
  10. package/templates/agents/commands/learn-loop.md +0 -58
  11. package/templates/agents/commands/perf.md +0 -58
  12. package/templates/agents/commands/plan.md +0 -58
  13. package/templates/agents/commands/pr.md +0 -58
  14. package/templates/agents/commands/problem-map.md +0 -58
  15. package/templates/agents/commands/release-ready.md +0 -58
  16. package/templates/agents/commands/release.md +0 -58
  17. package/templates/agents/commands/risk-review.md +0 -58
  18. package/templates/agents/commands/scope-shape.md +0 -58
  19. package/templates/agents/commands/task.md +0 -58
  20. package/templates/agents/commands/test-data.md +0 -56
  21. package/templates/agents/commands/test.md +0 -58
  22. package/templates/agents/commands/ux-bar.md +0 -58
  23. package/templates/agents/rules/ai-integration.md +0 -54
  24. package/templates/agents/rules/core.md +0 -173
  25. package/templates/agents/rules/database.md +0 -305
  26. package/templates/agents/rules/frontend.md +0 -217
  27. package/templates/agents/rules/guardrails.md +0 -97
  28. package/templates/agents/rules/hardening.md +0 -52
  29. package/templates/agents/rules/intent-routing.md +0 -54
  30. package/templates/agents/rules/lessons-learned.md +0 -44
  31. package/templates/agents/rules/planning.md +0 -69
  32. package/templates/agents/rules/security.md +0 -278
  33. package/templates/agents/rules/style.md +0 -344
  34. package/templates/agents/rules/system-workflow.md +0 -63
  35. package/templates/agents/rules/testing.md +0 -371
  36. package/templates/agents/rules/workflows.md +0 -56
  37. package/templates/agents/skills/README.md +0 -198
  38. package/templates/agents/skills/api-design/SKILL.md +0 -59
  39. package/templates/agents/skills/app-hardening/SKILL.md +0 -45
  40. package/templates/agents/skills/bug-triage/SKILL.md +0 -36
  41. package/templates/agents/skills/debug-skill/SKILL.md +0 -39
  42. package/templates/agents/skills/emilkowalski-skill/SKILL.md +0 -51
  43. package/templates/agents/skills/error-patterns/SKILL.md +0 -70
  44. package/templates/agents/skills/feature-delivery/SKILL.md +0 -38
  45. package/templates/agents/skills/feature-forge/SKILL.md +0 -39
  46. package/templates/agents/skills/find-skills/SKILL.md +0 -133
  47. package/templates/agents/skills/llm-integration/SKILL.md +0 -64
  48. package/templates/agents/skills/raphaelsalaja-userinterface-wiki/SKILL.md +0 -51
  49. package/templates/agents/skills/secure-code-guardian/SKILL.md +0 -39
  50. package/templates/agents/skills/shadcn-ui/SKILL.md +0 -1932
  51. package/templates/agents/skills/shadcn-ui/references/chart.md +0 -306
  52. package/templates/agents/skills/shadcn-ui/references/learn.md +0 -145
  53. package/templates/agents/skills/shadcn-ui/references/official-ui-reference.md +0 -1729
  54. package/templates/agents/skills/shadcn-ui/references/reference.md +0 -586
  55. package/templates/agents/skills/shadcn-ui/references/ui-reference.md +0 -1578
  56. package/templates/agents/skills/ui-ux-pro-max/SKILL.md +0 -386
@@ -1,371 +0,0 @@
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
- ---
7
-
8
- # Testing Guidelines & Best Practices
9
-
10
- Comprehensive testing patterns for maintaining quality across any technology stack.
11
-
12
- ## Core Testing Principles
13
-
14
- - **Test Pyramid**: More unit tests (80%), fewer integration tests (15%), minimal E2E tests (5%)
15
- - **Arrange-Act-Assert**: Structure tests clearly with setup, action, and verification
16
- - **Descriptive Names**: Test names should describe expected behavior
17
- - **Independent Tests**: Each test should be able to run in isolation
18
- - **Fast Feedback**: Unit tests should run quickly (<100ms each)
19
- - **Deterministic**: Tests should pass/fail consistently, not randomly
20
-
21
- ## Unit Testing
22
-
23
- Unit tests verify individual functions, methods, and components in isolation.
24
-
25
- ### Unit Test Pattern
26
-
27
- Unit Test Structure:
28
- 1. Arrange
29
- - Set up test data
30
- - Mock dependencies
31
- - Configure test environment
32
-
33
- 2. Act
34
- - Call the function/method being tested
35
- - Perform the action
36
-
37
- 3. Assert
38
- - Verify the result
39
- - Check side effects
40
- - Validate behavior
41
-
42
- ### What to Unit Test
43
-
44
- - Business logic functions (validation, calculations, transformations)
45
- - Utility functions (helpers, formatters, parsers)
46
- - Service/class methods with clear inputs and outputs
47
- - Error handling and edge cases
48
- - Complex conditional logic
49
-
50
- ### Unit Test Examples (Language-Agnostic)
51
-
52
- **Example 1: Validation Function**
53
- Test: Email validation function
54
- - Test valid email returns true
55
- - Test invalid email format returns false
56
- - Test empty string returns false
57
- - Test whitespace is trimmed
58
- - Test case-insensitive comparison
59
-
60
- **Example 2: Business Logic**
61
- Test: Calculate discount price
62
- - Test standard discount percentage
63
- - Test no discount
64
- - Test maximum discount cap
65
- - Test negative prices handled gracefully
66
- - Test rounding is correct
67
-
68
- **Example 3: Error Handling**
69
- Test: Parse JSON data
70
- - Test valid JSON parses successfully
71
- - Test invalid JSON throws appropriate error
72
- - Test missing required fields throws error
73
- - Test extra fields are handled
74
- - Test error messages are helpful
75
-
76
- ### Mocking & Test Doubles
77
-
78
- Use test doubles (mocks, stubs, fakes) for external dependencies:
79
-
80
- Mocking Strategy:
81
- 1. Identify external dependencies
82
- - Database calls
83
- - API calls
84
- - File system access
85
- - Time/date functions
86
- - Random number generation
87
-
88
- 2. Replace with appropriate test double
89
- - Stub: Return fixed value
90
- - Mock: Verify it was called correctly
91
- - Fake: Simplified working implementation
92
-
93
- 3. Verify interactions when appropriate
94
- - Was the dependency called?
95
- - Was it called with correct arguments?
96
- - Was it called the right number of times?
97
-
98
- ## Integration Testing
99
-
100
- Integration tests verify that multiple components work together correctly.
101
-
102
- ### What to Integration Test
103
-
104
- - API endpoints (request response)
105
- - Database operations (save, query, delete)
106
- - Service-to-service interactions
107
- - Authentication and authorization flows
108
- - Error scenarios and edge cases
109
-
110
- ### Integration Test Pattern
111
-
112
- Integration Test Structure:
113
- 1. Setup
114
- - Create test database/data
115
- - Mock external services if needed
116
- - Set up test user/session
117
-
118
- 2. Execute
119
- - Make API call or trigger operation
120
- - Interact with multiple components
121
-
122
- 3. Verify
123
- - Check response status and data
124
- - Verify database changes
125
- - Check side effects
126
-
127
- ### Integration Test Examples
128
-
129
- **Example 1: User Creation API**
130
- Test: POST /api/users with valid data
131
- - Validate request body
132
- - Create user in database
133
- - Return created user with ID
134
- - User can be retrieved afterward
135
- - Password is hashed (not plaintext)
136
-
137
- **Example 2: Authentication Flow**
138
- Test: User login
139
- - Validate credentials
140
- - Create session/token
141
- - Return session/token to client
142
- - Can use session to access protected endpoints
143
- - Session is invalidated on logout
144
-
145
- **Example 3: Error Handling**
146
- Test: Create user with duplicate email
147
- - Database rejects duplicate
148
- - API returns 400 Bad Request
149
- - Error message is appropriate
150
- - No partial data is written
151
-
152
- ## End-to-End Testing
153
-
154
- E2E tests verify complete user journeys across the entire application.
155
-
156
- ### What to E2E Test
157
-
158
- - Critical user workflows (login, purchase, form submission)
159
- - Happy path scenarios
160
- - Common error scenarios
161
- - Cross-browser compatibility (if applicable)
162
- - Accessibility requirements
163
-
164
- ### E2E Test Examples
165
-
166
- **Example 1: User Registration**
167
- Test: New user can register successfully
168
- 1. Navigate to signup page
169
- 2. Fill in email, password, name
170
- 3. Click submit button
171
- 4. Wait for success message
172
- 5. Redirect to dashboard
173
- 6. User can access protected content
174
-
175
- **Example 2: Login with Invalid Credentials**
176
- Test: Login with wrong password
177
- 1. Navigate to login page
178
- 2. Enter email and wrong password
179
- 3. Click login button
180
- 4. See error message "Invalid credentials"
181
- 5. Still on login page (not redirected)
182
- 6. Can try again
183
-
184
- **Example 3: Multi-step Workflow**
185
- Test: User can complete purchase
186
- 1. Navigate to product page
187
- 2. Add item to cart
188
- 3. Navigate to checkout
189
- 4. Enter shipping information
190
- 5. Enter payment information
191
- 6. Submit order
192
- 7. See confirmation page
193
- 8. Receive confirmation email
194
-
195
- ## Accessibility Testing
196
-
197
- Test that your application meets WCAG 2.1 AA standards.
198
-
199
- ### Automated Accessibility Testing
200
-
201
- Use tools to scan for common accessibility violations:
202
- - Color contrast issues
203
- - Missing alt text for images
204
- - Missing labels for form inputs
205
- - Heading hierarchy problems
206
- - Missing ARIA attributes
207
-
208
- ### Manual Accessibility Testing
209
-
210
- - Keyboard navigation: Can user navigate with Tab and Enter?
211
- - Screen reader: Does content make sense when read aloud?
212
- - Visual clarity: Can text be read at smaller sizes?
213
- - Color dependency: Is information conveyed without color alone?
214
- - Responsiveness: Does layout work on different screen sizes?
215
-
216
- ## Performance Testing
217
-
218
- Test performance requirements and regressions.
219
-
220
- ### Performance Metrics to Monitor
221
-
222
- **Web Applications:**
223
- - First Contentful Paint (FCP)
224
- - Largest Contentful Paint (LCP)
225
- - Cumulative Layout Shift (CLS)
226
- - Time to Interactive (TTI)
227
- - Page load time
228
-
229
- **API Endpoints:**
230
- - Response time (p50, p95, p99)
231
- - Throughput (requests per second)
232
- - Error rate
233
- - Database query time
234
- - Memory usage
235
-
236
- ### Performance Testing Examples
237
-
238
- Test: API response time
239
- - Create 100 users in database
240
- - Query all users endpoint
241
- - Measure response time
242
- - Assert completes in <500ms
243
-
244
- Test: Page load performance
245
- - Navigate to homepage
246
- - Measure First Contentful Paint
247
- - Assert completes in <2 seconds
248
-
249
- Test: Database query optimization
250
- - Insert 10,000 records
251
- - Run query with filter
252
- - Verify query uses index
253
- - Measure execution time
254
- - Assert completes efficiently
255
-
256
- ## Hardening Verification Testing
257
-
258
- When hardening/obfuscation is enabled (see `agents/rules/hardening.mdc`), require additional validation on hardened artifacts.
259
-
260
- ### Required Checks for Hardened Builds
261
-
262
- - Run core functional regression tests against hardened output, not only non-hardened builds.
263
- - Run performance checks and compare against accepted budgets (startup, latency, memory as applicable).
264
- - Validate crash/debug workflow with restricted symbol/mapping artifact access controls.
265
- - Confirm release evidence includes hardening profile rationale and rollback trigger/steps.
266
-
267
- If these checks are missing for a hardening-required profile, release readiness should be treated as blocked.
268
-
269
- ## Security Testing
270
-
271
- Test security requirements and threat scenarios.
272
-
273
- ### Security Tests
274
-
275
- Test: Input Validation
276
- - SQL injection payloads in fields
277
- - XSS payloads in fields
278
- - Extremely long strings
279
- - Special characters
280
- - Wrong data types
281
-
282
- Test: Authentication
283
- - Login with wrong password
284
- - Access protected endpoint without credentials
285
- - Use expired token
286
- - Use modified token
287
-
288
- Test: Authorization
289
- - Access another user''s data
290
- - Perform admin operation as regular user
291
- - Modify resource of different user
292
-
293
- Test: Rate Limiting
294
- - Exceed rate limit on authentication
295
- - Verify 429 response
296
- - Verify retry-after header
297
-
298
- ## Test Organization
299
-
300
- Organize tests logically for easy maintenance:
301
-
302
- Project Structure:
303
- tests/
304
- unit/
305
- utils/ # Utility function tests
306
- services/ # Business logic tests
307
- validators/ # Validation tests
308
- formatters/ # Formatter tests
309
-
310
- integration/
311
- api/ # API endpoint tests
312
- database/ # Database operation tests
313
- auth/ # Authentication tests
314
- services/ # Service integration tests
315
-
316
- e2e/
317
- auth/ # Authentication flows
318
- workflows/ # Critical user journeys
319
- forms/ # Form submission flows
320
- pages/ # Page components (if applicable)
321
-
322
- a11y/ # Accessibility tests
323
- performance/ # Performance tests
324
- fixtures/ # Test data
325
- setup.ts # Test configuration
326
-
327
- ## Test Coverage Guidelines
328
-
329
- ### Coverage Targets
330
-
331
- - **Business Logic**: 80%+ coverage required
332
- - **Controllers/Routes**: 70%+ coverage
333
- - **Utils/Helpers**: 90%+ coverage
334
- - **UI Components**: 60%+ coverage
335
- - **Overall**: 75%+ coverage target
336
-
337
- ### Coverage Measurement
338
-
339
- - Generate coverage reports regularly
340
- - Track coverage trends over time
341
- - Identify uncovered critical code
342
- - The goal is quality, not just high numbers
343
-
344
- ## Best Practices
345
-
346
- ### General Best Practices
347
-
348
- - Write tests as you write code (TDD or regular)
349
- - Make tests as simple as production code
350
- - Use meaningful test names that describe behavior
351
- - Keep tests focused on one thing
352
- - Avoid test interdependencies (order shouldn''t matter)
353
- - Clean up test data (database, files, etc.)
354
- - Use version control for test data when needed
355
-
356
- ### Avoiding Common Mistakes
357
-
358
- - Testing implementation details instead of behavior
359
- - Writing tests that are brittle (break on minor changes)
360
- - Tests that are slower than necessary
361
- - Not testing error cases and edge cases
362
- - Skipping security-related tests
363
- - Skipping accessibility tests
364
- - Not maintaining tests (let them rot)
365
- - Testing too much in E2E when unit tests would work
366
-
367
- ---
368
-
369
- Remember: **Tests are documentation** of how your code should behave.
370
- Write clear, concise tests that describe expected behavior.
371
- Good tests make refactoring and maintenance easier and reduce bugs in production.
@@ -1,56 +0,0 @@
1
- ---
2
- title: "Development Workflow Guidelines"
3
- description: "Apply to optimize development process, running pre-commit checks, enforcing quality gates, and keeping project healthy"
4
- alwaysApply: false
5
- version: "3.0.0"
6
- tags: ["workflow", "quality", "validation", "commit"]
7
- globs:
8
- - "**/*"
9
- ---
10
-
11
- # Development Workflow Guidelines
12
-
13
- Technology-agnostic suggestions for keeping the project healthy and maintaining quality before commits.
14
-
15
- ## When This Rule Applies
16
-
17
- 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.
18
-
19
- ## Project Health (agents-templated)
20
-
21
- If this project was scaffolded with agents-templated:
22
-
23
- - **Periodically**: Run `agents-templated validate` to ensure required docs and rules are present; run `agents-templated doctor` for environment and configuration recommendations.
24
- - **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).
25
-
26
- These commands help keep agent rules, documentation, and security patterns in sync.
27
-
28
- ## Pre-Commit Quality Gates
29
-
30
- Before committing, consider running (in order):
31
-
32
- 1. **Lint** – Your stack’s linter (e.g. ESLint, Pylint, golangci-lint) to catch style and simple issues.
33
- 2. **Type check** – If applicable (TypeScript, mypy, etc.) to catch type errors.
34
- 3. **Tests** – At least the fast test suite (e.g. unit tests) so regressions are caught early.
35
- 4. **Project validation** – For agents-templated projects, `agents-templated validate` can confirm setup is intact.
36
-
37
- For high-risk or distributed-client releases, add hardening-specific checks before merge/release:
38
-
39
- 5. **Hardening profile selection** – Document threat model and selected profile from `agents/rules/hardening.mdc`.
40
- 6. **Post-hardening verification** – Run functional regression and performance checks on hardened artifacts.
41
- 7. **Artifact controls** – Verify restricted handling for symbol/mapping/debug artifacts and confirm rollback path.
42
-
43
- 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).
44
-
45
- ## Commit Messages
46
-
47
- - Prefer clear, descriptive messages (e.g. conventional commits: `feat:`, `fix:`, `docs:`).
48
- - Reference issues or tickets when relevant (e.g. “Closes #123”).
49
- - Keep the body focused on what changed and why, not how.
50
-
51
- ## Summary
52
-
53
- - Use **agents-templated validate** and **doctor** to maintain project setup and get recommendations.
54
- - Run **lint**, **type check**, and **tests** before committing when possible.
55
- - For hardening-required releases, include profile rationale, post-hardening verification evidence, and rollback readiness.
56
- - Write clear commit messages and reference issues where applicable.
@@ -1,198 +0,0 @@
1
- # Agent Skills
2
-
3
- This directory contains custom skills for your AI agents. Skills extend agent capabilities with specialized knowledge, workflows, and tools for specific domains.
4
-
5
- ## What is a Skill?
6
-
7
- A **skill** is a reusable module that:
8
- - Defines domain-specific knowledge or workflows
9
- - Extends agent capabilities for specialized tasks
10
- - Can be shared across your project or published for others
11
-
12
- **Rules** define *how to behave*; **Skills** define *how to execute specific tasks*.
13
-
14
- ## Getting Started
15
-
16
- ### Finding Existing Skills
17
-
18
- Use the built-in `find-skills` skill to discover skills from the open ecosystem:
19
-
20
- ```bash
21
- npx skills find [query]
22
- ```
23
-
24
- Examples:
25
- - `npx skills find react testing`
26
- - `npx skills find deployment`
27
- - `npx skills find accessibility`
28
-
29
- Browse more at: https://skills.sh/
30
-
31
- ### Creating a Custom Skill
32
-
33
- To create a new skill for your specific domain:
34
-
35
- 1. **Create a new folder** in this directory:
36
- ```
37
- .github/skills/my-custom-skill/
38
- ```
39
-
40
- 2. **Create a SKILL.md file** with metadata and instructions:
41
- ```markdown
42
- ---
43
- name: my-custom-skill
44
- description: Brief description of what this skill does
45
- ---
46
-
47
- # My Custom Skill
48
-
49
- Instructions and examples for using this skill...
50
- ```
51
-
52
- 3. **Reference it** in your agent documentation or `.cursorrules`
53
-
54
- ### Skill Structure
55
-
56
- ```
57
- .github/skills/
58
- ├── find-skills/
59
- │ └── SKILL.md # Meta-skill for discovering skills
60
- ├── feature-delivery/
61
- │ └── SKILL.md # Systematic feature scoping and execution contracts
62
- ├── bug-triage/
63
- │ └── SKILL.md # Reproduction-first debugging and regression workflows
64
- ├── debug-skill/
65
- │ └── SKILL.md # Breakpoint-first debugging and execution tracing
66
- ├── secure-code-guardian/
67
- │ └── SKILL.md # Secure-by-default coding for auth and input boundaries
68
- ├── feature-forge/
69
- │ └── SKILL.md # Requirements forging before implementation starts
70
- ├── error-patterns/
71
- │ └── SKILL.md # Persistent debugging memory and known-fix application
72
- ├── app-hardening/
73
- │ └── SKILL.md # Risk-based hardening and obfuscation guidance
74
- ├── ui-ux-pro-max/
75
- │ └── SKILL.md # Premium UI/UX implementation patterns
76
- ├── emilkowalski-skill/
77
- │ └── SKILL.md # Frontend polish and animation quality checks
78
- ├── raphaelsalaja-userinterface-wiki/
79
- │ └── SKILL.md # UI hierarchy and interface best-practice playbook
80
- ├── my-custom-skill/
81
- │ └── SKILL.md # Your custom skill
82
- └── README.md # This file
83
- ```
84
-
85
- ## Best Practices
86
-
87
- 1. **Keep skills focused** - Each skill should handle one domain or workflow
88
- 2. **Document clearly** - Include examples and use cases in SKILL.md
89
- 3. **Name descriptively** - Use kebab-case names that reflect the skill's purpose
90
- 4. **Version your skills** - Include version info in the metadata
91
- 5. **Test before sharing** - Ensure skills work as documented
92
-
93
- ## Common Skill Categories
94
-
95
- Consider creating skills for:
96
-
97
- | Category | Use Case |
98
- | --------------- | ---------------------------------------- |
99
- | Web Development | Framework-specific patterns and guidelines |
100
- | Testing | Testing strategies and examples |
101
- | DevOps | Deployment, CI/CD, infrastructure |
102
- | Documentation | Doc generation, README templates |
103
- | Code Quality | Code review, refactoring patterns |
104
- | Design | UI/UX, accessibility, design systems |
105
- | Productivity | Workflows, automation, git patterns |
106
-
107
- ## Recommended Baseline Skills
108
-
109
- - `feature-delivery`: Use when user asks are broad and you need objective, scope, acceptance criteria, and validation plan.
110
- - `bug-triage`: Use for defects and regressions requiring reproducible evidence, root-cause isolation, and minimal safe patches.
111
- - `debug-skill`: Use for breakpoint-driven debugging, execution tracing, and variable-state inspection.
112
- - `secure-code-guardian`: Use for secure-by-default implementation across auth, secrets, and untrusted input.
113
- - `feature-forge`: Use before coding to turn rough asks into execution-ready requirements and acceptance criteria.
114
- - `error-patterns`: Use when errors repeat to apply known fixes from lessons-learned and automatically record new resolutions.
115
- - `app-hardening`: Use for high-risk/distributed runtimes to enforce hardening profile, obfuscation decisions, and release evidence.
116
- - `shadcn-ui`: Use for shadcn/ui installation, component composition, form patterns, and theme customization.
117
- - `emilkowalski-skill`: Use for frontend animation, micro-interaction quality, and visual polish passes.
118
- - `raphaelsalaja-userinterface-wiki`: Use for interface hierarchy, readability, and UX consistency audits.
119
-
120
- ## Using Skills in Your Project
121
-
122
- Skills can be referenced in all your AI assistant configuration files:
123
-
124
- ### Cursor IDE (`.cursorrules`)
125
- ```
126
- When the user asks about [domain], use the [skill-name] skill from .github/skills/[skill-name]/SKILL.md
127
- ```
128
-
129
- ### Claude (`CLAUDE.md`)
130
- ```markdown
131
- ## When Working on [Domain]
132
-
133
- Reference the [skill-name] skill in `.github/skills/[skill-name]/SKILL.md` for patterns and guidance.
134
- ```
135
-
136
- ### GitHub Copilot (`.github/copilot-instructions.md`)
137
- ```markdown
138
- When helping with [domain-specific task], reference the [skill-name] skill from `.github/skills/[skill-name]/SKILL.md`
139
- ```
140
-
141
- ### Documentation (`AGENTS.MD`)
142
- ```markdown
143
- - When working with [domain], see the [skill-name] skill in `.github/skills/[skill-name]/SKILL.md`
144
- ```
145
-
146
- **All AI assistants support skill references.** Keep your team aligned by linking to skill files across your configuration files.
147
-
148
- 3. **Share with your team**:
149
- - Commit to version control
150
- - Document installation in your README
151
-
152
- ## Example: Creating a Fastapi Skill
153
-
154
- ```markdown
155
- ---
156
- name: fastapi-patterns
157
- description: FastAPI development patterns and best practices for your projects
158
- ---
159
-
160
- # FastAPI Patterns
161
-
162
- Use this skill when working with FastAPI projects.
163
-
164
- ## Recommended Patterns
165
-
166
- ### Request Validation
167
- - Use Pydantic models for all request bodies
168
- - Validate query parameters with proper typing
169
-
170
- ### Error Handling
171
- - Return meaningful HTTP status codes
172
- - Document error responses in OpenAPI
173
-
174
- ### Testing
175
- - Use TestClient for API testing
176
- - Mock external dependencies
177
-
178
- ## Project Structure
179
-
180
- ```
181
- src/
182
- ├── api/
183
- │ ├── v1/
184
- │ │ ├── users/
185
- │ │ └── posts/
186
- │ └── dependencies.py
187
- ├── models/
188
- ├── schemas/
189
- ├── database/
190
- └── main.py
191
- ```
192
- ```
193
-
194
- ## Resources
195
-
196
- - [Skills Documentation](https://skills.sh/)
197
- - [Creating Skills Guide](https://skills.sh/docs/creating-skills)
198
- - [Browse Popular Skills](https://skills.sh/explore)
@@ -1,59 +0,0 @@
1
- ---
2
- name: api-design
3
- description: REST and GraphQL API design — resource modeling, OpenAPI specs, versioning strategy, error contracts, pagination, and security patterns.
4
- ---
5
-
6
- # API Design
7
-
8
- Use this skill when designing, reviewing, or documenting REST or GraphQL APIs.
9
-
10
- ## Trigger Conditions
11
-
12
- - User asks to design, build, or review an API endpoint or service.
13
- - Requests involve routes, schemas, data contracts, or API versioning.
14
- - Pagination, error handling, or authentication patterns are discussed.
15
- - OpenAPI / Swagger spec generation is needed.
16
- - Breaking change management or deprecation strategy is required.
17
-
18
- ## Workflow
19
-
20
- ### REST APIs
21
-
22
- 1. Define resource hierarchy and URL structure (`/resources/{id}/sub-resources`).
23
- 2. Apply correct HTTP methods (GET/POST/PUT/PATCH/DELETE) with idempotency notes.
24
- 3. Design request/response schemas with explicit, versioned types.
25
- 4. Define the error contract: `{ error: { code, message, details } }` with HTTP status mapping.
26
- 5. Choose pagination strategy: cursor-based for large/real-time datasets; offset for simple cases.
27
- 6. Document authentication scheme (Bearer token, API key, OAuth2 scopes) per endpoint.
28
- 7. Generate OpenAPI 3.1 spec.
29
-
30
- ### GraphQL APIs
31
-
32
- 1. Design schema types, queries, mutations, and subscriptions.
33
- 2. Apply DataLoader pattern to prevent N+1 queries.
34
- 3. Define error types in schema (not just HTTP-layer errors).
35
- 4. Enforce query depth and complexity limits to prevent abuse.
36
- 5. Document field-level deprecation strategy (`@deprecated` directive with migration notes).
37
-
38
- ### Versioning
39
-
40
- - Prefer URI versioning (`/v1/`, `/v2/`) for REST; field deprecation for GraphQL.
41
- - Never mutate an existing contract in place — breaking changes require a new version.
42
- - Maintain prior version for at least one deprecation cycle with migration docs.
43
-
44
- ## Output Contract
45
-
46
- - Resource or type definitions
47
- - Endpoint / operation list with method, path, auth requirement
48
- - Request/response schema examples (JSON)
49
- - Error code reference table
50
- - Pagination strategy description
51
- - OpenAPI 3.1 spec (REST) or SDL schema (GraphQL)
52
-
53
- ## Guardrails
54
-
55
- - Never expose internal stack traces or DB column names in error responses.
56
- - Always validate input at the API boundary — never trust client-supplied data.
57
- - Do not design endpoints that require admin-level credentials from the client.
58
- - Rate limit all public-facing endpoints.
59
- - Apply `agents/rules/security.mdc` for all auth and input handling decisions.