| name | source-command-fix-typescript |
| description | Run the migrated source command `fix-typescript`. |
source-command-fix-typescript
Use this skill when the user asks to run the migrated source command fix-typescript.
Command Template
Prompt for AI Agent: Targeted TypeScript Error Resolution in a Mono-repo
Your Role:
You are an AI software engineer specializing in diagnosing and fixing TypeScript type errors with high precision.
Your Mission:
Your sole objective is to eliminate all TypeScript type errors within a specific project, designated as {projectName}, located within the current mono-repo. You must achieve this by modifying code only within the {projectName} project.
Operational Workflow:
-
Initial Diagnosis:
a. Determine Package Name: If {projectName} appears to be a directory path (e.g., packages/lorcana-cards), check the name field in that directory's package.json. Use this package name for the filter flag (e.g., --filter=@tcg/lorcana-cards).
b. Execute the command: bunx turbo check-types --filter={packageName}.
c. Carefully analyze the output. Isolate and list all type errors that are reported for files belonging exclusively to the targeted project.
-
Iterative Fixing & Validation:
a. For each identified type error (or a logical group of related errors) in {projectName}:
i. Develop a precise code modification strategy to resolve it. The strategy should aim for robust and correct type fixes, not just suppressing errors (e.g., avoid indiscriminate use of any or ts-ignore unless no other within-project solution exists and it's a localized fix).
ii. Implement the fix by modifying the relevant file(s) strictly within the {projectName} project.
b. After applying one or more fixes, re-execute bun run typecheck.
c. Review the new output from bun run typecheck:
i. Confirm Fixes: Verify if the targeted errors in {projectName} have been resolved.
ii. Identify Regressions/New Errors: Check for any new type errors that your changes may have introduced within {projectName}.
iii. Persisting Errors: Note any original errors in {projectName} that still persist.
d. If bunx turbo check-types --filter=@lorcanito/{projectName} still reports errors for {projectName}, repeat step 2.a with the updated list of errors relevant to {projectName}.
-
Completion Criterion:
Your task is considered complete when bunx turbo check-types --filter=@lorcanito/{projectName}, after your modifications, reports zero type errors for the {projectName} project.
Critical Directives & Constraints:
- Strict Project Boundary: All code modifications MUST be confined to files located within the
{projectName} project. You are NOT permitted to change files in other projects, shared libraries, or any other directories outside of {projectName}, even if an error in {projectName} seems to originate from or be related to types defined externally.
- Handling External Dependencies: If a type error in
{projectName} is fundamentally caused by an incorrect type definition in an external library or another project within the mono-repo (i.e., the fix must occur outside {projectName}), you should:
- Clearly identify and report this situation.
- State that the error cannot be resolved under the current constraint of modifying only
{projectName}.
- Do NOT attempt to modify external files.
- Mandatory Validation Tool: The
bunx turbo check-types --filter=@lorcanito/{projectName} command is your exclusive tool for error checking and validation. Base all your decisions about the presence or absence of type errors within {projectName} solely on its output.
- Focused Error Interpretation: When analyzing the output of
bunx turbo check-types --filter=@lorcanito/{projectName}, concentrate only on errors reported for files within {projectName}. Ignore errors reported for other projects in the mono-repo.
Inputs You Will Use:
- The name of the target project:
{projectName} (this will be provided to you).
- The terminal output of the
bunx turbo check-types --filter=@lorcanito/{projectName} command, which you will execute.
Expected Outcome:
- The codebase of
{projectName} is modified such that bunx turbo check-types --filter=@lorcanito/{projectName} passes without reporting any type errors attributable to files within {projectName}.
- If any errors persist that require changes outside of
{projectName}, these are clearly reported as unresolvable under the given constraints.
- Learning from the session, you will update the prompt to make it more accurate and efficient.
Example of {projectName}:
If the mono-repo has projects like apps/frontend, packages/ui-library, apps/backend, and you are tasked to fix errors in apps/frontend, then {projectName} would be apps/frontend. You would only modify files within the apps/frontend directory.
MANUAL MIGRATION REQUIRED
Migrated from source command fix-typescript into a Codex skill. Invoke it as $source-command-fix-typescript and manually rewrite any slash-command behavior that depended on provider-specific runtime expansion.