Repository navigation
chore: add pre-commit configuration and issue skill #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| --- | ||
| description: Fetch details of a GitHub issue, create a dedicated local branch, implement the changes, verify, and commit. | ||
| argument-hint: "<issue-number> e.g. 42" | ||
| --- | ||
|
|
||
| Work on a GitHub issue for dlight-client. The issue number to address is: **$ARGUMENTS** | ||
|
|
||
| Follow these steps exactly, stopping and reporting to the user if any step fails. | ||
|
|
||
| ## 1. Validate inputs | ||
|
|
||
| - If no issue number was provided in `$ARGUMENTS`, stop and ask the user: "Please specify the issue number you want to work on, e.g., `/issue 42`." | ||
| - Ensure `$ARGUMENTS` is a valid number. If not, stop and inform the user. | ||
|
|
||
| ## 2. Fetch issue details | ||
|
|
||
| Run the following command to retrieve the issue details: | ||
| ```bash | ||
| gh issue view "$ARGUMENTS" | ||
| ``` | ||
|
|
||
| Read and analyze the output to understand: | ||
| - The problem statement. | ||
| - The proposed changes. | ||
| - The acceptance criteria. | ||
|
|
||
| If the command fails (e.g. because of network issues or if the issue does not exist), stop and report to the user. | ||
|
|
||
| ## 3. Create a branch | ||
|
|
||
| Extract the title from the issue output and derive a slug: | ||
| - Lowercase, alphanumeric, and hyphens only. | ||
| - Format: `issue-$ARGUMENTS-<slug>` (max ~50 characters total). | ||
| - Example: Issue 42 "pre-commit config for ruff" → `issue-42-ruff-pre-commit` | ||
|
|
||
| Check out a new branch: | ||
| ```bash | ||
| git checkout -b <branch-name> | ||
| ``` | ||
|
|
||
| ## 4. Implement changes | ||
|
|
||
| Locate the target files in the repository. Implement the changes requested in the issue description, ensuring: | ||
| - You adhere to PEP 8 coding style and existing project conventions. | ||
| - You do not introduce unrelated modifications. | ||
| - If there are new public methods or parameters, you update the documentation in `docs/` as required by `CLAUDE.md`. | ||
|
|
||
| ## 5. Verify the changes | ||
|
|
||
| Run the test suite and verify formatting/linting before committing: | ||
| ```bash | ||
| # Run unit tests | ||
| python -m unittest discover tests/ | ||
|
|
||
| # Run ruff check and format check | ||
| ruff check . | ||
| ruff format --check . | ||
| ``` | ||
|
|
||
| If any check fails, resolve the issues before moving forward. | ||
|
|
||
| ## 6. Commit the changes | ||
|
|
||
| Stage only the modified and newly created files: | ||
| ```bash | ||
| git add <modified-files> | ||
| ``` | ||
| Do not stage helper scripts or build artifacts. | ||
|
|
||
| Compose a conventional commit message that references and closes the issue: | ||
| - Format: `<type>(<scope>): <summary> (closes #$ARGUMENTS)` | ||
| - Example: `chore(ci): add pre-commit config for ruff (closes #42)` | ||
|
|
||
| Commit the staged changes: | ||
| ```bash | ||
| git commit -m "<commit-message>" | ||
| ``` | ||
|
|
||
| ## 7. Confirm | ||
|
|
||
| Tell the user: | ||
| - What issue was worked on (number and title). | ||
| - The name of the branch created. | ||
| - The list of files modified. | ||
| - The commit message and hash. | ||
| - Remind them that they can run `/commit` to push the branch and prepare a pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.5.0 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix] | ||
| - id: ruff-format | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,8 @@ git clone https://github.com/irishsmurf/dlight-client.git | |||||
| cd dlight-client | ||||||
| python -m venv .venv && source .venv/bin/activate | ||||||
| pip install -e . | ||||||
| pip install pytest pytest-asyncio flake8 ruff | ||||||
| pip install pytest pytest-asyncio flake8 ruff pre-commit | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Ruff is being introduced as the primary linter and formatter (and is configured in the pre-commit hooks),
Suggested change
References
|
||||||
| pre-commit install | ||||||
| python -m pytest tests/ | ||||||
| ``` | ||||||
|
|
||||||
|
|
@@ -54,6 +55,15 @@ ruff check dlightclient/ | |||||
| - Type hints on all public methods | ||||||
| - Comments only when the *why* is non-obvious | ||||||
|
|
||||||
| ### Pre-commit Hooks | ||||||
|
|
||||||
| To ensure consistent formatting and linting, please set up the pre-commit hooks: | ||||||
|
|
||||||
| ```bash | ||||||
| pip install pre-commit | ||||||
| pre-commit install | ||||||
| ``` | ||||||
|
|
||||||
| ## Commit conventions | ||||||
|
|
||||||
| [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `docs:`, `chore:`, `test:`, `refactor:`, `perf:`. One logical change per commit. | ||||||
|
|
||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure general repository hygiene beyond Python files, it is highly recommended to include standard pre-commit hooks such as
trailing-whitespace,end-of-file-fixer, andcheck-yaml. This helps maintain consistent formatting across all file types (e.g., Markdown, YAML, JSON).