بنقرة واحدة
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 المهني
c-lord のバージョン/リリース手順。「v1.5.0としてリリースして」等と言われたときに使う。
Python coding patterns, idioms, and quality standards for c-lord development
Security checklist specific to c-lord — 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 c-lord — 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 c_lord/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 c_lord/cogs/__init__.py:
from .your_cog import YourCog
Add to c_lord/__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 c_lord/
uv run ruff format c_lord/
uv run pytest tests/ -v --cov=c_lord
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