Claude-skill-registry commit.lint
Formats and lints code with ruff using a sub-agent. Use after tests pass to ensure code style compliance.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/commit-lint" ~/.claude/skills/majiayu000-claude-skill-registry-commit-lint-f221fd && rm -rf "$T"
skills/data/commit-lint/SKILL.mdcommit.lint
Step 3/4 in full workflow
Full commit workflow: review, test, lint, and commit
Reviews code, runs tests, lints, and commits changes. Use when ready to commit work with quality checks.
Prerequisites (Verify First)
Before proceeding, confirm these steps are complete:
/commit.test
Instructions
Goal: Formats and lints code with ruff using a sub-agent. Use after tests pass to ensure code style compliance.
Lint Code
Objective
Format and lint the codebase using ruff to ensure code quality and consistency.
Task
Run ruff format and ruff check to format and lint the code. This step should be executed using a sub-agent to conserve context in the main conversation.
Process
IMPORTANT: Use the Task tool to spawn a sub-agent for this work. This saves context in the main conversation. Use the
haiku model for speed.
-
Spawn a sub-agent to run linting
Use the Task tool with these parameters:
: "Bash"subagent_type
: "haiku"model
: See belowprompt
The sub-agent should:
a. Run ruff format
ruff format .This formats the code according to ruff's style rules.
b. Run ruff check with auto-fix
ruff check --fix .This checks for lint errors and automatically fixes what it can.
c. Run ruff check again to verify
ruff check .Capture the final output to verify no remaining issues.
-
Review sub-agent results
- Check that both format and check completed successfully
- Note any remaining lint issues that couldn't be auto-fixed
-
Handle remaining issues
- If there are lint errors that couldn't be auto-fixed, fix them manually
- Re-run ruff check to verify
Example Sub-Agent Prompt
Run ruff to format and lint the codebase: 1. Run: ruff format . 2. Run: ruff check --fix . 3. Run: ruff check . (to verify no remaining issues) Report the results of each command.
Quality Criteria
- ruff format was run successfully
- ruff check was run with --fix flag
- No remaining lint errors
Context
This step ensures code quality and consistency before committing. It runs after tests pass and before the commit step. Using a sub-agent keeps the main conversation context clean for the commit review.
Job Context
A workflow for preparing and committing code changes with quality checks.
The full workflow starts with a code review to catch issues early, runs tests until they pass, formats and lints code with ruff, then reviews changed files before committing and pushing. The review and lint steps use sub-agents to reduce context usage.
Steps:
- review - Code review for issues, DRY opportunities, naming, and test coverage (runs in sub-agent)
- test - Pull latest code and run tests until they pass
- lint - Format and lint code with ruff (runs in sub-agent)
- commit_and_push - Review changes and commit/push
Work Branch
Use branch format:
deepwork/commit-[instance]-YYYYMMDD
- If on a matching work branch: continue using it
- If on main/master: create new branch with
git checkout -b deepwork/commit-[instance]-$(date +%Y%m%d)
Outputs
Required outputs:
code_formatted
Guardrails
- Do NOT skip prerequisite verification if this step has dependencies
- Do NOT produce partial outputs; complete all required outputs before finishing
- Do NOT proceed without required inputs; ask the user if any are missing
- Do NOT modify files outside the scope of this step's defined outputs
Quality Validation
Before completing this step, you MUST have your work reviewed against the quality criteria below.
Use a sub-agent (Haiku model) to review your work against these criteria:
Criteria (all must be satisfied):
- ruff format was run successfully
- ruff check was run with --fix flag
- No remaining lint errors Review Process:
- Once you believe your work is complete, spawn a sub-agent using Haiku to review your work against the quality criteria above
- The sub-agent should examine your outputs and verify each criterion is met
- If the sub-agent identifies valid issues, fix them
- Have the sub-agent review again until all valid feedback has been addressed
- Only mark the step complete when the sub-agent confirms all criteria are satisfied
On Completion
- Verify outputs are created
- Inform user: "full step 3/4 complete, outputs: code_formatted"
- Continue workflow: Use Skill tool to invoke
/commit.commit_and_push
Reference files:
.deepwork/jobs/commit/job.yml, .deepwork/jobs/commit/steps/lint.md