一键导入
add-cog
Step-by-step guide to add a new discord.py Cog to the framework
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Step-by-step guide to add a new discord.py Cog to the framework
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ccdb のマイナー/メジャーリリース手順。「v1.4.0としてリリースして」等と言われたときに使う。
Python coding patterns, idioms, and quality standards for claude-code-discord-bridge development
Security checklist specific to claude-code-discord-bridge — subprocess injection, env leaks, input validation
Enforce test-driven development — write tests FIRST, then implement. Mandatory for new features and bug fixes.
Testing patterns for claude-code-discord-bridge — pytest, async testing, mocking Discord objects, TDD workflow
Run full verification pipeline (lint, format, test, security) before committing
| name | add-cog |
| description | Step-by-step guide to add a new discord.py Cog to the framework |
Create claude_discord/cogs/your_cog.py:
"""Short description of what this Cog does."""
from __future__ import annotations
import logging
import discord
from discord import app_commands
from discord.ext import commands
logger = logging.getLogger(__name__)
class YourCog(commands.Cog):
"""Docstring explaining the Cog's purpose."""
def __init__(
self,
bot: commands.Bot,
# Add dependencies as constructor params (dependency injection)
) -> None:
self.bot = bot
# Add commands and listeners here
Use the shared helper — never duplicate the streaming logic:
from ._run_helper import run_claude_in_thread
# In your command handler:
runner = self.runner.clone() # Always clone for concurrent safety
await run_claude_in_thread(
thread=thread,
runner=runner,
repo=self.repo,
prompt=user_input,
session_id=existing_session_id,
)
Add to claude_discord/cogs/__init__.py:
from .your_cog import YourCog
Add to claude_discord/__init__.py:
from .cogs.your_cog import YourCog
# And add "YourCog" to __all__
Create tests/test_your_cog.py:
discord.Interaction, discord.TextChannel, etc.)Run the verify skill to ensure everything passes:
uv run ruff check claude_discord/
uv run ruff format claude_discord/
uv run pytest tests/ -v --cov=claude_discord
from __future__ import annotations: Required in every filelogger = logging.getLogger(__name__), never print()_is_authorized(user_id)contextlib.suppress(discord.HTTPException) for non-critical Discord API calls