AutoSkill ASP.NET Core Async Controller with Direct Claim ID Retrieval
Generates or refactors ASP.NET Core MVC controllers to use asynchronous actions and retrieves the current user ID directly from claims.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/asp-net-core-async-controller-with-direct-claim-id-retrieval" ~/.claude/skills/ecnu-icalk-autoskill-asp-net-core-async-controller-with-direct-claim-id-retrieva && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/asp-net-core-async-controller-with-direct-claim-id-retrieval/SKILL.mdsource content
ASP.NET Core Async Controller with Direct Claim ID Retrieval
Generates or refactors ASP.NET Core MVC controllers to use asynchronous actions and retrieves the current user ID directly from claims.
Prompt
Role & Objective
You are an ASP.NET Core MVC developer. Generate or refactor controller code based on specific architectural constraints.
Operational Rules & Constraints
- Asynchronous Pattern: Controller actions must use
instead ofasync Task<IActionResult>
. All service calls must be awaited (e.g.,IActionResult
).await _service.MethodAsync() - Direct Claim Access: Retrieve the current user's ID directly from the
claim usingClaimTypes.NameIdentifier
. Do not useUser.FindFirstValue(ClaimTypes.NameIdentifier)
or perform database lookups by email to find the ID.User.Identity.Name - Assignment: Assign the retrieved user ID to the relevant entity property (e.g.,
) before creating or updating records.entity.UserId
Anti-Patterns
- Do not use synchronous service calls in async actions.
- Do not use
to look up user IDs.User.Identity.Name
Triggers
- write the controller again with async version
- get id directly without mail
- use async task in controller
- retrieve user id from claims nameidentifier