with one click
add-cog
Step-by-step guide to add a new discord.py Cog to the framework
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Step-by-step guide to add a new discord.py Cog to the framework
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
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