원클릭으로
zhin-context-services
Details Zhin context services (config, database, cron, permission) and how to register or consume them in plugins.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Details Zhin context services (config, database, cron, permission) and how to register or consume them in plugins.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Explains Zhin command registration, middleware flow, and permission checks. Use when building commands or message middleware in Zhin plugins.
Guides creation and management of Zhin tools using ZhinTool, defineTool, and ToolService. Covers the unified tool system that bridges AI agent tool-calling and message commands, including Tool↔Command conversion, permission levels, platform/scope filtering, and tool collection. Use when registering tools, converting between tools and commands, or integrating tools with AI agents.
Guides integration of AI/LLM capabilities in Zhin plugins using @zhin.js/ai. Covers multi-model providers, Agent tool calling, session management, streaming responses, unified tool services, and rich media output. Use when adding AI chat, agents, or tool-calling features to a Zhin bot.
Guides development of custom platform adapters in Zhin. Covers extending the Adapter abstract class, creating Bot instances, handling message events, registering tools, and lifecycle management. Use when building adapters for new chat platforms.
Guides database usage in Zhin including model definitions, CRUD queries, transactions, migrations, and lifecycle hooks. Covers the built-in ORM based on @zhin.js/database with SQLite support. Use when working with data persistence in Zhin plugins.
Guides error handling in Zhin using the built-in error hierarchy, ErrorManager, RetryManager, and CircuitBreaker. Use when implementing resilient error handling, retry logic, or circuit breaker patterns in Zhin plugins.
SOC 직업 분류 기준
| name | zhin-context-services |
| description | Details Zhin context services (config, database, cron, permission) and how to register or consume them in plugins. |
| license | MIT |
| metadata | {"author":"zhinjs","version":"1.0","framework":"zhin"} |
Use this skill when developers need to interact with built-in contexts or provide custom services via defineContext.
import { usePlugin } from '@zhin.js/core'
const plugin = usePlugin()
// Inject built-in contexts
const config = plugin.inject('config')
const permissions = plugin.inject('permission')
const cronService = plugin.inject('cron')
Use plugin.contextIsReady('service') to check if a context is available before using it.
Load or read config files via ConfigService:
const configService = plugin.inject('config')
const config = configService?.get('zhin.config.yaml', {
debug: false,
plugins: []
})
Notes:
.json, .yaml, .yml${ENV_NAME:default}Register scheduled tasks using the Cron class and addCron:
import { Cron } from '@zhin.js/core'
plugin.addCron(new Cron('0 * * * *', async () => {
plugin.logger.info('Hourly task')
}))
Cron entries are auto-started and stopped when the plugin is disposed.
The permission service provides checks in MessageCommand.permit(...). You can also extend it by pushing a new check function:
const permission = plugin.inject('permission')
permission?.add({
name: /^role\(.+\)$/,
check: async (name, message) => {
// custom role validation
return false
}
})
If the database context is enabled, use it via plugin.inject('database'):
const database = plugin.inject('database')
const users = await database?.select('User')
To define new models, call plugin.defineModel(name, definition) if the database service is active.
import { defineContext, usePlugin } from '@zhin.js/core'
const plugin = usePlugin()
plugin.provide(defineContext({
name: 'metrics',
description: 'Metrics service',
mounted: async () => ({
counter: 0
}),
dispose: (value) => {
// cleanup
},
extensions: {
increment() {
this.counter += 1
}
}
}))
Custom contexts can also extend Plugin.Extensions so you can call new helper methods from plugins.