用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/aibot88/sec_skill_store --skill commit-coauthor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | commit-coauthor |
| description | Create git commit with co-author attribution and comprehensive safety checks |
| context | fork |
| allowed-tools | ["Bash","Read","Grep"] |
Creates git commits with proper co-author attribution, following repository conventions and safety protocols.
Token Efficiency: Automates git safety checks and commit message generation (40% savings: 1,000 → 600 tokens)
Invoke with: /commit-coauthor [optional-message]
Examples:
/commit-coauthor - Auto-generate commit message from staged changes/commit-coauthor "Fix authentication bug" - Use provided message/commit-coauthor "feat: Add user profile page" - Follow conventional commitsgit add already executed)Run git status to verify staged changes:
git status --porcelain
Check for:
If no staged changes:
git add first."If merge conflicts exist:
Check staged files for sensitive patterns:
# Get list of staged files
git diff --cached --name-only
Scan for sensitive file patterns:
.env files (environment variables)credentials.json, secrets.yaml (credential files)*.pem, *.key (private keys)id_rsa, *.p12 (SSH/certificate files)password, secret, token in nameIf sensitive files detected:
Grep staged files for sensitive content patterns:
# Check for hardcoded secrets in staged changes
git diff --cached | grep -iE "(api_key|secret_key|password|access_token|private_key)" || true
If sensitive content found:
Get comprehensive diff of staged changes:
# Show staged changes with file names and line counts
git diff --cached --stat
git diff --cached
Analyze changes to determine:
Read recent commits for style:
# Get last 5 commit messages to match repo style
git log -5 --pretty=format:"%s"
Identify commit message conventions:
feat:, fix:, docs:, refactor:, test:, chore:feat(auth):, fix(api):Only if user didn't provide message
Message structure:
[type]([scope]): [short summary]
[optional body - detailed explanation]
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Type classification logic:
| Files Changed | Patterns Found | Type |
|---|---|---|
src/**/*.tsx, components/** | New component created | feat |
*.tsx, *.ts | Bug fix in existing code | fix |
README.md, docs/** | Documentation only | docs |
*.test.ts, *.spec.ts | Test files only | test |
| Code structure changes, no new behavior | Refactoring | refactor |
| Build config, dependencies | Configuration | chore |
Scope extraction:
auth/**, *Auth*): authapi/**, *api*): apidb/**, *.drizzle.*): dbcomponents/**): uiSummary guidelines:
Example auto-generated messages:
feat(auth): Add password reset functionality
Implements password reset flow with email verification.
Adds /api/auth/reset-password endpoint and email templates.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
fix(api): Resolve null pointer in user profile endpoint
Adds null check before accessing user.shifts property.
Fixes TypeError that prevented profile page from loading.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Format commit message with co-author trailer:
If user provided message:
[user-message]
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
If auto-generated:
[generated-message-with-body]
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Execute commit with HEREDOC for proper formatting:
git commit -m "$(cat <<'EOF'
[commit-message-here]
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
EOF
)"
CRITICAL Git Safety Rules:
--no-verify (skip hooks)--amend unless:
--force or --force-with-leaseCheck git status after commit:
git status
git log -1 --pretty=format:"%h %s%n%b"
Success indicators:
If commit failed:
If commit succeeded:
Return structured result:
{
"success": true,
"commit_hash": "a1b2c3d",
"commit_message": "[full commit message]",
"files_committed": ["src/components/Auth.tsx", "src/api/auth.ts"],
"files_count": 2,
"insertions": 45,
"deletions": 12,
"unstaged_changes": 0,
"co_author_added": true
}
If commit failed:
{
"success": false,
"error": "Pre-commit hook failed: ESLint errors",
"recommendation": "Fix ESLint errors and retry commit"
}
CRITICAL: Never use --no-verify or -n flag
# ❌ WRONG - Skips pre-commit hooks
git commit --no-verify -m "message"
# ✅ CORRECT - Respects hooks
git commit -m "message"
If pre-commit hook fails:
--no-verify to bypassOnly use --amend when ALL conditions met:
git log -1 --format='%an %ae' | grep -q "Claude"
git status | grep -q "Your branch is ahead"
NEVER amend if:
If commit FAILED or REJECTED:
NEVER run force push unless:
# ❌ NEVER run automatically
git push --force
git push --force-with-lease
# ✅ Only if user explicitly requests and confirms
# Show warning: "⚠️ Force push to main can overwrite team's work. Are you sure?"
NEVER commit without warning:
.env files (recommend .env.example instead)credentials.json, secrets.yaml.pem, .key)password, secret, token in contentIf user requests committing sensitive file:
Symptom: git status shows no files in staging area
Cause: User forgot to git add files
Solution:
# Show what files can be staged
git status --short
# Return error
echo "No changes staged for commit. Use 'git add <file>' first."
Symptom: Commit rejected with hook error message Cause: Code doesn't pass lint, format, or test checks Solution:
npm run lint:fix to auto-fix errors"--no-verify)Symptom: Commit rejected due to commit message validation hook Cause: Message doesn't follow Conventional Commits or repo standards Solution:
Symptom: git status shows UU (unmerged) files
Cause: User in middle of merge with conflicts
Solution:
echo "Unresolved merge conflicts detected in:"
git diff --name-only --diff-filter=U
echo "Resolve conflicts first using 'git mergetool' or manually edit files."
Symptom: git status shows "HEAD detached at [commit]"
Cause: User checked out specific commit instead of branch
Solution:
echo "⚠️ In detached HEAD state. Commit will not be on any branch."
echo "Checkout a branch first: 'git checkout main'"
User: /commit-coauthor
Git status:
M src/components/Settings.tsx
M src/api/settings.ts
A src/types/settings.d.ts
Auto-generated commit:
feat(settings): Add user notification preferences
Implements email and SMS notification toggles.
Adds Settings API endpoint and TypeScript types.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Output:
{
"success": true,
"commit_hash": "7f3a8c2",
"commit_message": "feat(settings): Add user notification preferences\n\nImplements email and SMS notification toggles.\nAdds Settings API endpoint and TypeScript types.\n\nCo-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>",
"files_committed": ["src/components/Settings.tsx", "src/api/settings.ts", "src/types/settings.d.ts"],
"files_count": 3,
"insertions": 87,
"deletions": 5,
"co_author_added": true
}
Console log: "✅ Commit created: 7f3a8c2 'feat(settings): Add user notification preferences'"
User: /commit-coauthor "Fix null pointer in scheduler view"
Commit:
Fix null pointer in scheduler view
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Output:
{
"success": true,
"commit_hash": "b4c8d1e",
"commit_message": "Fix null pointer in scheduler view\n\nCo-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>",
"files_committed": ["src/components/SchedulerView.tsx"],
"files_count": 1,
"insertions": 3,
"deletions": 1,
"co_author_added": true
}
User: /commit-coauthor
Staged files: .env, src/config/database.ts
Output:
⚠️ Sensitive file detected: .env
This file may contain secrets or credentials.
Recommendations:
1. Create .env.example with placeholder values instead
2. Add .env to .gitignore
3. Use environment variables for sensitive data
Detected patterns in .env:
- DATABASE_URL (contains connection string)
- JWT_SECRET (contains secret key)
Do you want to proceed with committing .env? (Type 'yes' to confirm)
If user confirms 'yes':
If user cancels:
git reset HEAD .env to unstageUser: /commit-coauthor
Pre-commit hook output:
ESLint found 3 errors:
src/components/Settings.tsx
42:15 error 'user' is not defined no-undef
58:22 error Missing semicolon semi
Skill output:
{
"success": false,
"error": "Pre-commit hook failed: ESLint errors",
"details": "3 errors in src/components/Settings.tsx",
"recommendation": "Fix ESLint errors:\n1. Line 42: Define 'user' variable\n2. Line 58: Add missing semicolon\n\nRun 'npm run lint:fix' to auto-fix, then retry commit."
}
Console log: "❌ Commit failed: ESLint errors detected. Fix errors and retry."
User: /commit-coauthor
Staged files: Multiple test files added
Auto-detected type: test
Commit:
test(auth): Add unit tests for password reset flow
Tests email verification and token expiration.
Achieves 95% coverage for auth module.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Use this Skill:
Combine with other Skills:
/debug-console (verify no console errors)/visual-test-figma (verify design matches)/commit-coauthor (commit changes with co-author)/create-pr (create pull request) - P2 SkillIntegration with Git Workflow:
# Feature development workflow
git checkout -b feature/user-settings
# ... make changes ...
git add .
/commit-coauthor # ← This Skill
git push -u origin feature/user-settings
/create-pr # ← P2 Skill (next phase)
Type prefixes:
feat: New featurefix: Bug fixdocs: Documentation onlystyle: Code style (formatting, missing semicolons)refactor: Code restructuring without behavior changeperf: Performance improvementtest: Adding/updating testschore: Build process, dependencies, toolingScope examples:
(auth): Authentication/authorization(api): API endpoints(db): Database schema/queries(ui): UI components(build): Build system(deps): DependenciesBreaking changes:
feat(api)!: Change user endpoint response format
BREAKING CHANGE: User endpoint now returns 'id' instead of 'userId'
Baseline (manual git commit):
With commit-coauthor Skill:
Savings: 400 tokens (40% reduction)
Projected usage: 20x per week Weekly savings: 8,000 tokens Annual savings: 416,000 tokens (~$1.04/year)
Skill Version: 1.0 Created: 2026-01-09 Last Updated: 2026-01-09 Requires: Claude Code v2.1.0+, Git repository