- メッセージの冒頭で、タスクや質問を明確に述べる。
- Claudeがあなたのニーズを理解するための文脈と詳細を提供する。
- 複雑なタスクを小さく管理しやすいステップに分ける。
悪いプロンプト:
SELECT
*,
CONCAT(CONCAT('KILL ', id), ';') AS KILL_SQL,
CONCAT(CONCAT('CALL mysql.rds_kill(', id), ');') AS KILL_SQL_FOR_RDS
FROM
INFORMATION_SCHEMA.PROCESSLIST
WHERE
db = 'your_db'
AND info LIKE '%probrem_query%'| # gem install rspec | |
| # rspec calculator.rb | |
| require "rspec" | |
| class Calculator | |
| def sum(value1, value2) | |
| value1 + value2 | |
| end | |
| end |
%cat /usr/local/bin/rubymine
#!/bin/sh
open -na /Applications/RubyMine.app --args "$@"
chmod +x/usr/local/bin/rubymine
| # ruby extract_sql.rb app.rb | |
| require 'ripper' | |
| $SQL_TEXTS = [] | |
| class ExtractSql < Ripper::Filter | |
| def on_tstring_content(tok, _) | |
| text = tok.strip.upcase | |
| $SQL_TEXTS << text if text.index('SELECT') || text.index('UPDATE') || text.index('INSERT') || text.index('DELETE') |
| # gem 'parser' | |
| # bundle exec ruby-rewrite -l method_rewriter.rb -m app.rb | |
| class MethodRewriter < Parser::TreeRewriter | |
| def on_def(node) | |
| padding = ' ' * (node.location.column + 2) | |
| insert_start(node: node, args: node.children[1].location.expression, code: node.children[2], padding: padding) | |
| insert_after(node.children.last.location.expression, "\n#{padding}#{puts_end}") | |
| super |
| # bundle exec ruby-rewrite -l method_rewriter.rb -m app.rb | |
| class MethodRewriter < Parser::TreeRewriter | |
| def on_def(node) | |
| padding = ' ' * (node.location.column + 2) | |
| insert_start(node: node, args: node.children[1].location.expression, code: node.children[2], padding: padding) | |
| insert_after(node.children.last.location.expression, "\n#{padding}#{puts_end}") | |
| super | |
| end |
let texts = [];
$$('.js-commits-list-item clipboard-copy').forEach(function (e, i){ texts.push("git cherry-pick " + e.value) })
copy(texts.join('\n'));クリップボードに下記が入る
git cherry-pick fab98cd67eebcd95a6c7e305873ddc49485cf6dx
| linters: | |
| LineLength: | |
| enabled: false | |
| SpaceInsideHashAttributes: | |
| enabled: false | |
| ViewLength: | |
| enabled: false | |
| InlineStyles: | |
| enabled: false | |
| ClassesBeforeIds: |
| module Mysql2 | |
| class Client | |
| orig_query = instance_method(:query) | |
| define_method(:query) do |sql, options = {}| | |
| Rails.logger.info("[#{Time.current}] SQL:[#{sql}]") | |
| orig_query.bind(self).call(sql, options) | |
| end | |
| end | |
| end |