contribute-skill
Original:🇨🇳 Chinese
Translated
Automatically create PRs for registering insights, patterns, and workflows obtained from the current project as skills to the TBSten/skills repository. It performs the full process consistently: collecting insights from the project's CLAUDE.md, .claude/rules/, .claude/skills/, and codebase, packaging them into reusable skills, and creating the corresponding PR. Use when requested: "Register insights to the skill repository", "contribute skill", "Share this insight", "Register as a skill", "Compile insights into a PR", "Turn this pattern into a skill". gh CLI and git must be installed.
2installs
Sourcetbsten/skills
Added on
NPX Install
npx skill4agent add tbsten/skills contribute-skillTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →contribute-skill
Collect insights from the current project and automatically create a PR to register them as a skill in the TBSten/skills repository.
Prerequisite Check
First verify the following items when the skill starts. If the check fails, guide the user on the solution and abort the process.
- Confirm git is installed via
git --version - Confirm gh CLI authentication status via
gh auth status
Step 1: Confirmation on Startup
Receive the description of the insights the user wants to collect from ARGUMENTS. Confirm the following items. You can skip confirmation for items that can be clearly read from the user's instructions.
- skill name — Name in kebab-case. Propose an appropriate name based on the content of the insights
- Collection target — Which insights to turn into a skill. Specify concrete file paths or sections
- Target users of the skill — What kind of projects/scenarios the skill is intended for
- Repository — Defaults to . Confirm with the user if a fork is used
TBSten/skills
Step 2: Insight Collection and Organization
Read the collection targets specified by the user.
Collection Efficiency Improvement
When there are many collection targets, use Agent tools for parallel collection:
- Read core files (Get file list via Glob → Parallel Read)
- Investigate usage locations (Search for callers via Grep → Parallel Read)
- Investigate test code (Parallel Agent)
Always execute independent file reads in parallel.
Main sources:
- Specific sections of CLAUDE.md
- Rule files in
.claude/rules/ - Existing skills in
.claude/skills/ - Patterns and utilities in the codebase
- Actual usage locations — Investigate callers of the target code via Grep etc., collect usage patterns (usage in ViewModel, usage in UI, usage in tests, etc.)
- Test code — Search for tests of the target code (,
*Test.kt,*Spec.kt, etc.)*.test.ts - The user's own description
Handling of Test Code
If tests are found, determine the inclusion policy based on the following criteria:
- Include in example/test/: When the way of writing tests itself is part of the skill (test patterns are one of the values of the skill)
- List in references/: When test patterns are provided as reference information
- Do not include: When tests are strongly dependent on project-specific frameworks
If included, remove project-specific dependencies in the same way as Step 3.5.
Organize the collected insights into the following format and present them to the user:
- Skill purpose — What it achieves in 1-2 sentences
- Trigger conditions — What utterances/scenarios it should be activated in (list 5 or more)
- Procedures/Workflow — Bullet points of specific execution steps
- Usage patterns — List 3 or more usage examples in real projects
- Included resources — Sample code, templates, etc. Specify "None" if not needed
- Target project prerequisites — Prerequisites such as language, framework, directory structure, etc.
Proceed to the next step after obtaining user approval.
Step 3: Work Directory Preparation and add-skill.md Loading
- Prepare the work directory:
bash
rm -rf /tmp/contribute-skill
git clone --depth 1 https://github.com/<repo>.git /tmp/contribute-skill<repo>TBSten/skills- Load the skill creation guide in the cloned repository:
/tmp/contribute-skill/.claude/skills/add-skill.mdAfter loading add-skill.md, integrate as follows:
- Step 1 of add-skill.md (Confirmation items): Already completed in Steps 1-2 of contribute-skill. Skip
- Step 2 of add-skill.md (Create SKILL.md): Follow the format/structure rules. Use the insights organized in Step 2 of contribute-skill for content
- Steps 3-5 of add-skill.md (Resource placement / Documentation / README): Follow as is
If the guide is not found, follow the "Fallback" section below.
Step 3.5: Code Generalization
Verify and execute the following before placing code in example:
- Detect project-specific imports: Scan all imports of example target files, list dependencies outside the skill's example package
- Dependency classification and handling:
- Standard libraries (,
kotlin.*) → Keep as iskotlinx.* - Framework standard libraries (,
androidx.*, etc.) → Keep as isreact - Project-specific utilities → Replace with standard alternatives, or include in example
- Project-specific annotations → Delete
- Standard libraries (
- Package name abstraction: Unify to (comply with package name conventions in add-skill.md)
com.example.<skill-name-without-hyphens> - Present replacement results to the user: Show a list of what was replaced with what, obtain approval
Step 4: Create Skill Files
In the cloned directory, create the following items following the steps in add-skill.md. Fill in each section of SKILL.md based on the insights organized in Step 2.
/tmp/contribute-skill/- — frontmatter (name, description) + procedure manual
skills/<skill-name>/SKILL.md - Resources in ,
references/,example/as neededassets/ - — Detailed documentation (English)
skills/<skill-name>.md - — Detailed documentation (Japanese)
skills/<skill-name>.ja.md - Add a row to the Available Skills table in and
README.mdREADME.ja.md
Review Presentation Method
Change the presentation method according to the number of created files:
- 5 files or less: Present the content of all files
- 6 files or more: Present the following
- File list and summary of each file (1 line)
- Full content of SKILL.md (most important file)
- Pick up files that require special attention and present their content
- Ask the user: "Would you like to check other files as well?"
Make corrections if there is feedback before proceeding to the next step.
Exclusion Check for Project-Specific Information
Since the skill will be registered in a public repository, pay close attention to ensure that the created files do not contain the following:
- Project-specific file paths, URLs, domain names
- Names of internal systems and services
- Authentication information, tokens, API keys
- Personal names, email addresses, team names
- Links to internal documents
- Other information that should not be disclosed
If specific examples are needed when generalizing insights, replace them with placeholders (, , etc.). Report the check results to the user, confirm there are no issues before proceeding.
<project-name><your-package>Step 4.5: Self-Review
Verify the following before creating the PR:
- All required files are present — Confirm the following files exist:
- exists
./skills/<skill-name>.ja.md - exists
./skills/<skill-name>.md - exists
./skills/<skill-name>/SKILL.md - All files referenced in SKILL.md exist under
./skills/<skill-name>/ - A new skill entry has been added to the Available Skills table in and
README.mdREADME.ja.md
- SKILL.md word count is 5,000 words or less — Check with . If exceeded, separate detailed content into references/
wc -w - No duplicate information between SKILL.md and references/ — SKILL.md only contains overview/procedures, detailed code examples are separated into references/
- Imports in example/ are consistent — Check for remaining project-specific dependencies via
grep -r "^import" - README table has the same format as existing rows — Compare HTML tags, line breaks, code block writing style with existing rows
If issues are found, fix them before reporting to the user.
Step 5: Create PR
Present the following content to the user, and execute only after explicitly obtaining permission to push and create the PR:
- Target repository and branch name for push
- List of files included in the commit
- Final confirmation that no project-specific information is included
After obtaining permission, execute the following:
bash
cd /tmp/contribute-skill
git checkout -b add-skill/<skill-name>
git add skills/<skill-name>/ README.md README.ja.md
git commit -m "add <skill-name> skill"
git push -u origin add-skill/<skill-name>Create the PR:
bash
gh pr create \
--repo <repo> \
--head add-skill/<skill-name> \
--title "Add <skill-name> skill" \
--body "## Summary
- <Skill purpose organized in Step 2>
## Files
- skills/<skill-name>/SKILL.md
- <List of other added files>
## Test plan
- [ ] Can be installed via npx skills add <repo> --skill <skill-name>
- [ ] Can be triggered correctly with the skill's trigger phrases
"Report the created PR URL to the user.
Error Handling
- failed → Guide the user to run
gh auth statusgh auth login - Clone failed → Guide the user to check network connection
- Push failed → Guide the user to check write permission to the repository. Suggest using a fork
- PR creation failed due to existing branch with the same name → Retry with a suffix (etc.) added to the branch name
-v2
Fallback
If add-skill.md does not exist in the cloned repository, create with the following minimum configuration:
- Describe YAML frontmatter (name, description) + procedures in
skills/<skill-name>/SKILL.md - Describe overview/usage/prerequisites in /
skills/<skill-name>.md<skill-name>.ja.md - Guide the user to manually update the README table