run-format
ฟอร์แมตโค้ดและแก้ไขปัญหาจาก formatter
SKILL.mdrun-format/SKILL.md
GitHubGoal
Format code and resolve formatter issues until everything passes
Scope
Run format for all project types and handle errors/warnings from the formatter
Execute
Pre-Run: Always run
/deep-reviewfirst —run-*must be reviewed/assessed before the main work, never skip; if findings are blockers, fix or report before running (format)
1. Check Formatter Config
Goal: Check Formatter Config
Check the formatter used in the project
- Check
biome.jsoncfor Biome - Check
dprint.jsoncfor dprint - Check
.prettierrcfor Prettier - Check the scripts in
package.json
2. Run Format Command
Goal: Run Format Command
Run the formatter command as configured
- If using Biome: run
biome format --write(never use the--unsafeflag) - If using dprint: run
dprint fmt - If using Prettier: run
prettier --write - Use the script from
package.jsonif one exists - Wait for formatting to finish before continuing
3. Analyze Format Issues
Goal: Analyze Format Issues
Analyze the problems caused by the formatter
- Check the output from the formatter
- Check the types of issues:
- syntax errors
- config-related errors
- unsupported files
- format violations
- Identify the problematic files
4. Fix Config Issues
Goal: Fix Config Issues
Resolve problems related to the config
- If there are config-related errors, use
formatterto fix the config - Adjust the formatter config to suit the codebase
- Adjust the rules to suit the project
- Run format again to test
5. Fix Code Issues
Goal: Fix Code Issues
Resolve problems occurring in the code
- Fix syntax errors before formatting
- Fix format violations in priority order
- Handle unsupported files
- Run format again until there are no errors
6. Verify
Goal: Verify
Check the result
- Run format again to confirm
- Check that no format errors remain
- Check that every file has been formatted
- Run lint afterward to confirm
Rules
1. Config Adjustments
Always try to fix the config before fixing the code
- Adjust the formatter config to suit the codebase
- Adjust the rules to suit the project
- Use
formatterto fix the config correctly - Avoid disabling rules unnecessarily
2. Syntax Errors
Always fix syntax errors before formatting
- Check for syntax errors before running format
- Fix all syntax errors completely
- Use a linter to help verify syntax
- Run format after the syntax is correct
3. Format Scope
Define the scope for formatting
- Format the whole project by default
- Use glob patterns for specific files
- Use the
--writeflag for auto-fix - Use the
--checkflag for CI
4. Verification
Check that the code still works normally
Run format again to confirm
Run lint afterward
Check that there are no regressions
Never use the
--unsafeflag with biome commandsUse /convert-files-format if needed
Use /follow-best-practice if needed
Use /suggest-next-action if needed
Use /run-check if needed
Use /run-verify if needed
Use /resolve-errors if needed
Use /run-lint if needed
Use /run-drizzle-studio if needed
Expected Outcome
Code that passes format with no format errors, plus a report of the format run