Skip to content

Commit cc9e808

Browse files
minor fix (#2235)
1 parent 4b6e21c commit cc9e808

405 files changed

Lines changed: 30694 additions & 7633 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: aspnet-minimal-api-openapi
3+
description: 'Create ASP.NET Minimal API endpoints with proper OpenAPI documentation'
4+
---
5+
6+
# ASP.NET Minimal API with OpenAPI
7+
8+
Your goal is to help me create well-structured ASP.NET Minimal API endpoints with correct types and comprehensive OpenAPI/Swagger documentation.
9+
10+
## API Organization
11+
12+
- Group related endpoints using `MapGroup()` extension
13+
- Use endpoint filters for cross-cutting concerns
14+
- Structure larger APIs with separate endpoint classes
15+
- Consider using a feature-based folder structure for complex APIs
16+
17+
## Request and Response Types
18+
19+
- Define explicit request and response DTOs/models
20+
- Create clear model classes with proper validation attributes
21+
- Use record types for immutable request/response objects
22+
- Use meaningful property names that align with API design standards
23+
- Apply `[Required]` and other validation attributes to enforce constraints
24+
- Use the ProblemDetailsService and StatusCodePages to get standard error responses
25+
26+
## Type Handling
27+
28+
- Use strongly-typed route parameters with explicit type binding
29+
- Use `Results<T1, T2>` to represent multiple response types
30+
- Return `TypedResults` instead of `Results` for strongly-typed responses
31+
- Leverage C# 10+ features like nullable annotations and init-only properties
32+
33+
## OpenAPI Documentation
34+
35+
- Use the built-in OpenAPI document support added in .NET 9
36+
- Define operation summary and description
37+
- Add operationIds using the `WithName` extension method
38+
- Add descriptions to properties and parameters with `[Description()]`
39+
- Set proper content types for requests and responses
40+
- Use document transformers to add elements like servers, tags, and security schemes
41+
- Use schema transformers to apply customizations to OpenAPI schemas
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: context-map
3+
description: 'Generate a map of all files relevant to a task before making changes'
4+
---
5+
6+
# Context Map
7+
8+
Before implementing any changes, analyze the codebase and create a context map.
9+
10+
## Task
11+
12+
{{task_description}}
13+
14+
## Instructions
15+
16+
1. Search the codebase for files related to this task
17+
2. Identify direct dependencies (imports/exports)
18+
3. Find related tests
19+
4. Look for similar patterns in existing code
20+
21+
## Output Format
22+
23+
```markdown
24+
## Context Map
25+
26+
### Files to Modify
27+
| File | Purpose | Changes Needed |
28+
|------|---------|----------------|
29+
| path/to/file | description | what changes |
30+
31+
### Dependencies (may need updates)
32+
| File | Relationship |
33+
|------|--------------|
34+
| path/to/dep | imports X from modified file |
35+
36+
### Test Files
37+
| Test | Coverage |
38+
|------|----------|
39+
| path/to/test | tests affected functionality |
40+
41+
### Reference Patterns
42+
| File | Pattern |
43+
|------|---------|
44+
| path/to/similar | example to follow |
45+
46+
### Risk Assessment
47+
- [ ] Breaking changes to public API
48+
- [ ] Database migrations needed
49+
- [ ] Configuration changes required
50+
```
51+
52+
Do not proceed with implementation until this map is reviewed.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: context7-mcp
3+
description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
4+
---
5+
6+
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
7+
8+
## When to Use This Skill
9+
10+
Activate this skill when the user:
11+
12+
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
13+
- Requests code involving libraries ("Write a Prisma query for...")
14+
- Needs API references ("What are the Supabase auth methods?")
15+
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
16+
17+
## How to Fetch Documentation
18+
19+
### Step 1: Resolve the Library ID
20+
21+
Call `resolve-library-id` with:
22+
23+
- `libraryName`: The library name extracted from the user's question
24+
- `query`: The user's full question (improves relevance ranking)
25+
26+
### Step 2: Select the Best Match
27+
28+
From the resolution results, choose based on:
29+
30+
- Exact or closest name match to what the user asked for
31+
- Higher benchmark scores indicate better documentation quality
32+
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
33+
34+
### Step 3: Fetch the Documentation
35+
36+
Call `query-docs` with:
37+
38+
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
39+
- `query`: The user's specific question
40+
41+
### Step 4: Use the Documentation
42+
43+
Incorporate the fetched documentation into your response:
44+
45+
- Answer the user's question using current, accurate information
46+
- Include relevant code examples from the docs
47+
- Cite the library version when relevant
48+
49+
## Guidelines
50+
51+
- **Be specific**: Pass the user's full question as the query for better results
52+
- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
53+
- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: csharp-async
3+
description: 'Get best practices for C# async programming'
4+
---
5+
6+
# C# Async Programming Best Practices
7+
8+
Your goal is to help me follow best practices for asynchronous programming in C#.
9+
10+
## Naming Conventions
11+
12+
- Use the 'Async' suffix for all async methods
13+
- Match method names with their synchronous counterparts when applicable (e.g., `GetDataAsync()` for `GetData()`)
14+
15+
## Return Types
16+
17+
- Return `Task<T>` when the method returns a value
18+
- Return `Task` when the method doesn't return a value
19+
- Consider `ValueTask<T>` for high-performance scenarios to reduce allocations
20+
- Avoid returning `void` for async methods except for event handlers
21+
22+
## Exception Handling
23+
24+
- Use try/catch blocks around await expressions
25+
- Avoid swallowing exceptions in async methods
26+
- Use `ConfigureAwait(false)` when appropriate to prevent deadlocks in library code
27+
- Propagate exceptions with `Task.FromException()` instead of throwing in async Task returning methods
28+
29+
## Performance
30+
31+
- Use `Task.WhenAll()` for parallel execution of multiple tasks
32+
- Use `Task.WhenAny()` for implementing timeouts or taking the first completed task
33+
- Avoid unnecessary async/await when simply passing through task results
34+
- Consider cancellation tokens for long-running operations
35+
36+
## Common Pitfalls
37+
38+
- Never use `.Wait()`, `.Result`, or `.GetAwaiter().GetResult()` in async code
39+
- Avoid mixing blocking and async code
40+
- Don't create async void methods (except for event handlers)
41+
- Always await Task-returning methods
42+
43+
## Implementation Patterns
44+
45+
- Implement the async command pattern for long-running operations
46+
- Use async streams (IAsyncEnumerable<T>) for processing sequences asynchronously
47+
- Consider the task-based asynchronous pattern (TAP) for public APIs
48+
49+
When reviewing my C# code, identify these issues and suggest improvements that follow these best practices.

0 commit comments

Comments
 (0)